Skip to content

Commit 6cf3fad

Browse files
committed
cleanup
1 parent b1a2c1f commit 6cf3fad

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

tidy3d/config/profiles.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
},
2222
"dev": {
2323
"web": {
24-
"api_endpoint": "https://tidy3d2-api.dev-simulation.cloud",
25-
"website_endpoint": "https://tidy3d2.dev-simulation.cloud",
24+
"api_endpoint": "https://tidy3d-api.dev-simulation.cloud",
25+
"website_endpoint": "https://tidy3d.dev-simulation.cloud",
2626
"s3_region": "us-east-1",
2727
}
2828
},

tidy3d/web/api/webapi.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -125,24 +125,22 @@ def _batch_detail_error(resource_id: str) -> Optional[WebError]:
125125
return
126126

127127
if hasattr(batch_detail, "validateErrors") and batch_detail.validateErrors:
128-
error_details = []
129-
for key, error_str in batch_detail.validateErrors.items():
130-
try:
131-
error_dict = json.loads(error_str)
132-
validation_error = error_dict.get("validation_error", "Unknown validation error.")
133-
msg = f"- Subtask '{key}' failed: {validation_error}"
134-
log.error(msg)
128+
try:
129+
error_details = []
130+
for key, error_str in batch_detail.validateErrors.items():
131+
msg = f"- Subtask '{key}' failed: {error_str}"
135132
error_details.append(msg)
136-
except (json.JSONDecodeError, TypeError):
137-
# Handle cases where the error string isn't valid JSON
138-
log.error(f"Could not parse validation error for subtask '{key}'.")
139-
error_details.append(f"- Subtask '{key}': Could not parse error details.")
140-
141-
details_string = "\n".join(error_details)
142-
full_error_msg = (
143-
"One or more subtasks failed validation. Please fix the component modeler configuration.\n"
144-
f"Details:\n{details_string}"
145-
)
133+
134+
details_string = "\n".join(error_details)
135+
full_error_msg = (
136+
"One or more subtasks failed validation. Please fix the component modeler "
137+
"configuration.\n"
138+
f"Details:\n{details_string}"
139+
)
140+
except Exception as e:
141+
raise WebError(
142+
"One or more subtasks failed validation. Failed to parse validation errors."
143+
) from e
146144
raise WebError(full_error_msg)
147145

148146
# Handle all other generic error states
@@ -864,7 +862,7 @@ def monitor_preprocess() -> None:
864862
if verbose:
865863
# verbose case, update progressbar
866864
console.log("running solver")
867-
if task_type == "FDTD":
865+
if "FDTD" in task_type:
868866
with Progress(console=console) as progress:
869867
pbar_pd = progress.add_task("% done", total=100)
870868
perc_done, _ = get_run_info(task_id)
@@ -1472,8 +1470,10 @@ def estimate_cost(
14721470
console = get_logging_console() if verbose else None
14731471

14741472
task = TaskFactory.get(task_id, verbose=False)
1473+
detail = task.detail()
14751474
if isinstance(task, BatchTask):
1476-
task.check(solver_version=solver_version)
1475+
check_task_type = "FDTD" if detail.taskType == "MODAL_CM" else "RF_FDTD"
1476+
task.check(solver_version=solver_version, check_task_type=check_task_type)
14771477
detail = task.detail()
14781478
status = detail.status.lower()
14791479
while status not in ALL_POST_VALIDATE_STATES:
@@ -1593,7 +1593,7 @@ def real_cost(task_id: str, verbose: bool = True) -> float | None:
15931593
else:
15941594
if verbose:
15951595
console.log(f"Billed flex credit cost: {flex_unit:1.3f}.")
1596-
if flex_unit != ori_flex_unit and task_info.taskType == "FDTD":
1596+
if flex_unit != ori_flex_unit and "FDTD" in task_info.taskType:
15971597
console.log(
15981598
"Note: the task cost pro-rated due to early shutoff was below the minimum "
15991599
"threshold, due to fast shutoff. Decreasing the simulation 'run_time' should "

tidy3d/web/core/task_core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,7 @@ def detail(self) -> BatchDetail:
873873

874874
def check(
875875
self,
876+
check_task_type: str,
876877
solver_version: Optional[str] = None,
877878
protocol_version: Optional[str] = None,
878879
) -> requests.Response:
@@ -897,6 +898,7 @@ def check(
897898
{
898899
"solverVersion": solver_version,
899900
"protocolVersion": protocol_version,
901+
"taskType": check_task_type,
900902
},
901903
)
902904

0 commit comments

Comments
 (0)