Skip to content

Commit

Permalink
Merge pull request #107 from ikrommyd/progress-with-client
Browse files Browse the repository at this point in the history
feat: show progress bar with distributed client without using client.compute
  • Loading branch information
ikrommyd authored Oct 7, 2024
2 parents b152500 + 3937b0a commit 6512391
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 6512391

Please sign in to comment.