Skip to content

Commit

Permalink
The get_info API returns run_statuses and end_statuses.
Browse files Browse the repository at this point in the history
  • Loading branch information
wei committed Jul 30, 2024
1 parent b08633c commit 0de3a1f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tidy3d/web/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ def status(self):
"""Return current status of :class:`Job`."""
return self.get_info().status

@property
def run_statuses(self):
"""Return current runStatuses of :class:`Job`."""
return self.get_info().runStatuses

@property
def end_statuses(self):
"""Return current endStatuses of :class:`Job`."""
return self.get_info().endStatuses

def start(self) -> None:
"""Start running a :class:`Job`.
Expand Down Expand Up @@ -702,7 +712,18 @@ def pbar_description(task_name: str, status: str) -> str:
"visualize",
"success",
]
end_statuses = ("success", "error", "errored", "diverged", "diverge", "deleted", "draft")

end_statuses = (
"success",
"error",
"errored",
"diverged",
"diverge",
"deleted",
"draft",
"abort",
"aborted",
)

if self.verbose:
console = get_logging_console()
Expand All @@ -718,6 +739,12 @@ def pbar_description(task_name: str, status: str) -> str:
pbar_tasks = {}
for task_name, job in self.jobs.items():
status = job.status
remote_run_statuses = job.run_statuses
remote_end_statuses = job.end_statuses
if remote_run_statuses is not None:
run_statuses = remote_run_statuses
if remote_end_statuses is not None:
end_statuses = remote_end_statuses
description = pbar_description(task_name, status)
completed = run_statuses.index(status) if status in run_statuses else 0
pbar = progress.add_task(
Expand Down
5 changes: 5 additions & 0 deletions tidy3d/web/api/webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,13 @@ def monitor(task_id: TaskId, verbose: bool = True) -> None:

task_type = task_info.taskType

end_statuses = task_info.endStatuses

break_statuses = ("success", "error", "diverged", "deleted", "draft", "abort", "aborted")

if end_statuses is not None:
break_statuses = end_statuses

def get_estimated_cost() -> float:
"""Get estimated cost, if None, is not ready."""
task_info = get_info(task_id)
Expand Down
2 changes: 2 additions & 0 deletions tidy3d/web/core/task_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class TaskInfo(TaskBase):
taskType: str = None
metadataStatus: str = None
taskBlockInfo: TaskBlockInfo = None
endStatuses: Optional[tuple] = None
runStatuses: Optional[tuple] = None


class RunInfo(TaskBase):
Expand Down

0 comments on commit 0de3a1f

Please sign in to comment.