示例#1
0
 def get(self, status, data_field=None):
     app.logger.debug('Requesting all runs with status: %s', status)
     if status == "not_processed":
         sub_query = {"$not": {"$elemMatch": {"type": "processed"}},
                      "$elemMatch": {"type": "raw",
                                     "status": "transferred"}}
     elif status == "processing":
         sub_query = {"$elemMatch": {"type": "processed",
                                     "status": "processing"}}
     elif status == "processed":
         # No processed data and raw data is transferring
         sub_query = {"$elemMatch": {"type": "processed",
                                     "status": "processed"}}
     elif status == "transferring":
         # No processed data and raw data is transferring
         sub_query = {"$not": {"$elemMatch": {"type": "processed"}},
                      "$elemMatch": {"type": "raw",
                                     "status": "transferring"}}
     else:
         return flask.abort(404,
                           "Status {} is not supported".format(status))
     query = {"data": sub_query}
     results = util.get_data_single_top_level(query, data_field)
     app.logger.debug("results: %s" % results)
     if results:
         return results
     else:
         return flask.abort(404,
                            "No run with status {} found".format(status))
示例#2
0
 def get(self, data_field=None):
     app.logger.debug("Getting ALL runs")
     results = util.get_data_single_top_level({}, data_field)
     if results:
         return flask.jsonify({"results": results})
     else:
         return flask.abort(404, "No runs found. Check the database!")
示例#3
0
 def get(self, tag, data_field=None):
     app.logger.debug("Getting all runs with tag %s" % tag)
     query = {"tags.name": tag}
     results = util.get_data_single_top_level(query, data_field)
     if results:
         return flask.jsonify({"results": results})
     else:
         return flask.abort(404, "No run with tag {} found".format(tag))
示例#4
0
 def get(self, source, data_field=None):
     app.logger.debug('Requesting all runs with source: %s', source)
     if source == "calibration":
         query = {"source.type": {"$not": {"$eq": "none"}}}
     else:
         query = {"source.type": source}
     app.logger.debug("query: {}".format(query))
     results = util.get_data_single_top_level(query, data_field)
     app.logger.debug("results: %s" % results)
     if results:
         return flask.jsonify({"results": results})
     else:
         return flask.abort(404,
                            "No run with source {} found".format(source))
示例#5
0
 def get(self, location, data_field=None):
     query = {
         "data": {
             "$elemMatch": {
                 "host": "rucio-catalogue",
                 "rse": location
             }
         }
     }
     results = util.get_data_single_top_level(query)
     if results:
         return flask.jsonify({"results": results})
     else:
         return flask.abort(
             404, "No run with location {} found".format(location))
示例#6
0
 def get(self, version):
     app.logger.debug('Requesting all runs with status: %s', status)
     if not version.startswith('v'):
         version = "v" + version
     query = {
         "data": {
             "$elemMatch": {
                 "type": "processed",
                 "status": "transferred",
                 "pax_version": version
             }
         }
     }
     results = util.get_data_single_top_level(query, "data")
     app.logger.debug("results: %s" % results)
     if results:
         return results
     else:
         return flask.abort(404)
示例#7
0
 def get(self, status, pax_version, data_field=None):
     app.logger.debug(('Requesting all runs with status: %s and '
                       'PAX version: %s'),
                      (status, pax_version))
     if status == "processing":
         query = {"$elemMatch": {"type": "processed",
                                 "status": "processing",
                                 "pax_version": pax_version}}
     elif status == "processed":
         query = {"$elemMatch": {"type": "processed",
                                 "status": "processed",
                                 "pax_version": pax_version}}
     results = util.get_data_single_top_level(query, data_field)
     app.logger.debug("results: %s" % results)
     if results:
         return results
     else:
         return flask.abort(404,
                            ("No run with status {} and PAX version {} "
                             "found").format(status, pax_version))