Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# lazy import to ensurue plugin discovery remains fast
import submitit
num_jobs = len(job_overrides)
assert num_jobs > 0
with open_dict(self.config):
self.config.hydra.job.num_jobs = num_jobs
if self.queue == "auto":
executor = submitit.AutoExecutor(
folder=self.folder, conda_file=self.conda_file
)
elif self.queue == "slurm":
executor = submitit.SlurmExecutor(folder=self.folder)
elif self.queue == "chronos":
executor = submitit.ChronosExecutor(
folder=self.folder, conda_file=self.conda_file
)
elif self.queue == "local":
executor = submitit.LocalExecutor(folder=self.folder)
else:
raise RuntimeError("Unsupported queue type {}".format(self.queue))
executor.update_parameters(**self.queue_parameters[self.queue])
log.info("Sweep output dir : {}".format(self.config.hydra.sweep.dir))
path_str = str(self.config.hydra.sweep.dir)
os.makedirs(path_str, exist_ok=True)
if "mode" in self.config.hydra.sweep:
mode = int(str(self.config.hydra.sweep.mode), 8)
os.chmod(path_str, mode=mode)