get oms data

Functionality to call the OMS API with the correct query based on input parameters

How to use?
Check the readme file in this directory for the required setup!
In particular, you will need an application ID and client secret to authenticate.

Once this is ready, you can do the following:

See the notebook example.ipynb in this directory for some examples!


get_oms_api

full signature:

def get_oms_api()  

comments:

get an OMSAPI instance  
takes no input arguments, as the configuration parameters are unlikely to change very often  
if needed, these parameters can be changed in the file urls.py  

get_oms_data

full signature:

def get_oms_data( omsapi, api_endpoint, runnb=None, fillnb=None, extrafilters=[], extraargs={}, sort=None, attributes=[], limit_entries=1000)  

comments:

query some data from OMS  
input arguments:  
- omsapi: an OMSAPI instance, e.g. created by get_oms_api()  
- api_endpoint: string, target information, e.g. 'runs' or 'lumisections'  
  (see the readme for a link where the available endpoints are listed)  
- runnb: run number(s) to retrieve the info for,  
  either integer (for single run) or tuple or list of two elements (first run and last run)  
  (can also be None to not filter on run number but this is not recommended)  
- fillnb: runnb but for fill number instead of run number  
- extrafilters: list of extra filters (apart from run number),  
  each filter is supposed to be a dict of the form {'attribute_name':<name>,'value':<value>,'operator':<operator>}  
  where <name> must be a valid field name in the OMS data, <value> its value, and <operator> chosen from "EQ", "NEQ", "LT", "GT", "LE", "GE" or "LIKE"  
- extraargs: dict of custom key/value pairs to add to the query  
  (still experimental, potentially usable for changing the granularity from 'run' to 'lumisection' for e.g. L1 trigger rates, see example.ipynb)  
- sort: valid field name in the OMS data by which to sort  
- attributes: list of valid field names in the OMS data to return (if not specified, all information is returned)  
- limit_entries: entry limit for output json object  

get_oms_response_attribute

full signature:

def get_oms_response_attribute( omsresponse, attribute )  

comments:

small helper function to retrieve a list of values for a single attribute  
input arguments:  
- omsresponse: the json-like object returned by get_oms_data  
- attribute: name of one of the attributes present in omsresponse