Skip to content

Commit

Permalink
robust Batch.monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed May 31, 2024
1 parent d7e8a3b commit 45d30a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- `ModeSolver.plot_field` correctly returning the plot axes.
- Avoid error if non-positive refractive index used for integration resolution in adjoint.
- Make `Batch.monitor` robust if the run status is not found.

## [2.7.0rc2] - 2024-05-14

Expand Down
10 changes: 4 additions & 6 deletions tidy3d/web/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,11 @@ def pbar_description(task_name: str, status: str) -> str:
for task_name, job in self.jobs.items():
status = job.status
description = pbar_description(task_name, status)
completed = run_statuses.index(status) if status in run_statuses else 0
pbar = progress.add_task(
description,
total=len(run_statuses) - 1,
completed=run_statuses.index(status),
completed=completed,
)
pbar_tasks[task_name] = pbar

Expand All @@ -717,13 +718,10 @@ def pbar_description(task_name: str, status: str) -> str:
status = job.status
description = pbar_description(task_name, status)

# if a problem occurred, update progressbar completion to 100%
if status not in run_statuses:
completed = run_statuses.index("success")
else:
if status in run_statuses:
completed = run_statuses.index(status)
progress.update(pbar, description=description, completed=completed)

progress.update(pbar, description=description, completed=completed)
time.sleep(BATCH_MONITOR_PROGRESS_REFRESH_TIME)

# set all to 100% completed (if error or diverge, will be red)
Expand Down

0 comments on commit 45d30a9

Please sign in to comment.