1919from tidy3d .config import config
2020from tidy3d .exceptions import WebError
2121from tidy3d .log import get_logging_console , log
22- from tidy3d .plugins .smatrix .component_modelers .terminal import TerminalComponentModeler
2322from tidy3d .web .api .states import (
2423 ALL_POST_VALIDATE_STATES ,
2524 END_STATES ,
5958SIM_FILE_JSON = "simulation.json"
6059
6160# not all solvers are supported yet in GUI
62- GUI_SUPPORTED_TASK_TYPES = ["FDTD" , "MODE_SOLVER" , "HEAT" , "RF " ]
61+ GUI_SUPPORTED_TASK_TYPES = ["FDTD" , "MODE_SOLVER" , "HEAT" , "TERMINAL_CM " ]
6362
6463# if a solver is in beta stage, cost is subject to change
6564BETA_TASK_TYPES = ["HEAT" , "EME" , "HEAT_CHARGE" , "VOLUME_MESH" ]
@@ -228,7 +227,7 @@ def restore_simulation_if_cached(
228227 cached_workflow_type = entry .metadata .get ("workflow_type" )
229228 if cached_task_id is not None and cached_workflow_type is not None and verbose :
230229 console = get_logging_console ()
231- url , _ = _get_task_urls (cached_workflow_type , simulation , cached_task_id )
230+ url , _ = _get_task_urls (cached_workflow_type , cached_task_id )
232231 console .log (
233232 f"Loading simulation from local cache. View cached task using web UI at [link={ url } ]'{ url } '[/link]."
234233 )
@@ -429,15 +428,12 @@ def run(
429428
430429def _get_task_urls (
431430 task_type : str ,
432- simulation : WorkflowType ,
433431 resource_id : str ,
434432 folder_id : Optional [str ] = None ,
435433 group_id : Optional [str ] = None ,
436434) -> tuple [str , Optional [str ]]:
437435 """Log task and folder links to the web UI."""
438- if (task_type in ["RF" , "COMPONENT_MODELER" , "TERMINAL_COMPONENT_MODELER" ]) and isinstance (
439- simulation , TerminalComponentModeler
440- ):
436+ if task_type in ["RF" , "TERMINAL_CM" , "MODAL_CM" ]:
441437 url = _get_url_rf (group_id or resource_id )
442438 else :
443439 url = _get_url (resource_id )
@@ -523,9 +519,6 @@ def upload(
523519 task_name = stub .get_default_task_name ()
524520
525521 task_type = stub .get_type ()
526- # Component modeler compatibility: map to RF task type
527- if task_type in ("COMPONENT_MODELER" , "TERMINAL_COMPONENT_MODELER" ):
528- task_type = "RF"
529522
530523 task = WebTask .create (
531524 task_type ,
@@ -537,23 +530,8 @@ def upload(
537530 "Gz" ,
538531 )
539532
540- if task_type == "RF" :
541- # Prefer the group id if present in the creation response; avoid extra GET.
542- group_id = getattr (task , "groupId" , None ) or getattr (task , "group_id" , None )
543- if not group_id :
544- try :
545- detail_task = SimulationTask .get (task .task_id , verbose = False )
546- group_id = getattr (detail_task , "groupId" , None ) or getattr (
547- detail_task , "group_id" , None
548- )
549- except Exception :
550- group_id = None
551- # Prefer returning batch/group id for downstream batch endpoints
552- task_id = getattr (task , "batchId" , None ) or getattr (task , "batch_id" , None )
553- resource_id = task_id or task .task_id
554- else :
555- group_id = None
556- resource_id = task .task_id
533+ group_id = getattr (task , "groupId" , None )
534+ resource_id = task .task_id
557535
558536 if verbose :
559537 console .log (
@@ -566,16 +544,14 @@ def upload(
566544 f"Cost of { solver_name } simulations is subject to change in the future."
567545 )
568546 if task_type in GUI_SUPPORTED_TASK_TYPES :
569- url , folder_url = _get_task_urls (
570- task_type , simulation , resource_id , task .folder_id , group_id
571- )
547+ url , folder_url = _get_task_urls (task_type , resource_id , task .folder_id , group_id )
572548 console .log (f"View task using web UI at [link={ url } ]'{ url } '[/link]." )
573549 console .log (f"Task folder: [link={ folder_url } ]'{ task .folder_name } '[/link]." )
574550
575551 remote_sim_file = SIM_FILE_HDF5_GZ
576552 if task_type == "MODE_SOLVER" :
577553 remote_sim_file = MODE_FILE_HDF5_GZ
578- elif task_type == "RF" :
554+ elif task_type in [ "RF" , "TERMINAL_CM" , "MODAL_CM" ] :
579555 remote_sim_file = MODELER_FILE_HDF5_GZ
580556
581557 task .upload_simulation (
@@ -981,9 +957,6 @@ def abort(task_id: TaskId) -> Optional[TaskInfo]:
981957 console .log (
982958 f"Task is aborting. View task using web UI at [link={ url } ]'{ url } '[/link] to check the result."
983959 )
984- if isinstance (task , BatchTask ):
985- detail = task .detail ()
986- return TaskInfo (** {"taskId" : task_id , "taskType" : "RF" , ** detail .dict ()})
987960 return TaskInfo (
988961 ** {"taskId" : task_id , "taskType" : getattr (task , "task_type" , None ), ** task .dict ()}
989962 )
0 commit comments