-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsubmit_ts_step4.py
61 lines (46 loc) · 1.53 KB
/
submit_ts_step4.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
52
53
54
55
56
57
58
59
#!/usr/bin/env python
"""
Transformation removing intermediate mandelbrot images
"""
import json
from DIRAC.Core.Base import Script
Script.parseCommandLine()
import DIRAC
from DIRAC.TransformationSystem.Client.Transformation import Transformation
def submitTS():
########################################
# Modify here with your dirac username
owner = 'user02'
########################################
########################################
# Transformation definition
########################################
t = Transformation( )
t.setTransformationName( owner+'_step4' )
t.setType("Removal")
t.setDescription("Remove intermediate mandelbrot images")
t.setLongDescription( "Remove intermediate mandelbrot images" )
# set the request to be executed
t.setBody ( "Removal;RemoveFile" ) # Mandatory (the default is a ReplicateAndRegister operation)
# define input data by metadata query
inputMetaquery = {"application":"mandelbrot","image_format":"ascii","owner":owner}
t.setInputMetaQuery(inputMetaquery)
########################################
# Transformation submission
########################################
res = t.addTransformation()
if not res['OK']:
print(res['Message'])
DIRAC.exit( -1 )
t.setStatus("Active")
t.setAgentType("Automatic")
return res
if __name__ == '__main__':
try:
res = submitTS()
if not res['OK']:
DIRAC.gLogger.error ( res['Message'] )
DIRAC.exit( -1 )
except Exception:
DIRAC.gLogger.exception()
DIRAC.exit( -1 )