Allow manual verification before job submission

This commit is contained in:
Dominik Moritz Roth 2023-09-02 20:54:53 +02:00
parent 695046a123
commit bc698fec54

View File

@ -49,6 +49,7 @@ class Slate():
self.run_id = -1
self._tmp_path = os.path.expandvars('$TMP')
self.sweep_id = None
self.verify = False
def load_config(self, filename, name):
config, stack = self._load_config(filename, name)
@ -232,6 +233,8 @@ class Slate():
num_parallel_jobs = min(self.consume(slurmC, 'num_parallel_jobs', num_jobs), num_jobs)
array = f'0-{last_job_idx}%{num_parallel_jobs}'
job = pyslurm.JobSubmitDescription(name=s_name, script=script, array=array, **slurmC)
if self.verify:
input(f'<Press enter to submit {num_jobs} to slurm>')
job_id = job.submit()
print(f'[>] Job submitted to slurm with id {job_id}')
with open('job_hist.log', 'a') as f:
@ -393,6 +396,7 @@ class Slate():
parser.add_argument("-w", "--worker", action="store_true")
parser.add_argument("-t", "--task_id", default=None, type=int)
parser.add_argument("--sweep_id", default=None, type=str)
parser.add_argument("--ask_verify", action="store_true")
args = parser.parse_args()
@ -405,6 +409,8 @@ class Slate():
assert args.config_file != None, 'Need to supply config file.'
if args.slurm:
if args.ask_verify:
self.verify = True
self.run_slurm(args.config_file, args.experiment)
else:
self.run_local(args.config_file, args.experiment, args.task_id, args.sweep_id)