Skip to content

Reset _closeables in _init for flow reuse#597

Merged
gtopper merged 4 commits intomlrun:developmentfrom
alxtkr77:bug/ML-11518
Dec 21, 2025
Merged

Reset _closeables in _init for flow reuse#597
gtopper merged 4 commits intomlrun:developmentfrom
alxtkr77:bug/ML-11518

Conversation

@alxtkr77
Copy link
Member

No description provided.

@gtopper gtopper changed the title Reset _closeables in _init for flow reuse Reset _closeables in _init for flow reuse Dec 18, 2025
Copy link
Collaborator

@gtopper gtopper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Would be good to add a regression unit test.

Copy link
Collaborator

@gtopper gtopper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Please rebase / merge from dev before merge. This branch is missing

commit 0bfaa08e78570c2909275dae2740829a056f3aa8 (mlrun/development, mlrun/HEAD, development)
Author: davesh0812 <85231462+davesh0812@users.noreply.github.com>
Date:   Sun Dec 21 12:33:03 2025 +0200

    Minor fixes to the cyclic pr (#598)

Alex Toker added 4 commits December 21, 2025 12:42
Tests verify that _closeables is properly reset when flows are reused:
- test_flow_reuse_resets_closeables: Base Flow class resets to []
- test_aggregate_by_key_reuse_resets_closeables: AggregateByKey sets [table]
- test_map_with_state_reuse_resets_closeables: MapWithState sets [state] for Table
- test_map_with_state_no_closeables_without_close_method: No closeables for dict state
- test_nosql_target_reuse_resets_closeables: NoSqlTarget sets [table]
…ments

Updated tests to check source._closeables instead of downstream step's _closeables,
as the bug manifests in upstream steps. Added comments clarifying which tests detect
the ML-11518 regression (3 tests) vs baseline/edge case tests (2 tests).

Verified:
- 3 tests FAIL on commit 74fec1a (before fix) - correctly detecting bug
- All 5 tests PASS on commit 321dfec (with fix) and current branch
- Replace dynamic closeables tracking with direct assertions
- Add try/finally blocks to prevent test hangs on failure
- Remove PR-specific docstring notes that don't apply post-merge
- Move AggregateByKey test to test_aggregate_by_key.py
@gtopper gtopper merged commit d71bf78 into mlrun:development Dec 21, 2025
8 checks passed
alxtkr77 added a commit to alxtkr77/storey that referenced this pull request Dec 21, 2025
* Reset _closeables in _init for flow reuse

* Add unit tests for _closeables reset in _init for flow reuse

Tests verify that _closeables is properly reset when flows are reused:
- test_flow_reuse_resets_closeables: Base Flow class resets to []
- test_aggregate_by_key_reuse_resets_closeables: AggregateByKey sets [table]
- test_map_with_state_reuse_resets_closeables: MapWithState sets [state] for Table
- test_map_with_state_no_closeables_without_close_method: No closeables for dict state
- test_nosql_target_reuse_resets_closeables: NoSqlTarget sets [table]

* Fix unit tests to properly detect ML-11518 bug and add clarifying comments

Updated tests to check source._closeables instead of downstream step's _closeables,
as the bug manifests in upstream steps. Added comments clarifying which tests detect
the ML-11518 regression (3 tests) vs baseline/edge case tests (2 tests).

Verified:
- 3 tests FAIL on commit 74fec1a (before fix) - correctly detecting bug
- All 5 tests PASS on commit 321dfec (with fix) and current branch

* Simplify ML-11518 regression tests based on code review

- Replace dynamic closeables tracking with direct assertions
- Add try/finally blocks to prevent test hangs on failure
- Remove PR-specific docstring notes that don't apply post-merge
- Move AggregateByKey test to test_aggregate_by_key.py

---------

Co-authored-by: Alex Toker <alext@mckinsey.com>
gtopper pushed a commit that referenced this pull request Dec 21, 2025
* Reset _closeables in _init for flow reuse

* Add unit tests for _closeables reset in _init for flow reuse

Tests verify that _closeables is properly reset when flows are reused:
- test_flow_reuse_resets_closeables: Base Flow class resets to []
- test_aggregate_by_key_reuse_resets_closeables: AggregateByKey sets [table]
- test_map_with_state_reuse_resets_closeables: MapWithState sets [state] for Table
- test_map_with_state_no_closeables_without_close_method: No closeables for dict state
- test_nosql_target_reuse_resets_closeables: NoSqlTarget sets [table]

* Fix unit tests to properly detect ML-11518 bug and add clarifying comments

Updated tests to check source._closeables instead of downstream step's _closeables,
as the bug manifests in upstream steps. Added comments clarifying which tests detect
the ML-11518 regression (3 tests) vs baseline/edge case tests (2 tests).

Verified:
- 3 tests FAIL on commit 74fec1a (before fix) - correctly detecting bug
- All 5 tests PASS on commit 321dfec (with fix) and current branch

* Simplify ML-11518 regression tests based on code review

- Replace dynamic closeables tracking with direct assertions
- Add try/finally blocks to prevent test hangs on failure
- Remove PR-specific docstring notes that don't apply post-merge
- Move AggregateByKey test to test_aggregate_by_key.py

---------

Co-authored-by: Alex Toker <alext@mckinsey.com>
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