-
Notifications
You must be signed in to change notification settings - Fork 927
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
Change runner logic to not create pool for sequential runner #4502
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Merel Theisen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Signed-off-by: Merel Theisen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @merelcht! That’s a more robust approach. One small question from my side
@@ -226,7 +226,30 @@ def _run( | |||
done = None | |||
max_workers = self._get_required_workers_count(pipeline) | |||
|
|||
with self._get_executor(max_workers) as pool: | |||
pool = self._get_executor(max_workers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me from a logical point of view.
But I would suggest moving this into SequentialRunner._run
. Otherwise, we modify the behaviour of the base class based on what is inherited from it, which is not entirely correct from the implementation point of view and AbstractRunner._run
becomes too long. I understand that it will require some duplication, but in the SequentialRunner._run
method, we can add a note explaining why we keep the implementation like that. But adding it to AbstractRunner._run
will overload it even more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a very strong opinion on this, but my counter argument is then wouldn't it be confusing that the thread and parallel logic is in the AbstractRunner._run
method but sequential isn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Elena that, from a Pythonic perspective, common logic should be placed in _run()
within the Abstract class. If there are exceptions, we should override the common logic with specific behavior, which is how runners worked previously. However, I thought the goal of the previous PR, which Merel is currently modifying, was to centralise the runner's logic within the Abstract
class.
We had already decided that the _run()
function in the abstract class would rely on _get_executor()
, which would be implemented specifically in different subclasses. I don't see any issues with this approach. For me, the main question is how large and readable AbstractRunner._run()
will be. As Merel pointed out, consolidating all the running logic in one place will be beneficial, which was also the intention of the previous PR.
Signed-off-by: Merel Theisen <[email protected]>
I addressed @ElenaKhaustova 's comment about moving the sequential logic to the @DimedS any thoughts? |
Signed-off-by: Merel Theisen <[email protected]>
Signed-off-by: Merel Theisen <[email protected]>
kedro/runner/runner.py
Outdated
) | ||
self._release_datasets(node, catalog, load_counts, pipeline) | ||
pool = self._get_executor(max_workers) | ||
if pool is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's related to what @merelcht is saying, but for the record I was skimming this code and thought "what if pool is None
?" (there's no else
branch here). Just a comment from the peanut gallery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah exactly! I think it might not be immediately obvious that that logic is now inside SequentialRunner
.
Signed-off-by: Merel Theisen <[email protected]>
I agree, I also think that, given the current state, it would be beneficial to keep all the running logic in the Abstract class. I have provided a full comment in the thread: #4502 (comment). |
Signed-off-by: Merel Theisen <[email protected]>
Description
Address #4486
Development notes
Verified that this fixes the issues mentioned in Galileo-Galilei/kedro-mlflow#624 and kedro-org/kedro-plugins#1012
Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file