Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegating set_parent_task to ProcessInfo.__init__ #111

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

Skrattoune
Copy link
Contributor

Hi Jedie,

working a bit on the subtasks, I realized that currently, we have to link to parent_task_id two times:
first through the task code through the manager:

            main_task_id=parent_task_id,
            sub_task_id=task.id,
        )

and second, we have to feed ProcessInfo with parent_task_id

I initially thought that within ProcessInfo.__init__ we should read parent_task_id from the task.

Then I realized that, as ProcessInfo.__init__ is anyway used to update fields from TaskModel,
it should be better to keep the same logic, and allow ProcessInfo.__init__ to generate the link between parent_task and sub_task if parent_task_id is provided.

That way, we gain a step, and the process of creating sub tasks is much easier (especially for new users).

And all previous implementations are still working the same (we just update the link between parent and sub task for nothing)

Hi Jedie,

working a bit on the subtasks, I realized that currently, we have to link to `parent_task_id` two times:
first through the task code through the manager:
```        TaskModel.objects.set_parent_task(
            main_task_id=parent_task_id,
            sub_task_id=task.id,
        )
```

and second, we have to feed `ProcessInfo` with `parent_task_id`

I initially thought that within `ProcessInfo.__init__` we should read `parent_task_id` from the task.

Then I realized that, as `ProcessInfo.__init__` is anyway used to update fields from TaskModel,
 it should be better to keep the same logic, and allow `ProcessInfo.__init__` to generate the link between parent_task and sub_task if `parent_task_id` is provided.

That way, we gain a step, and the process of creating sub tasks is much easier (especially for new users).

And all previous implementations are still working the same (we just update the link between parent and sub task for nothing)
@jedie jedie merged commit 0b63d12 into boxine:master Dec 1, 2022
@jedie
Copy link
Collaborator

jedie commented Dec 1, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants