ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/input.py
(Generate patch)

Comparing UserCode/MitProd/Processing/bin/input.py (file contents):
Revision 1.3 by paus, Sat Mar 19 01:49:13 2011 UTC vs.
Revision 1.5 by paus, Sat Oct 22 13:07:04 2011 UTC

# Line 2 | Line 2
2   #---------------------------------------------------------------------------------------------------
3   # Simple interface to command line DBS to prepare my crabTask input files.
4   #---------------------------------------------------------------------------------------------------
5 < import os,sys,types,string,getopt
5 > import os,sys,types,string,re,getopt
6  
7   # Define string to explain usage of the script
8   usage =  "Usage: input.py --dataset=<name>\n"
# Line 60 | Line 60 | if dataset == None:
60   #---------------------------------------------------------------------------------------------------
61   if not db:
62      # find relevant blocks
63 <    if dbs != '':
64 <        cmd = "dbs search --url=" + dbs + " --query=\"find block where dataset=" + dataset + "\""
63 >    if   dbs == 'none':
64 >        cmd = 'dascli.py --query="block=' + dataset + '*" --limit=999999 --format=blocks'
65 >    elif dbs == '':
66 >        cmd = 'dbs search --query=\"find block where dataset=' + dataset + '\"'
67 >    elif re.search('http://',dbs):
68 >        cmd = 'dbs search --url=' + dbs + ' --query="find block where dataset=' + dataset + '"'
69      else:
70 <        cmd = "dbs search --query=\"find block where dataset=" + dataset + "\""
70 >        cmd = 'echo ' + dataset + '#00000000-0000-0000-0000-000000000000'
71 >
72 >    #print "CMD " + cmd
73      cmd += "| grep \# | sort"
74      # never print #print "cmd: " + cmd
75  
# Line 75 | Line 81 | if not db:
81          line = line[:-1]
82          blocks.append(line)
83      for block in blocks:
84 <        if dbs != '':
85 <            cmd = "dbs search --url=" + dbs + \
86 <            " --query=\"find file,file.numevents where block=" + block + "\""
84 >        #print ' BLOCK: ' + block
85 >
86 >        if   dbs == 'none':
87 >            cmd = 'dascli.py --query="file block=' + block + '" --limit=999999 --format=files'
88 >        elif dbs == '':
89 >            cmd = 'dbs search --query="find file,file.numevents where block=' + block + '"'
90 >        elif re.search('http://',dbs):
91 >            cmd = 'dbs search --url=' + dbs + \
92 >                  ' --query="find file,file.numevents where block=' + block + '"'
93          else:
94 <            cmd = "dbs search --query=\"find file,file.numevents where block=" + block + "\""
94 >            cmd = 'cat /home/cmsprod/catalog/t2mit/private/' + dbs + dataset \
95 >                  + '/Files | sed \'s@XX-CATALOG-XX@@\' | sed \'s@root://xrootd1.cmsaf.mit.edu/@@\''
96 >            
97 >        #print "CMD " + cmd
98          cmd += "| grep store | sort"
99          for line in os.popen(cmd).readlines():
100 +            #print "LINE >" + line
101              line = line[:-1]
102              f       = line.split()
103              lfn     = f[0]

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines