Allow manual verification before job submission
This commit is contained in:
		
							parent
							
								
									695046a123
								
							
						
					
					
						commit
						bc698fec54
					
				| @ -49,6 +49,7 @@ class Slate(): | |||||||
|         self.run_id = -1 |         self.run_id = -1 | ||||||
|         self._tmp_path = os.path.expandvars('$TMP') |         self._tmp_path = os.path.expandvars('$TMP') | ||||||
|         self.sweep_id = None |         self.sweep_id = None | ||||||
|  |         self.verify = False | ||||||
| 
 | 
 | ||||||
|     def load_config(self, filename, name): |     def load_config(self, filename, name): | ||||||
|         config, stack = self._load_config(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) |         num_parallel_jobs = min(self.consume(slurmC, 'num_parallel_jobs', num_jobs), num_jobs) | ||||||
|         array = f'0-{last_job_idx}%{num_parallel_jobs}' |         array = f'0-{last_job_idx}%{num_parallel_jobs}' | ||||||
|         job = pyslurm.JobSubmitDescription(name=s_name, script=script, array=array, **slurmC) |         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() |         job_id = job.submit() | ||||||
|         print(f'[>] Job submitted to slurm with id {job_id}') |         print(f'[>] Job submitted to slurm with id {job_id}') | ||||||
|         with open('job_hist.log', 'a') as f: |         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("-w", "--worker", action="store_true") | ||||||
|         parser.add_argument("-t", "--task_id", default=None, type=int) |         parser.add_argument("-t", "--task_id", default=None, type=int) | ||||||
|         parser.add_argument("--sweep_id", default=None, type=str) |         parser.add_argument("--sweep_id", default=None, type=str) | ||||||
|  |         parser.add_argument("--ask_verify", action="store_true") | ||||||
| 
 | 
 | ||||||
|         args = parser.parse_args() |         args = parser.parse_args() | ||||||
| 
 | 
 | ||||||
| @ -405,6 +409,8 @@ class Slate(): | |||||||
|         assert args.config_file != None, 'Need to supply config file.' |         assert args.config_file != None, 'Need to supply config file.' | ||||||
| 
 | 
 | ||||||
|         if args.slurm: |         if args.slurm: | ||||||
|  |             if args.ask_verify: | ||||||
|  |                 self.verify = True | ||||||
|             self.run_slurm(args.config_file, args.experiment) |             self.run_slurm(args.config_file, args.experiment) | ||||||
|         else: |         else: | ||||||
|             self.run_local(args.config_file, args.experiment, args.task_id, args.sweep_id) |             self.run_local(args.config_file, args.experiment, args.task_id, args.sweep_id) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user