code: def on_chord_part_return(self, task, state, result, propagate=False):  # pylint: disable=redefined-outer-name
          u
          with transaction.atomic():
              chord_data = ChordData.objects.select_for_update().get(  # select_for_update will prevent race conditions
                  callback_result__task_id=task.request.chord[u'options'][u'task_id']
              )
              _ = TaskMeta.objects.update_or_create(
                  task_id=task.request.id,
                  defaults={
                      u'status': state,
                      u'result': result
                  }
              )
              if chord_data.is_ready():
                  # we don't use celery beat, so this is as good a place as any to fire off periodic cleanup tasks
                  self.get_suitable_app(current_app).tasks[u'celery.backend_cleanup'].apply_async()
                  chord_data.execute_callback()
docs: u"""
          Update the linking ChordData object and execute callback if needed.
  
          Parameters
          ----------
              subtask: The subtask that just finished executing. Most useful values
                  are stored on subtask.request.
              state: the status of the just-finished subtask.
              result: the resulting value of subtask execution.
              propagate: unused here, we check CELERY_CHORD_PROPAGATES and the
                  chord's options in chord_data.execute_callback()