fmartingr
/
jeeves
Archived
1
0
Fork 0
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.
jeeves/jeeves/db/tasks.py

23 lines
513 B
Python

import json
import dramatiq
from jeeves.db.models import Run, Result
@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