CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
cmssw_das_client.py
Go to the documentation of this file.
1 from commands import getstatusoutput
2 from json import loads
3 from das_client import get_value as das_get_value
4 
5 def get_value(data, filters, base=10):
6  return das_get_value(data, filters, base)
7 
8 def get_data(query, limit=None, threshold=None, idx=None, host=None):
9  cmd_opts = "--format=json"
10  if threshold is not None: cmd_opts += " --threshold=%s" % threshold
11  if limit is not None: cmd_opts += " --limit=%s" % limit
12  if idx is not None: cmd_opts += " --idx=%s" % idx
13  if host is not None: cmd_opts += " --host=%s" % host
14  err, out = getstatusoutput("das_client %s --query '%s'" % (cmd_opts, query))
15  if not err: return loads(out)
16  return {'status' : 'error', 'reason' : out}