Skip to content

Commit

Permalink
different way to handle task_id
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex authored and momchil-flex committed Jun 11, 2024
1 parent 9882e81 commit 17168b1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tidy3d/web/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ def task_id(self) -> TaskId:
"""The task ID for this ``Job``. Uploads the ``Job`` if it hasn't already been uploaded."""
if self.task_id_cached:
return self.task_id_cached
return self.upload()
return self._upload()

def upload(self) -> TaskId:
def _upload(self) -> TaskId:
"""Upload this job and return the task ID for handling."""
# upload kwargs with all fields except task_id
self_dict = self.dict()
upload_kwargs = {key: self_dict.get(key) for key in self._upload_fields}
# set the cached task_id
self.Config.frozen = False
self.Config.allow_mutation = True
self.task_id_cached = web.upload(**upload_kwargs)
self.Config.allow_mutation = False
self.Config.frozen = True
return self.task_id
task_id = web.upload(**upload_kwargs)
return task_id

def upload(self) -> None:
"""Upload this ``Job``."""
_ = self.task_id

def get_info(self) -> TaskInfo:
"""Return information about a :class:`Job`.
Expand Down

0 comments on commit 17168b1

Please sign in to comment.