Skip to content

Delegating set_parent_task to ProcessInfo.__init__#111

Merged
jedie merged 2 commits intoboxine:masterfrom
Skrattoune:patch-8
Dec 1, 2022
Merged

Delegating set_parent_task to ProcessInfo.__init__#111
jedie merged 2 commits intoboxine:masterfrom
Skrattoune:patch-8

Conversation

@Skrattoune
Copy link
Copy Markdown
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
Copy Markdown
Member

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