Skip to content

Commit 6df0afe

Browse files
leave as is
1 parent 13eced6 commit 6df0afe

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

tidy3d/plugins/smatrix/run.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def create_batch(
1919
modeler: ComponentModelerType,
2020
path_dir: str = DEFAULT_DATA_DIR,
2121
parent_batch_id: str = None,
22+
group_id: str = None,
2223
file_name: str = "batch.hdf5",
2324
**kwargs,
2425
) -> Batch:
@@ -42,7 +43,14 @@ def create_batch(
4243
else:
4344
parent_task_dict = None
4445

45-
batch = Batch(simulations=modeler.sim_dict, parent_tasks=parent_task_dict, **kwargs)
46+
if group_id is not None:
47+
group_id_dict = dict()
48+
for key in modeler.sim_dict.keys():
49+
group_id_dict[key] = tuple(group_id,)
50+
else:
51+
group_id_dict = None
52+
53+
batch = Batch(simulations=modeler.sim_dict, parent_tasks=parent_task_dict, group_ids=group_id_dict, **kwargs)
4654
batch.to_file(filepath)
4755
return batch
4856

tidy3d/plugins/smatrix/web/api/container.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ class Job(WebContainer):
200200
description="Specify the payment method.",
201201
)
202202

203+
group_id: Optional[TaskId] = pd.Field(
204+
None, title="Parent Tasks", description="Tuple of parent task ids, used internally only."
205+
)
206+
203207
_upload_fields = (
204208
"simulation",
205209
"task_name",
@@ -580,6 +584,12 @@ class Batch(WebContainer):
580584
"fields that were not used to create the task will cause errors.",
581585
)
582586

587+
group_ids: dict[str, tuple[TaskId, ...]] = pd.Field(
588+
None,
589+
title="Parent Tasks",
590+
description="Collection of parent task ids for each job in batch, used internally only.",
591+
)
592+
583593
_job_type = Job
584594

585595
def run(self, path_dir: str = DEFAULT_DATA_DIR) -> BatchData:

tidy3d/plugins/smatrix/web/api/webapi.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -529,20 +529,6 @@ def upload_modeler(
529529

530530
# log the url for the task in the web UI
531531
log.debug(f"{Env.current.website_endpoint}/folders/{task.folder_id}/tasks/{task.group_id}")
532-
return task.batch_id
533-
else:
534-
task.upload_simulation(
535-
stub=stub,
536-
verbose=verbose,
537-
progress_callback=progress_callback,
538-
remote_sim_file=remote_sim_file,
539-
)
540-
estimate_cost(task_id=task.task_id, solver_version=solver_version, verbose=verbose)
541-
542-
task.validate_post_upload(parent_tasks=parent_tasks)
543-
544-
# log the url for the task in the web UI
545-
log.debug(f"{Env.current.website_endpoint}/folders/{task.folder_id}/tasks/{task.task_id}")
546532
return task
547533

548534
def get_reduced_simulation(simulation, reduce_simulation):

0 commit comments

Comments
 (0)