Skip to content
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

feat: show progress bar with distributed client without using client.compute #107

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/run_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dask
from dask.diagnostics import ProgressBar
from dask.distributed import Client, LocalCluster, performance_report
from dask.distributed import Client, LocalCluster, performance_report, progress

from egamma_tnp.config import binning_manager
from egamma_tnp.utils import runner_utils
Expand Down Expand Up @@ -198,7 +198,9 @@ def main():
if client:
with performance_report(filename="/tmp/dask-report.html"):
logger.info("The performance report will be saved in /tmp/dask-report.html")
(out,) = dask.compute(to_compute, scheduler="distributed")
(futures,) = dask.persist(to_compute)
progress(futures)
(out,) = dask.compute(futures)
else:
with ProgressBar():
(out,) = dask.compute(to_compute, scheduler=scheduler)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def assert_arrays_equal(a1, a2):

def test_cli():
subprocess.run(
"run_analysis --config tests/example_runner.json --settings tests/example_settings.json --fileset tests/example_fileset.json --binning tests/example_binning.json --output tests/output --executor threads",
"run_analysis --config tests/example_runner.json --settings tests/example_settings.json --fileset tests/example_fileset.json --binning tests/example_binning.json --output tests/output --executor distributed --cores 1 --dashboard_address 8786",
shell=True,
check=True,
)
Expand Down
Loading