-
Notifications
You must be signed in to change notification settings - Fork 901
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
Refactor Runners, introduce Task
class
#4206
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
# Conflicts: # kedro/runner/runner.py
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
kedro/runner/sequential_runner.py
Outdated
@@ -75,21 +75,22 @@ def _run( | |||
|
|||
for exec_index, node in enumerate(nodes): | |||
try: | |||
run_node(node, catalog, hook_manager, self._is_async, session_id) | |||
from kedro.runner.task import Task |
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.
This is needed because I refactored run_node
in the runner to use Task
and moved methods to Task
as well. run_node
isn't actually needed anymore, but removing it would be a breaking change. I could undo the changes to runner.py
which removes the import from Task
and then allows it to be imported inside the runner implementations again. The downside is that we'd have duplicated code in runner.py
and task.py
.
Signed-off-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Is there a relevant issue for this? Nothing against the idea of introducing the "task" abstraction; just interested to better understand what motivates it. |
I'll update the description when the PR is ready for review. |
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <49397448+merelcht@users.noreply.github.com>
Task
Task
class
In general not much concern the refactoring looks simple enough and is a better abstraction than the previous one. I would like to run the benchmark once #4210 is ready to make sure we don't run into memory/perf issue. Side note: I think the current |
…ional argument, and adding parallel as boolean flag Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
Signed-off-by: Merel Theisen <merel.theisen@quantumblack.com>
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.
Looks much cleaner now, thank you @merelcht!
Left one minor suggestion.
"""Decrement dataset load counts and release any datasets we've finished with""" | ||
for dataset in node.inputs: | ||
load_counts[dataset] -= 1 | ||
if load_counts[dataset] < 1 and dataset not in pipeline.inputs(): |
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.
if load_counts[dataset] < 1 and dataset not in pipeline.inputs(): | |
if load_counts[dataset] and dataset not in pipeline.inputs(): |
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.
@ElenaKhaustova can you explain the suggestion of removing the check for the load_counts[dataset]
to be smaller than 1?
Description
Introduced the
Task
class, which encapsulates what is actually run in each of the runners to make theRunners
code more readable.I've always found the code in runners a bit hard to navigate. The (simplified) flow before my refactor for running a node was:
Now it's:
Development notes
Task
which contains all that is needed to execute aNode
._release_datasets()
to remove duplicated code across the runners.runner.py
to theTask
class.parallel_runner.py
totask.py
run_node()
as deprecated, because it's replaced byTask.execute()
and no longer called directly anywhere other than tests.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