1
+ #! /usr/bin/env python3
2
+ import subprocess , sys , argparse , importlib
3
+ from builtins import int
4
+
5
+ ###################################################################
6
+ ## This is an implementation of a
7
+ ## decider framework. This class is not designed for inheritance.
8
+ ###################################################################
9
+
10
+ def __main ():
11
+
12
+ parser = argparse .ArgumentParser (description = 'Run a SeqWare decider in order to schedule workflow runs' )
13
+ targetGroup = parser .add_mutually_exclusive_group (required = True )
14
+ bigTargetGroup = targetGroup .add_mutually_exclusive_group ()
15
+ bigTargetGroup .add_argument ('--all' , help = 'Target the decider at all data in your SeqWare provenance report' , action = 'store_true' )
16
+ smallTargetGroup = targetGroup .add_mutually_exclusive_group ()
17
+ supportedConstraints = ['study-name' , 'lane-SWID' , 'ius-SWID' , 'sample-name' , 'root-sample-name' , 'sequencer-run-name' , 'organism' , 'processing-SWID' ]
18
+ for constraint in supportedConstraints :
19
+ smallTargetGroup .add_argument ('--' + constraint , help = 'Target the decider at a ' + constraint + ', can be specified multiple times' , action = 'append' )
20
+ parser .add_argument ('--test' , help = 'Output commands for scheduling potential workflow runs instead of actually scheduling them' , action = 'store_true' )
21
+ parser .add_argument ('--host' , help = 'Schedule onto a particular host' )
22
+ parser .add_argument ('--launch-max' , help = 'The maximum number of jobs to launch at once' , default = sys .maxsize , type = int )
23
+ parser .add_argument ('--meta-types' , help = 'The meta-type(s) of files to run a workflow with' , action = 'append' )
24
+ parser .add_argument ('--deciderImpl' , help = 'The name of a Python class that contains the implementation of the decider' , default = 'basicDeciderImpl' )
25
+
26
+
27
+ args = parser .parse_args ()
28
+ ## for debugging print the arguments
29
+ print (args )
30
+
31
+ decider = importlib .import_module (args .deciderImpl )
32
+ Decider = getattr (decider , 'Decider' )
33
+
34
+ deciderImpl = Decider ()
35
+ deciderImpl .init (parser )
36
+
37
+
38
+
39
+
40
+
41
+ __main ()
0 commit comments