예제 #1
0
 def run(self, request, pk=None):
   try:
     task = self.get_object()
     taskrun = task.start()
     return Response({'message': 'OK','taskrun_pk': taskrun.pk})
   except Exception, exc:
     return build_exception_response()
예제 #2
0
def task_progress_consumer(message):
    taskrun = TaskRun.objects.get(pk=message.content['taskrun_pk'])
    progress = message.content.get('progress', None)
    if progress is not None:
        taskrun.advance(progress, result=message.content.get('result', None))
    try:
        taskrun.task.downcast.progress(taskrun)
    except Exception, exc:
        taskrun.fail(build_exception_response().data)
예제 #3
0
def task_progress_consumer(message):
  taskrun = TaskRun.objects.get(pk=message.content['taskrun_pk'])
  progress = message.content.get('progress',None)
  if progress is not None:
    taskrun.advance(progress,result=message.content.get('result',None))
  try:
    taskrun.task.downcast.progress(taskrun)      
  except Exception, exc:
    taskrun.fail(build_exception_response().data)
예제 #4
0
 def start(self):
     if self.max_run > 0 and self.running_count >= self.max_run:
         raise Exception(build_error_response(RESPERR.TOO_MANY_RUNS).data)
     taskrun = TaskRun.objects.create(task=self)
     try:
         if self. async:
             Channel('task-run').send({'taskrun_pk': taskrun.pk})
         else:
             self.downcast.run(taskrun)
     except Exception, exc:
         taskrun.fail(build_exception_response().data)
예제 #5
0
 def start(self):
   if self.max_run > 0 and self.running_count >= self.max_run:
     raise Exception(build_error_response(RESPERR.TOO_MANY_RUNS).data)    
   taskrun = TaskRun.objects.create(task=self)
   try:
     if self.async:
       Channel('task-run').send({'taskrun_pk': taskrun.pk})
     else:
       self.downcast.run(taskrun)      
   except Exception, exc:
     taskrun.fail(build_exception_response().data)
예제 #6
0
def task_run_consumer(message):
    taskrun = TaskRun.objects.get(pk=message.content['taskrun_pk'])
    try:
        taskrun.task.downcast.run(taskrun)
    except Exception, exc:
        taskrun.fail(build_exception_response().data)
예제 #7
0
def task_run_consumer(message):
  taskrun = TaskRun.objects.get(pk=message.content['taskrun_pk'])
  try:
    taskrun.task.downcast.run(taskrun)      
  except Exception, exc:
    taskrun.fail(build_exception_response().data)