5 import subprocess, threading, os, sys
11 parser = argparse.ArgumentParser(description=
'Checks if dataset is accessible through FAX.')
12 parser.add_argument(
'dataset', type=str, help=
'Dataset name')
13 parser.add_argument(
'-af',
'--accessfile', action=
'store_const', const=
'1', help=
'try to open the first root file of the dataset using root. ')
14 parser.add_argument(
'-aa',
'--accessall', action=
'store_const', const=
'1', help=
'try to open all the root files of the dataset using root. ')
16 args = vars(parser.parse_args())
19 import dq2.clientapi.cli.cliutil
20 from dq2.common.cli.DQDashboardTool
import DQDashboardTool
21 from dq2.clientapi.cli.cliutil
import getDQ2
22 from dq2.filecatalog.lfc.lfcconventions
import to_native_lfn
24 print (
"Environment not set [error importing DQ2 dependencies]!")
34 def run(self, timeout):
37 self.
process = subprocess.Popen(self.
cmd, shell=
True)
40 thread = threading.Thread(target=target)
45 print (
'Terminating process')
60 ho=ho.replace(
"root://",
"")
61 self.
host=ho.split(
":")[0]
63 self.
port=ho.split(
":")[1]
66 if (what>=0
and self.redirector!=what):
return
67 print (
'name:', self.
name,
'\thost:', self.
host,
'\tport:', self.
port )
72 req = urllib2.Request(
"http://atlas-agis-api-0.cern.ch/request/service/query/get_se_services/?json&state=ACTIVE&flavour=XROOTD",
None)
73 opener = urllib2.build_opener()
78 ns =
site( s[
"rc_site"], s[
"endpoint"] )
84 print (
"Unexpected error:", sys.exc_info()[0] )
91 req = urllib2.Request(
"http://atlas-agis-api-0.cern.ch/request/ddmendpoint/query/list/?json&state=ACTIVE",
None)
92 opener = urllib2.build_opener()
97 if s[
"rc_site"]==c.name:
99 allddms.add(s[
"name"])
104 print (
"Unexpected error:", sys.exc_info()[0] )
115 if line.startswith(
'Multiple'):
break
117 if line.count(
':')==0:
continue
121 if line[0]==
'INCOMPLETE':
122 if len(line[1])==0:
continue
129 if line[0]==
'COMPLETE':
130 if len(line[1])==0:
continue
131 rep=line[1].
split(
',')
140 for d
in dsets.keys():
141 print (d,
'\tcomplete replicas:',dsets[d][1],
'\tincomplete:',dsets[d][0])