17 dt = time.gmtime(sec)[2:6]
19 return "%id %ih %im %is" % ((dt[0]-1,) + dt[1:])
21 return "%ih %im %is" % dt[1:]
23 if __name__ ==
'__main__':
26 d, searchstr, age, reffile = sys.argv
29 os.system(
'grep %s %s > data/%s.tmp.txt' % (searchstr, reffile, searchstr))
32 fr =
open(
'data/%s.tmp.txt' % searchstr,
"r" )
40 if '.RAW' in filename:
41 path = filename[:filename.index(searchstr)]
42 if not path
in paths: paths.append(path)
44 filenames.append( [path, filename[filename.index(searchstr):]] )
46 filenames.append( [path, filename] )
48 path = filename[:filename.index(searchstr)+len(searchstr)+1]
49 if not path
in paths: paths.append(path)
51 filenames.append( [path, filename[filename.index(searchstr)+len(searchstr)+1:]] )
53 filenames.append( [path, filename] )
59 for path, filename
in filenames:
61 content +=
'<tr><td style="padding-top:5px;padding-bottom:5px;">%s<br>\n' % filename
63 content +=
'<tr><td style="padding-top:5px;padding-bottom:5px;"><font color="#CC0000"><i>The path for the following file differs from the above default. Full path + filename is thus given:</i></font><br>\n'
64 content +=
'%s<br>\n' % filename
65 content +=
'<font color="#999999"><font size="1px">%s</font></font><br></td></tr>\n' % info
68 s =
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html xmlns:"my"><head><head><title>ATLCAL results for dataset: %s' % searchstr
69 s +=
'</title><LINK href="atlas-runquery.css" rel="stylesheet" type="text/css"></head><body>\n\n'
70 s +=
'<table style="font-family:sans-serif;padding:4px;font-size:80%;width:100%">'
73 s +=
'<tr><td style="font-size:110%%"><b>ATLCAL disk pool − files belonging to dataset: <font color="#CC0000">%s</font><br><hr color="gray" size=1></td></tr>\n' % searchstr
77 s +=
'<tr><td>Age of dataset: <b>%s</b></td></tr>' %
'unknown'
79 if ic == 0: s +=
'<tr><td><b>No files found on ATLCAL.</b><br> <br>Note that the accounting of newly replicated datasets may take up to 24h (which adds to the production and replication delay). </td></tr>'
80 else: s +=
'<tr><td>Number of files found: <b>%i</b></td></tr>' % ic
84 s +=
'<tr><td>Common path for all files:<br> <font color="#AA0000">%s</font><br><hr color="gray" size=1></td></tr>' % refpath
86 s +=
'<tr><td>Common path for the following files if not indicated otherwise:<br> <font color="#AA0000">%s</font><br><hr color="gray" size=1></td></tr>' % refpath
92 s +=
'<tr><td><hr color="red" size=1><font color="#777777"><font size="-1"><i><font size="-2">Created by AtlRunQuery on: %s</font></i></font></td></tr>' %
str(datetime.datetime.now())
93 s +=
'</table></body></html>'
95 os.system(
"echo '%s' > data/%s.html" % (s, searchstr))