Clivern / Kraven

:white_flower: A SaaS docker management dashboard to manage your docker containers, images, volumes, networks and much more!
Apache License 2.0
7 stars 1 forks source link

Update Jobs to adapt kraven #6

Closed Clivern closed 6 years ago

Clivern commented 6 years ago

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