CMS 3D CMS Logo

Classes | Functions | Variables
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 ()
 

Variables

 result = upload_controller.upload()
 
 upload_controller = uploader(**upload_metadata)
 
 upload_metadata = parse_arguments()
 
dictionary upload_metadata_argument = {}
 

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

◆ friendly_since()

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

◆ log()

def uploads.log (   file_handle,
  message 
)
Very simple logging function, used by output class.

Definition at line 39 of file uploads.py.

References conddb_time.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.utcnow()), message))
44 
def log(file_handle, message)
Definition: uploads.py:39
def to_timestamp(dt)
Definition: conddb_time.py:13

◆ new_log_file_id()

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.

45 def new_log_file_id():
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 = [file for file in os.listdir(os.path.join(os.getcwd(), "upload_logs")) if "upload_log" in file]
56  new_id = len(log_files)+1
57  return new_id
58 
def new_log_file_id()
Definition: uploads.py:45

Variable Documentation

◆ result

uploads.result = upload_controller.upload()

Definition at line 771 of file uploads.py.

◆ upload_controller

uploads.upload_controller = uploader(**upload_metadata)

Definition at line 769 of file uploads.py.

◆ upload_metadata

uploads.upload_metadata = parse_arguments()

Definition at line 757 of file uploads.py.

◆ upload_metadata_argument

dictionary uploads.upload_metadata_argument = {}

Definition at line 762 of file uploads.py.