exp: support switching to live workspace exp name

This commit is contained in:
Peter Rowlands
2023-05-23 15:43:50 +09:00
committed by Peter Rowlands (변기호)
parent 629223cbc2
commit aa19e24670
2 changed files with 9 additions and 20 deletions
+4
View File
@@ -29,6 +29,10 @@ def switch_repo(
orig_exc = exc
exps = repo.experiments
if rev == exps.workspace_queue.get_running_exp():
yield repo, "workspace"
return
for queue in (exps.tempdir_queue, exps.celery_queue):
try:
active_repo = queue.active_repo(rev)
+5 -20
View File
@@ -187,33 +187,18 @@ class WorkspaceQueue(BaseStashQueue):
):
raise NotImplementedError
def get_running_exps(
self,
fetch_refs: bool = True, # noqa: ARG002
) -> Dict[str, Dict]:
def get_running_exp(self) -> Optional[str]:
"""Return the name of the exp running in workspace (if it exists)."""
assert self._EXEC_NAME
result: Dict[str, Dict] = {}
if self._active_pid is None:
return result
return None
infofile = self.get_infofile_path(self._EXEC_NAME)
try:
info = ExecutorInfo.from_dict(load_json(infofile))
except OSError:
return result
if info.status < TaskStatus.FAILED:
# If we are appending to a checkpoint branch in a workspace
# run, show the latest checkpoint as running.
if info.status == TaskStatus.SUCCESS:
return result
last_rev = self.scm.get_ref(EXEC_BRANCH)
if last_rev:
result[last_rev] = info.asdict()
else:
result[self._EXEC_NAME] = info.asdict()
return result
return None
return info.name
def collect_active_data(
self,