Skip to content

Commit 1bfbdf0

Browse files
patch: catch errors where flex_unit is None
1 parent bfae45a commit 1bfbdf0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tidy3d/web/api/webapi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,10 +1464,10 @@ def real_cost(task_id: str, verbose=True) -> float | None:
14641464
if _is_modeler_batch(task_id):
14651465
status = _batch_detail(task_id).totalStatus.value
14661466
flex_unit = _batch_detail(task_id).realFlexUnit or None
1467-
if status not in ["success", "run_success"]:
1467+
if (status not in ["success", "run_success"]) or (flex_unit is None):
14681468
log.warning(
14691469
f"Billed FlexCredit for task '{task_id}' is not available. If the task has been "
1470-
"successfully run, it should be available shortly."
1470+
"successfully run, it should be available shortly. If this issue persists, contact customer support."
14711471
)
14721472
else:
14731473
if verbose:
@@ -1476,6 +1476,7 @@ def real_cost(task_id: str, verbose=True) -> float | None:
14761476
"task execution details. Use 'web.real_cost(task_id)' to get the billed FlexCredit "
14771477
"cost after a simulation run."
14781478
)
1479+
14791480
return flex_unit
14801481
else:
14811482
task_info = get_info(task_id)

0 commit comments

Comments
 (0)