122def getArgumentParser(legacy_args=False, **kwargs):
123 """Create default argument parser"""
124
125 parser = argparse.ArgumentParser(formatter_class=
126 lambda prog : argparse.HelpFormatter(
127 prog, max_help_position=40, width=100),
128 add_help=False, **kwargs)
129
130 parser.expert_groups = [] # List of expert option groups
131
132 # --------------------------------------------------------------------------
133 g = parser.add_argument_group('Main options')
134
135 if __athenaCLI and legacy_args:
136 g.add_argument('scripts', nargs='*', action=JobOptAction,
137 help='scripts or pickle file to run')
138
139 g.add_argument('-l', '--loglevel', metavar='LVL', type=str.upper, default='INFO',
140 choices=['ALL', 'VERBOSE', 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'FATAL'],
141 help='logging level: %(choices)s')
142
143 g.add_argument('--filesInput', metavar='FILES',
144 help='set FilesInput property (comma-separated list with wildcards)')
145
146 g.add_argument('--evtMax', metavar='N', type=int,
147 help='max number of events to process')
148
149 g.add_argument('--skipEvents', metavar='N', type=int,
150 help='number of events to skip')
151
152 g.add_argument('--nprocs', metavar='N', type=int,
153 help='enable AthenaMP if %(metavar)s>=1 or %(metavar)s==-1')
154
155 g.add_argument('--threads', metavar='N', type=int,
156 help='number of threads for AthenaMT, threads per worker for athenaMP')
157
158 g.add_argument('--concurrent-events', metavar='N', type=int,
159 help='number of concurrent events for AthenaMT')
160
161 g.add_argument('--CA', action='store_true',
162 help='force ComponentAccumulator mode')
163
164 g.add_argument('--config-only', metavar='FILE', nargs='?', default=False, const=True,
165 help='run only configuration and optionally store in %(metavar)s')
166
167 g.add_argument('--mtes', action='store_true',
168 help='activate multi-threaded event service')
169
170 g.add_argument('--mtes-channel', metavar='NAME', default='EventService_EventRanges',
171 help='yampl channel name between pilot and AthenaMT in event service mode')
172
173 g.add_argument("--mpi", action="store_true", default=None, help="activate MPI mode")
174
175 g.add_argument('--version', action='version', version=get_version(),
176 help='print version number')
177
178 g.add_argument('-h', '--help', metavar='FLAGS', nargs='?', action=AthHelpFlags,
179 help='show help message (for FLAGS, "flags" for all categories)' if __athenaCLI
180 else 'show help message (for FLAGS category)')
181
182
183 # --------------------------------------------------------------------------
184 g = parser.add_argument_group('Monitoring and debugging')
185
186 g.add_argument('--perfmon', metavar='MODE', nargs='?', const='fastmonmt',
187 help='enable performance monitoring toolkit in MODE')
188
189 g.add_argument('-i', '--interactive', nargs='?', choices=['init', 'run'], const='init',
190 help='interactive mode with optional stage (default: init)')
191
192 g.add_argument('--profile-python', metavar='FILE',
193 help='profile python code, dump in %(metavar)s (.pkl or .txt)')
194
195 g.add_argument('-d', '--debug', metavar='STAGE', nargs='?', const='init',
196 choices=['conf', 'init', 'exec', 'fini'],
197 help='attach debugger at stage: %(choices)s [%(const)s] (gdb or $ATLAS_DEBUGGER if set)')
198
199 g.add_argument('--debugWorker', action='store_true', dest='debug_worker',
200 help='pause AthenaMP workers at bootstrap until SIGUSR1 signal received')
201
202 g.add_argument('--tracelevel', metavar='LEVEL', nargs='?', type=int, choices=range(1,4), const=3,
203 help='trace level for python configuration (%(choices)s)')
204
205 # --------------------------------------------------------------------------
206 if legacy_args:
207 g = parser.add_argument_group('Legacy options')
208
209 g.add_argument('-c', '--command', metavar='CMD',
210 help='one-liner, runs before any scripts')
211
212 g.add_argument('--drop-and-reload', action='store_true', dest='drop_reload',
213 help='offload configuration and start new process')
214
215 g.add_argument('--dump-configuration', metavar='FILE', dest='config_dump_file',
216 help='dump an ASCII version of the configuration to %(metavar)s')
217
218 g.add_argument('-s', '--showincludes', action='store_true',
219 help='show printout of included files')
220
221 # --------------------------------------------------------------------------
222 if __athenaCLI:
223 g = parser.add_argument_group('System options')
224
225 g.add_argument('--tcmalloc', action='store_true', dest='tcmalloc', default=True,
226 help='use tcmalloc.so for memory allocation [DEFAULT]')
227
228 g.add_argument('--stdcmalloc', action='store_false', dest='tcmalloc',
229 help='use libc malloc for memory allocation')
230
231 g.add_argument('--stdcmath', action='store_true', default=True,
232 help='use libc malloc for memory allocation [DEFAULT]')
233
234 g.add_argument('--imf', action='store_true',
235 help='use Intel Math Function library')
236
237 g.add_argument('--exctrace', action='store_true',
238 help='preload exception trace collector')
239
240 g.add_argument('--no-excabort', action='store_true',
241 help='disable converting some exceptions to abort')
242
243 g.add_argument('--preloadlib', metavar='LIB',
244 help='localized preload of library %(metavar)s')
245
246 g.add_argument('--enable-ers-hdlr', metavar='y/n', default='n', choices=['y','n'],
247 help='enable or not the ERS handler [%(default)s]')
248
249 return parser
250
251