Skip to content

Conversation

@alxtkr77
Copy link
Member

Backport of #597

* 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 <[email protected]>
@gtopper gtopper merged commit 78b3ba1 into mlrun:1.10.x Dec 21, 2025
8 checks passed
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