/usr/share/arc/DGBridgeDataPlugin.py is in nordugrid-arc-arex 5.3.0~rc1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 60 61 62 63 64 65 66 67 68 69 70 | #!/usr/bin/python
import sys
import arc
import time
import re
#get cmdline args
if not len(sys.argv)==3:
print("Number of arguments must be 3 was: " + str(len(sys.argv)))
sys.exit(-1)
controldir=sys.argv[1]
jobid=sys.argv[2]
filename=controldir+'/job.'+jobid+'.description'
locfile=controldir+'/job.'+jobid+'.3gdata'
inpfile=controldir+'/job.'+jobid+'.input'
print("starting 3GDataPlugin\n"+filename+"\n"+locfile+"\n\n")
#read in file
f=open(filename,'r')
rawdesc=f.read()
f.close()
jobdesc=arc.JobDescription()
jobdesclist=arc.JobDescriptionList()
if not jobdesc.Parse(rawdesc,jobdesclist):
sys.exit(-1)
#extract staging info
dselements=[]
while jobdesclist.front().DataStaging.InputFiles.size()>0:
dselements.append(jobdesclist.front().DataStaging.InputFiles.pop())
inputfiles=""
locelements=[]
#filter staging
for dsel in dselements:
#check for attic or http
proto=dsel.Sources[0].Protocol()
url=dsel.Sources[0].str()
matchlist = re.findall(".*?;md5=.*?:size=.*?$",url) #check whether url has md5 and size set
if (proto=='attic' or proto=='http') and len(matchlist)==1 and matchlist[0]==url : #we can put http here also, but we'll need to check for md5 and size
locelements.append(dsel)
else:
jobdesclist.front().DataStaging.InputFiles.append(dsel)
if not dsel.Sources[0].Protocol()=='file':
inputfiles = inputfiles + dsel.Name + " " + dsel.Sources[0].str() + "\n"
else:
inputfiles = inputfiles + dsel.Name + "\n"
#write modified input
f=open(inpfile,'w')
f.write(inputfiles)
f.close()
print(inputfiles)
#print(jobdesc.UnParse()+"\n\n")
print("attic type files\n")
#append attic and http info to .3gdata
f=open(locfile,'a')
outstr=""
for elem in locelements:
outstr=outstr + elem.Name+ " " + elem.Sources[0].str() + "\n"
print(outstr)
f.write(outstr)
f.close()
sys.exit(0)
|