-
Notifications
You must be signed in to change notification settings - Fork 2
/
submit_wms.py
51 lines (37 loc) · 1.32 KB
/
submit_wms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
""" Submit mandelbrot job
"""
from DIRAC.Core.Base import Script
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
'Usage:',
' %s first_line factor' % Script.scriptName,
'\ne.g: %s 1'% Script.scriptName,
] ) )
Script.parseCommandLine()
import DIRAC
from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac
def submitWMS( args ):
first_line = args[0]
job = Job()
dirac = Dirac()
job.setName('mandelbrot')
job.setExecutable('git clone https://github.com/bregeon/mandel4ts.git')
job.setExecutable('./mandel4ts/mandelbrot.py',arguments="-P 0.0005 -M 1000 -L %s -N 200" % first_line)
job.setOutputData( ['data_*.bmp','data*.txt'])
res = dirac.submitJob(job)
return res
#########################################################
if __name__ == '__main__':
args = Script.getPositionalArgs()
if ( len( args ) != 1 ):
Script.showHelp()
try:
res = submitWMS( args )
if not res['OK']:
DIRAC.gLogger.error ( res['Message'] )
DIRAC.exit( -1 )
else:
DIRAC.gLogger.notice( 'Submitted job: %s' % res['Value'] )
except Exception:
DIRAC.gLogger.exception()
DIRAC.exit( -1 )