Clivern/Kraven

Update Jobs to adapt kraven

Clivern opened this issue · 1 comments

Update Jobs to adapt kraven

Jobs will be tasks tackled by workers. On success signal triggered by the worker, we will update task status on db. So workers will be responsibe for updating their tasks status.

from app.tasks import hello
from app.modules.core.task import Task



# .......

        task_result = hello.delay('Hello World')

        Task().create_task({
            "name": "Hello Task",
            "uuid": task_result.task_id,
            "status": "pending",
            "executor": "app.tasks.hello",
            "parameters": '{"text": "Hello World"}',
            "result": '{}',
            "user_id": self.__user_id
        })

and later worker will update the DB