Delegating set_parent_task to ProcessInfo.__init__#111
Merged
jedie merged 2 commits intoboxine:masterfrom Dec 1, 2022
Merged
Conversation
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
approved these changes
Dec 1, 2022
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Jedie,
working a bit on the subtasks, I realized that currently, we have to link to
parent_task_idtwo times:first through the task code through the manager:
and second, we have to feed
ProcessInfowithparent_task_idI initially thought that within
ProcessInfo.__init__we should readparent_task_idfrom 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 ifparent_task_idis 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)