| @@ 137-197 (lines=61) @@ | ||
| 134 | parser.error(msg) |
|
| 135 | ||
| 136 | ||
| 137 | def _set_options(args): |
|
| 138 | """ Set run specific information in options dictionary. |
|
| 139 | ||
| 140 | :params dict opt: input optional arguments (or defaults) |
|
| 141 | :params args: input required arguments |
|
| 142 | :returns options: optional and required arguments |
|
| 143 | :rtype: dict |
|
| 144 | """ |
|
| 145 | options = {} |
|
| 146 | options['data_file'] = args.in_file |
|
| 147 | options['process_file'] = args.process_list |
|
| 148 | options['mode'] = args.mode |
|
| 149 | options['template'] = args.template |
|
| 150 | options['transport'] = 'basic' if args.mode == 'basic' else args.transport |
|
| 151 | options['process_names'] = args.names |
|
| 152 | options['verbose'] = args.verbose |
|
| 153 | options['quiet'] = args.quiet |
|
| 154 | options['cluster'] = args.cluster |
|
| 155 | options['syslog_server'] = args.syslog |
|
| 156 | options['syslog_port'] = args.syslog_port |
|
| 157 | options['test_state'] = args.test_state |
|
| 158 | options['lustre'] = args.lustre |
|
| 159 | options['bllog'] = args.bllog |
|
| 160 | options['email'] = args.email |
|
| 161 | options['femail'] = args.femail |
|
| 162 | options['system_params'] = args.system_params |
|
| 163 | options['stats'] = args.stats |
|
| 164 | options['pre_run'] = args.pre_run |
|
| 165 | ||
| 166 | if args.folder: |
|
| 167 | out_folder_name = os.path.basename(args.folder) |
|
| 168 | else: |
|
| 169 | out_folder_name = __create_folder_name(options['data_file']) |
|
| 170 | ||
| 171 | out_folder_path = __create_output_folder(args.out_folder, out_folder_name) |
|
| 172 | ||
| 173 | options['out_folder'] = out_folder_name |
|
| 174 | options['out_path'] = out_folder_path |
|
| 175 | ||
| 176 | basename = os.path.basename(args.in_file) |
|
| 177 | options['datafile_name'] = os.path.splitext(basename)[0] if basename \ |
|
| 178 | else args.in_file.split(os.sep)[-2] |
|
| 179 | ||
| 180 | inter_folder_path = __create_output_folder(args.tmp, out_folder_name)\ |
|
| 181 | if args.tmp else out_folder_path |
|
| 182 | ||
| 183 | options['inter_path'] = inter_folder_path |
|
| 184 | options['log_path'] = args.log if args.log else options['inter_path'] |
|
| 185 | options['nProcesses'] = len(options["process_names"].split(',')) |
|
| 186 | # DosNa related options |
|
| 187 | options["dosna_backend"] = args.dosna_backend |
|
| 188 | options["dosna_engine"] = args.dosna_engine |
|
| 189 | options["dosna_connection"] = args.dosna_connection |
|
| 190 | options["dosna_connection_options"] = args.dosna_connection_options |
|
| 191 | options['checkpoint'] = args.checkpoint |
|
| 192 | ||
| 193 | command_str = " ".join([str(i) for i in sys.argv[1:]]) |
|
| 194 | command_full = f"savu {command_str}" |
|
| 195 | options["command"] = command_full |
|
| 196 | ||
| 197 | return options |
|
| 198 | ||
| 199 | ||
| 200 | def __create_folder_name(dpath): |
|
| @@ 110-167 (lines=58) @@ | ||
| 107 | else: |
|
| 108 | return parser |
|
| 109 | ||
| 110 | def _set_options(args): |
|
| 111 | """ Set run specific information in options dictionary. |
|
| 112 | ||
| 113 | :params dict opt: input optional arguments (or defaults) |
|
| 114 | :params args: input required arguments |
|
| 115 | :returns options: optional and required arguments |
|
| 116 | :rtype: dict |
|
| 117 | """ |
|
| 118 | options = {} |
|
| 119 | options['data_file'] = args.in_file |
|
| 120 | options['process_file'] = 'savu/data/stats/pre_run.nxs' |
|
| 121 | options["process_file_name"] = options["process_file"].split("/")[-1] |
|
| 122 | options["post_pre_run"] = False |
|
| 123 | options['mode'] = 'full' |
|
| 124 | options['template'] = args.template |
|
| 125 | options['transport'] = args.transport |
|
| 126 | options['process_names'] = args.names |
|
| 127 | options['verbose'] = args.verbose |
|
| 128 | options['quiet'] = args.quiet |
|
| 129 | options['cluster'] = args.cluster |
|
| 130 | options['syslog_server'] = args.syslog |
|
| 131 | options['syslog_port'] = args.syslog_port |
|
| 132 | options['test_state'] = args.test_state |
|
| 133 | options['lustre'] = args.lustre |
|
| 134 | options['bllog'] = args.bllog |
|
| 135 | options['email'] = args.email |
|
| 136 | options['femail'] = args.femail |
|
| 137 | options['system_params'] = args.system_params |
|
| 138 | options['stats'] = 'on' |
|
| 139 | options['pre_run'] = True |
|
| 140 | options['checkpoint'] = None |
|
| 141 | ||
| 142 | if args.folder: |
|
| 143 | out_folder_name = os.path.basename(args.folder) |
|
| 144 | else: |
|
| 145 | out_folder_name = __create_folder_name(options['data_file']) |
|
| 146 | ||
| 147 | out_folder_path = __create_output_folder(args.out_folder, out_folder_name) |
|
| 148 | ||
| 149 | options['out_folder'] = out_folder_name |
|
| 150 | options['out_path'] = out_folder_path |
|
| 151 | ||
| 152 | basename = os.path.basename(args.in_file) |
|
| 153 | options['datafile_name'] = os.path.splitext(basename)[0] if basename \ |
|
| 154 | else args.in_file.split(os.sep)[-2] |
|
| 155 | ||
| 156 | inter_folder_path = __create_output_folder(args.tmp, out_folder_name) \ |
|
| 157 | if args.tmp else out_folder_path |
|
| 158 | ||
| 159 | options['inter_path'] = inter_folder_path |
|
| 160 | options['log_path'] = args.log if args.log else options['inter_path'] |
|
| 161 | options['nProcesses'] = len(options["process_names"].split(',')) |
|
| 162 | ||
| 163 | command_str = " ".join([str(i) for i in sys.argv[1:]]) |
|
| 164 | command_full = f"savu {command_str}" |
|
| 165 | options["command"] = command_full |
|
| 166 | ||
| 167 | return options |
|
| 168 | ||
| 169 | def __create_folder_name(dpath): |
|
| 170 | if os.path.isfile(dpath): |
|