title: Is it ok to pass an OrderedDict as a Celery task argument?
body: <p>I have inside a Django REST Framework's serializer <strong>an overridden <code>update</code> method</strong>.<br>
  In this <code>update</code>, as user can send lots of children, I have <strong>an asynchronous Celery task <code>process_children</code></strong>, to deal with the kids.  </p>
  
  <pre><code>class MyModelSerializer(serializers.ModelSerializer):
      ....
  
      @transaction.atomic
      def update(self, mymodel, validated_data):
          try:
              children_data = validated_data.pop('children')
              transaction.on_commit(lambda: process_children.apply_async(
                  countdown=1,
                  args=[mymodel.id, children_data]))
          except KeyError:
              pass
          ...
  </code></pre>
  
  <p>In the args, there is one argument which <strong>is not a <code>json</code> object but an <code>OrderedDict</code></strong>: <code>children_data</code>.</p>
  
  <p>The task looks like:</p>
  
  <pre><code>@app.task
  def process_children(mymodel_id, children_data):
      mymodel = MyModel.objects.get(pk=mymodel_id)
      children = mymodel.children.all()
      for child_data in children_data:
          try:
              child = children.get(start=child_data['start'])
              child = populate_child(child, child_data)
              child.save()
          except Child.DoesNotExist:
              create_child(mymodel, child_data)
  </code></pre>
  
  <h2>I read that we should only send <code>json</code> (or pickle, yaml, whatever...) args.</h2>
  
  <ul>
  <li>But this setup seems to work</li>
  <li>I can even send <code>datetime</code> object (i.e. the <code>start</code> attribute I use in the task to match a stored child with new values sent through the api).</li>
  </ul>
  
  <h2>So what's happening here?</h2>
  
  <ul>
  <li>Is everything ok, celery serializes and deserializes OrderedDict like a boss.</li>
  <li>Or I am crazy and should serialize before invoking the task and deserialize inside the task?</li>
  </ul>
  
  <h2>[UPDATE, adding CELERY settings]</h2>
  
  <pre><code>CELERY_BROKER_URL = get_env_variable('REDIS_URL')
  CELERY_BROKER_POOL_LIMIT = 0
  CELERY_REDIS_MAX_CONNECTIONS = 10
  CELERY_ACCEPT_CONTENT = ['application/json']
  CELERY_TASK_SERIALIZER = 'json'
  CELERY_TIMEZONE = 'Europe/London'
  </code></pre>