-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG] clean up ray scheduler threads after computing partial results (#…
…1597) * adds `stop_plan` method on the Ray Scheduler when is called when the `RayRunner.run_iter` goes out of scope. * This fixes the issues where we have a hanging thread at the end of execution * closes: #1591
- Loading branch information
Showing
2 changed files
with
96 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
import daft | ||
from daft.context import get_context | ||
|
||
|
||
@pytest.mark.skipif(get_context().runner_config.name != "ray", reason="Needs to run on Ray runner") | ||
def test_active_plan_clean_up_df_show(): | ||
path = "tests/assets/parquet-data/mvp.parquet" | ||
df = daft.read_parquet([path, path]) | ||
df.show() | ||
runner = get_context().runner() | ||
assert len(runner.active_plans()) == 0 | ||
|
||
|
||
@pytest.mark.skipif(get_context().runner_config.name != "ray", reason="Needs to run on Ray runner") | ||
def test_active_plan_single_iter_partitions(): | ||
path = "tests/assets/parquet-data/mvp.parquet" | ||
df = daft.read_parquet([path, path]) | ||
iter = df.iter_partitions() | ||
next(iter) | ||
runner = get_context().runner() | ||
assert len(runner.active_plans()) == 1 | ||
del iter | ||
assert len(runner.active_plans()) == 0 | ||
|
||
|
||
@pytest.mark.skipif(get_context().runner_config.name != "ray", reason="Needs to run on Ray runner") | ||
def test_active_plan_multiple_iter_partitions(): | ||
path = "tests/assets/parquet-data/mvp.parquet" | ||
df = daft.read_parquet([path, path]) | ||
iter = df.iter_partitions() | ||
next(iter) | ||
runner = get_context().runner() | ||
assert len(runner.active_plans()) == 1 | ||
|
||
df2 = daft.read_parquet([path, path]) | ||
iter2 = df2.iter_partitions() | ||
next(iter2) | ||
assert len(runner.active_plans()) == 2 | ||
|
||
del iter | ||
assert len(runner.active_plans()) == 1 | ||
|
||
del iter2 | ||
assert len(runner.active_plans()) == 0 |