-
-
Notifications
You must be signed in to change notification settings - Fork 211
[ENH] Reduce complexity of run_flow_on_task func
#1596
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1596 +/- ##
==========================================
- Coverage 53.02% 52.62% -0.41%
==========================================
Files 36 36
Lines 4326 4342 +16
==========================================
- Hits 2294 2285 -9
- Misses 2032 2057 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
geetu040
left a comment
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 really nice, I have left a few comments with only minor changes requested.
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
geetu040
left a comment
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.
Nicely refactored, LGTM.
CC: @fkiraly, @SimonBlanke for review/merge.

Summary
This PR refactors
run_flow_on_task, which had grown to ~160 lines with high cyclomatic complexity, by extracting small helper functions with clear, single responsibilities. The main function is now a readable orchestrator with clearly defined steps.Changes
Extracted helper functions
_validate_flow_and_task_inputsHandles input validation and backward-compatible argument handling
_sync_flow_with_serverSynchronizes the flow with the server and checks for duplicate runs
_prepare_run_environmentPrepares environment information and run tags
_create_run_from_resultsBuilds the
OpenMLRunobject from execution resultsInternal structure improvements
_RunResultsNamedTupleto bundle execution outputs(
data_content,trace,evaluations) and reduce long parameter listsType Safety Improvements
assertstatements with explicitValueError/TypeErrorexceptionsNoneFixes #1580