CMS 3D CMS Logo

Classes | Functions
uploads Namespace Reference

Classes

class  output
 
class  uploader
 

Functions

def friendly_since (time_type, since)
 
def log (file_handle, message)
 
def new_log_file_id ()
 

Detailed Description

Joshua Dawes - CERN, CMS - The University of Manchester

This module holds classes to help with uploading conditions to the drop box web service, which also uses CondDBFW to read and write data.

Function Documentation

def uploads.friendly_since (   time_type,
  since 
)
Takes a since and, if it is Run-based expressed as Lumi-based, returns the run number.
Otherwise, returns the since without transformations.

Definition at line 28 of file uploads.py.

Referenced by uploads.uploader.filter_iovs_by_fcsr().

28 def friendly_since(time_type, since):
29  """
30  Takes a since and, if it is Run-based expressed as Lumi-based, returns the run number.
31  Otherwise, returns the since without transformations.
32  """
33  if time_type == "Run" and (since & 0xffffff) == 0:
34  return since >> 32
35  else:
36  return since
37 
38 # this is simple, and works for now - if logging requirements change, I will write a logging class to manage logging
def friendly_since(time_type, since)
Definition: uploads.py:28
def uploads.log (   file_handle,
  message 
)
Very simple logging function, used by output class.

Definition at line 39 of file uploads.py.

References utils.to_timestamp().

Referenced by uploads.output.write().

39 def log(file_handle, message):
40  """
41  Very simple logging function, used by output class.
42  """
43  file_handle.write("[%s] %s\n" % (to_timestamp(datetime.now()), message))
44 
def to_timestamp(obj)
Definition: utils.py:6
def log(file_handle, message)
Definition: uploads.py:39
def uploads.new_log_file_id ( )
Find a new client-side log file name.

Note: This cannot use the upload session token since logs need to be written before this is opened.
However, this can be changed so that the filename that uses the token is written to once
it is obtained.

Definition at line 45 of file uploads.py.

References ALCARECOTkAlBeamHalo_cff.filter.

46  """
47  Find a new client-side log file name.
48 
49  Note: This cannot use the upload session token since logs need to be written before this is opened.
50  However, this can be changed so that the filename that uses the token is written to once
51  it is obtained.
52  """
53  # new id = number of log files + 1
54  # (primitive - matching the hash of the upload session may be a better idea)
55  log_files = filter(lambda file : "upload_log" in file,
56  os.listdir(os.path.join(os.getcwd(), "upload_logs"))
57  )
58  new_id = len(log_files)+1
59  return new_id
60 
def new_log_file_id()
Definition: uploads.py:45