This repository has been archived on 2021-02-14. You can view files and clone it, but cannot push or open issues or pull requests.
2019-09-30 16:13:37 +00:00
|
|
|
import json
|
|
|
|
|
|
|
|
import dramatiq
|
|
|
|
|
2019-10-01 18:20:37 +00:00
|
|
|
from jeeves.db.models import Run, Result
|
2019-09-30 16:13:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
@dramatiq.actor
|
|
|
|
def start_execution(execution_id):
|
|
|
|
run = Run.objects.get(pk=execution_id)
|
|
|
|
result = Result()
|
|
|
|
for task in run.flow.tasks:
|
|
|
|
flow_step = task.run()
|
|
|
|
result.add_step(flow_step)
|
|
|
|
run.output += flow_step.output
|
|
|
|
if flow_step.error:
|
|
|
|
run.success = False
|
|
|
|
break
|
|
|
|
run._result = json.dumps(result.serialize())
|
|
|
|
run.status = Run.FINISHED
|
|
|
|
run.save()
|
|
|
|
return run
|