fnal.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import os, sys
3 import samweb_client
4 import ifdh, socket
5 
6 
7 samweb = 0
8 dh = 0
9 
10 def FetchLog(logfilename):
11  global dh, samweb
12  if not samweb:
13  samweb = samweb_client.SAMWebClient(experiment='nova')
14  if not dh:
15  dh = ifdh.ifdh("http://samweb.fnal.gov:8480/sam/nova/api")
16  try:
17  if not os.path.exists(logfilename):
18  print(logfilename)
19  path = samweb.locateFile(logfilename)[0]['full_path'].replace("enstore:","")
20  #print "Fetching", os.path.join(path, logfilename), "for", name
21  dh.cp(["-D", os.path.join(path, logfilename), "./"])
22  return logfilename
23 
25  print("Did not find", logfilename)
26  except socket.error:
27  print("Connection trouble in", logfilename)
28 
def FetchLog(logfilename)
Definition: fnal.py:10
bool print