From ee83a3be5244770e37e874a291bd50e77380fec2 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 31 Jul 2023 15:38:46 +0200 Subject: [PATCH] Allow access to run_id from config --- slate/slate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slate/slate.py b/slate/slate.py index b5ef5ec..6f2d20a 100644 --- a/slate/slate.py +++ b/slate/slate.py @@ -46,6 +46,7 @@ class Slate(): self._version = False self.job_id = os.environ.get('SLURM_JOB_ID', False) self.task_id = None + self.run_id = -1 self._tmp_path = os.path.expandvars('$TMP') self.sweep_id = None @@ -109,7 +110,7 @@ class Slate(): rand = int(random.random()*99999999) if string == '{rand}': return rand - return string.format(delta_desc=delta_desc, **kwargs, rand=rand, tmp=self._tmp_path, job_id=(self.job_id or 'LOCAL'), task_id=(self.task_id or 0)) + return string.format(delta_desc=delta_desc, **kwargs, rand=rand, tmp=self._tmp_path, job_id=(self.job_id or 'LOCAL'), task_id=(self.task_id or 0), run_id=self.run_id) return string def apply_nested(self, d, f): @@ -294,6 +295,7 @@ class Slate(): Runner = self.runners[runnerName] for r in rep_ids: + self.run_id = r config = copy.deepcopy(orig_config) runnerConf = self._make_config_for_run(config, r) wandbC = self.consume(runnerConf, 'wandb', {}, expand=True, delta_desc=runnerConf.pop('delta_desc', 'BASE'))