Skip to content

Commit 4bed382

Browse files
committed
Containers also working
1 parent 1b38b17 commit 4bed382

File tree

4 files changed

+12
-43
lines changed

4 files changed

+12
-43
lines changed

docs/notebooks

Submodule notebooks updated 54 files

tidy3d/web/api/container.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,7 @@ def status(self) -> str:
389389
"""Return current status of :class:`Job`."""
390390
if self.load_if_cached:
391391
return "success"
392-
if web._is_modeler_batch(self.task_id):
393-
detail = self.get_info()
394-
status = detail.totalStatus.value
395-
return status
396-
else:
397-
return self.get_info().status
392+
return self.get_info().status
398393

399394
def start(self, priority: Optional[int] = None) -> None:
400395
"""Start running a :class:`Job`.
@@ -1009,7 +1004,6 @@ def monitor(
10091004
"""
10101005
Monitor progress of each running task.
10111006
1012-
- For Component Modeler jobs, automatically triggers postprocessing once run finishes.
10131007
- Optionally downloads results as soon as a job reaches final success.
10141008
- Rich progress bars in verbose mode; quiet polling otherwise.
10151009
@@ -1035,16 +1029,8 @@ def monitor(
10351029
self._check_path_dir(path_dir=path_dir)
10361030
download_executor = ThreadPoolExecutor(max_workers=self.num_workers)
10371031

1038-
def _should_download(job: Job) -> bool:
1039-
status = job.status
1040-
if not web._is_modeler_batch(job.task_id):
1041-
return status == "success"
1042-
if status == "success":
1043-
return True
1044-
return status == "run_success" and getattr(job, "postprocess_status", None) == "success"
1045-
10461032
def schedule_download(job: Job) -> None:
1047-
if download_executor is None or not _should_download(job):
1033+
if download_executor is None or job.status not in COMPLETED_STATES:
10481034
return
10491035
task_id = job.task_id
10501036
if task_id in downloads_started:
@@ -1068,12 +1054,7 @@ def schedule_download(job: Job) -> None:
10681054
def check_continue_condition(job: Job) -> bool:
10691055
if job.load_if_cached:
10701056
return False
1071-
status = job.status
1072-
if not web._is_modeler_batch(job.task_id):
1073-
return status not in END_STATES
1074-
if status == "run_success":
1075-
return job.postprocess_status not in END_STATES
1076-
return status not in END_STATES
1057+
return job.status not in END_STATES
10771058

10781059
def pbar_description(
10791060
task_name: str, status: str, max_name_length: int, status_width: int
@@ -1097,9 +1078,6 @@ def pbar_description(
10971078
max_task_name = max(len(task_name) for task_name in self.jobs.keys())
10981079
max_name_length = min(30, max(max_task_name, 15))
10991080

1100-
# track which modeler jobs we've already kicked into postprocess
1101-
postprocess_started_tasks: set[str] = set()
1102-
11031081
try:
11041082
console = None
11051083
progress_columns = []
@@ -1135,17 +1113,6 @@ def pbar_description(
11351113
for task_name, job in self.jobs.items():
11361114
status = job.status
11371115

1138-
# auto-start postprocess for modeler jobs when run finishes
1139-
if (
1140-
web._is_modeler_batch(job.task_id)
1141-
and status == "run_success"
1142-
and job.task_id not in postprocess_started_tasks
1143-
):
1144-
job.postprocess_start(
1145-
worker_group=postprocess_worker_group, verbose=True
1146-
)
1147-
postprocess_started_tasks.add(job.task_id)
1148-
11491116
schedule_download(job)
11501117

11511118
if self.verbose:

tidy3d/web/api/states.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
}
66

77
ERROR_STATES = {
8-
"validate_fail",
8+
"validate_error",
99
"error",
1010
"errored",
1111
"diverge",
1212
"diverged",
1313
"blocked",
14-
"run_failed",
14+
"run_error",
1515
"aborted",
1616
"deleted",
17+
"postprocess_error",
1718
}
1819

1920
PRE_VALIDATE_STATES = {
@@ -30,7 +31,7 @@
3031
"run_success",
3132
}
3233

33-
COMPLETED_STATES = {"visualize", "success", "completed", "processed"}
34+
COMPLETED_STATES = {"visualize", "success", "completed", "processed", "postprocess_success"}
3435

3536
END_STATES = ERROR_STATES | COMPLETED_STATES
3637

tidy3d/web/api/webapi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def _batch_detail_error(resource_id: str) -> Optional[WebError]:
123123
return None
124124

125125
if (
126-
status == "validate_fail"
126+
status in ERROR_STATES
127127
and hasattr(batch_detail, "validateErrors")
128128
and batch_detail.validateErrors
129129
):
@@ -1511,8 +1511,9 @@ def estimate_cost(
15111511

15121512
if _is_modeler_batch(task_id):
15131513
batch = BatchTask(task_id)
1514-
resp = batch.check(solver_version=solver_version)
1515-
status = resp["validateStatus"]
1514+
_ = batch.check(solver_version=solver_version)
1515+
detail = batch.detail()
1516+
status = detail.status.lower()
15161517
while status not in ALL_POST_VALIDATE_STATES:
15171518
time.sleep(REFRESH_TIME)
15181519
detail = batch.detail()

0 commit comments

Comments
 (0)