@@ -15,7 +15,7 @@ class CondorDAGManPlugin(GraphPluginBase):
15
15
"""Execute using Condor DAGMan
16
16
17
17
The plugin_args input to run can be used to control the DAGMan execution.
18
- The value of any argument can be a literal string or a filename, where in
18
+ The value of most arguments can be a literal string or a filename, where in
19
19
the latter case the content of the file will be used as the argument value.
20
20
21
21
Currently supported options are:
@@ -26,6 +26,12 @@ class CondorDAGManPlugin(GraphPluginBase):
26
26
submit file
27
27
- override_specs : additional submit specs that are appended to any job's
28
28
submit file
29
+ - wrapper_cmd : path to an exectuable that will be started instead of a node
30
+ script. This is useful for wrapper script that execute certain
31
+ functionality prior or after a node runs. If this option is
32
+ given the wrapper command is called with the respective Python
33
+ exectuable and the path to the node script as final arguments
34
+ - wrapper_args : optional additional arguments to a wrapper command
29
35
- dagman_args : arguments to be prepended to the job execution script in the
30
36
dagman call
31
37
"""
@@ -61,11 +67,16 @@ def __init__(self, **kwargs):
61
67
('_initial_specs' , 'initial_specs' , '' ),
62
68
('_override_specs' , 'submit_specs' , '' ),
63
69
('_override_specs' , 'override_specs' , '' ),
70
+ ('_wrapper_cmd' , 'wrapper_cmd' , None ),
71
+ ('_wrapper_args' , 'wrapper_args' , '' ),
64
72
('_dagman_args' , 'dagman_args' , '' )):
65
73
if 'plugin_args' in kwargs \
66
74
and not kwargs ['plugin_args' ] is None \
67
75
and id_ in kwargs ['plugin_args' ]:
68
- val = self ._get_str_or_file (kwargs ['plugin_args' ][id_ ])
76
+ if id_ == 'wrapper_cmd' :
77
+ val = os .path .abspath (kwargs ['plugin_args' ][id_ ])
78
+ else :
79
+ val = self ._get_str_or_file (kwargs ['plugin_args' ][id_ ])
69
80
setattr (self , var , val )
70
81
# TODO remove after some time
71
82
if 'plugin_args' in kwargs \
@@ -89,8 +100,11 @@ def _submit_graph(self, pyfiles, dependencies, nodes):
89
100
node = nodes [idx ]
90
101
# XXX redundant with previous value? or could it change between
91
102
# scripts?
92
- template , initial_specs , override_specs = self ._get_args (
93
- node , ["template" , "initial_specs" , "override_specs" ])
103
+ template , initial_specs , override_specs , wrapper_cmd , wrapper_args = \
104
+ self ._get_args (node ,
105
+ ["template" , "initial_specs" ,
106
+ "override_specs" , "wrapper_cmd" ,
107
+ "wrapper_args" ])
94
108
# add required slots to the template
95
109
template = '%s\n %s\n %s\n ' % ('%(initial_specs)s' ,
96
110
template ,
@@ -105,6 +119,12 @@ def _submit_graph(self, pyfiles, dependencies, nodes):
105
119
basename = os .path .join (batch_dir , name ),
106
120
override_specs = override_specs
107
121
)
122
+ if not wrapper_cmd is None :
123
+ specs ['executable' ] = wrapper_cmd
124
+ specs ['nodescript' ] = \
125
+ '%s %s %s' % (wrapper_args % specs , # give access to variables
126
+ sys .executable ,
127
+ pyscript )
108
128
submitspec = template % specs
109
129
# write submit spec for this job
110
130
submitfile = os .path .join (batch_dir ,
0 commit comments