Commit a23d685
[Data] Refactor
# Description
This PR refactors the `PhysicalOperator` class to eliminate hidden side
effects in the `completed()` method. Previously, calling `completed()`
could inadvertently modify the internal state of the operator, which
could lead to unexpected behavior. This change separates the logic for
checking if the operator is marked as finished from the logic that
computes whether it is actually finished.
Key changes include:
- Renaming `_execution_finished` to `_is_execution_marked_finished` to
clarify its purpose.
- Renaming `execution_finished()` to `has_execution_finished()` and
making it a pure computed property without side effects.
- Updating the `completed()` method to call `has_execution_finished()`
instead of modifying internal state.
- Ensuring that `mark_execution_finished()` correctly sets the renamed
field.
## Related issues
Fixes ray-project#58884
## Additional information
This refactor ensures that both `has_execution_finished()` and
`completed()` are pure query methods, allowing them to be called
multiple times without altering the state of the operator. T
---------
Signed-off-by: Simeet Nayan <simeetnayan.8100@gmail.com>
Co-authored-by: Balaji Veeramani <balaji@anyscale.com>PhysicalOperator.completed to fix side effects (ray-project#58915)1 parent 23277f1 commit a23d685
File tree
7 files changed
+34
-31
lines changed- python/ray/data
- _internal/execution
- interfaces
- operators
- tests
7 files changed
+34
-31
lines changedLines changed: 23 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
| 404 | + | |
405 | 405 | | |
406 | | - | |
| 406 | + | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
412 | 429 | | |
413 | 430 | | |
414 | 431 | | |
415 | 432 | | |
416 | 433 | | |
417 | | - | |
| 434 | + | |
418 | 435 | | |
419 | 436 | | |
420 | 437 | | |
421 | 438 | | |
422 | | - | |
423 | 439 | | |
424 | 440 | | |
425 | | - | |
426 | 441 | | |
427 | 442 | | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | 443 | | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
444 | 447 | | |
445 | | - | |
| 448 | + | |
446 | 449 | | |
447 | 450 | | |
448 | 451 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
556 | | - | |
| 556 | + | |
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
| 677 | + | |
678 | 678 | | |
679 | | - | |
| 679 | + | |
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
| 655 | + | |
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
672 | 672 | | |
673 | 673 | | |
674 | 674 | | |
675 | | - | |
| 675 | + | |
676 | 676 | | |
677 | 677 | | |
678 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
| 1058 | + | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
| |||
1066 | 1066 | | |
1067 | 1067 | | |
1068 | 1068 | | |
1069 | | - | |
| 1069 | + | |
1070 | 1070 | | |
1071 | 1071 | | |
1072 | 1072 | | |
1073 | 1073 | | |
1074 | | - | |
| 1074 | + | |
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
0 commit comments