@@ -44,9 +44,9 @@ def main():
4444 commands = smartdispatch .replace_uid_tag (commands )
4545 nb_commands = len (commands ) # For print at the end
4646
47- path_job_logs , path_job_commands = create_job_folders (jobname )
47+ path_job , path_job_logs , path_job_commands = create_job_folders (jobname )
4848 elif args .mode == "resume" :
49- path_job_logs , path_job_commands = get_job_folders (args .batch_uid )
49+ path_job , path_job_logs , path_job_commands = get_job_folders (args .batch_uid )
5050 else :
5151 raise ValueError ("Unknown subcommand!" )
5252
@@ -85,18 +85,18 @@ def main():
8585 pbs_filenames = job_generator .write_pbs_files (path_job_commands )
8686
8787 # Launch the jobs
88- print "{nb_commands} command(s) will be executed in {nb_jobs} job(s). " .format (nb_commands = nb_commands , nb_jobs = len (pbs_filenames ))
88+ print "## {nb_commands} command(s) will be executed in {nb_jobs} job(s) ## " .format (nb_commands = nb_commands , nb_jobs = len (pbs_filenames ))
8989 print "Batch UID: {batch_uid}" .format (batch_uid = jobname )
9090 if not args .doNotLaunch :
91- job_ids = []
91+ jobs_id = []
9292 for pbs_filename in pbs_filenames :
9393 qsub_output = check_output ('{launcher} {pbs_filename}' .format (launcher = LAUNCHER if args .launcher is None else args .launcher , pbs_filename = pbs_filename ), shell = True )
94- job_ids += [qsub_output .rstrip ()]
94+ jobs_id += [qsub_output .rstrip ()]
9595
96- with utils .open_with_lock (os .path .join (path_job_commands , "job_ids.txt" ), 'a' ) as job_ids_file :
97- job_ids_file .writelines (job_ids )
98- print "\n Job id's : {job_ids }" .format (job_ids = " " .join (job_ids ))
99- print "\n Logs, command, and job id's related to this batch will be in: {smartdispatch_folder}/{{Batch UID}}" .format (smartdispatch_folder = LOGS_FOLDERNAME )
96+ with utils .open_with_lock (os .path .join (path_job , "job_ids.txt" ), 'a' ) as jobs_id_file :
97+ jobs_id_file .writelines (" \n " . join ( jobs_id ) )
98+ print "\n Jobs id: {jobs_id }" .format (jobs_id = " " .join (jobs_id ))
99+ print "\n Logs, command, and jobs id related to this batch will be in: {smartdispatch_folder}/{{Batch UID}}" .format (smartdispatch_folder = path_job )
100100
101101
102102def parse_arguments ():
@@ -146,32 +146,32 @@ def _gen_job_paths(jobname):
146146 path_job_logs = os .path .join (path_job , 'logs' )
147147 path_job_commands = os .path .join (path_job , 'commands' )
148148
149- return path_job_logs , path_job_commands
149+ return path_job , path_job_logs , path_job_commands
150150
151151
152152def get_job_folders (jobname ):
153- path_job_logs , path_job_commands = _gen_job_paths (jobname )
153+ path_job , path_job_logs , path_job_commands = _gen_job_paths (jobname )
154154
155155 if not os .path .exists (path_job_commands ):
156156 raise LookupError ("Batch UID ({0}) does not exist! Cannot resume." .format (jobname ))
157157
158158 if not os .path .exists (path_job_logs ):
159159 os .makedirs (path_job_logs )
160160
161- return path_job_logs , path_job_commands
161+ return path_job , path_job_logs , path_job_commands
162162
163163
164164def create_job_folders (jobname ):
165165 """Creates the folders where the logs, commands and QSUB files will be saved."""
166- path_job_logs , path_job_commands = _gen_job_paths (jobname )
166+ path_job , path_job_logs , path_job_commands = _gen_job_paths (jobname )
167167
168168 if not os .path .exists (path_job_commands ):
169169 os .makedirs (path_job_commands )
170170
171171 if not os .path .exists (path_job_logs ):
172172 os .makedirs (path_job_logs )
173173
174- return path_job_logs , path_job_commands
174+ return path_job , path_job_logs , path_job_commands
175175
176176
177177if __name__ == "__main__" :
0 commit comments