def query_runregistry(query):
    """
    query run registry's tables using resthub API
    """
    try:
        api = RhApi("http://vocms00170:2113", debug=options.verbose)
        rr_data = api.json_all(query, inline_clobs=True)
    except Exception as ex:
        print("Error while using RestHub API: %s" % (ex))
        sys.exit(-1)

    return rr_data
예제 #2
0
def query_runregistry(query):
    """
    query run registry's tables using resthub API
    """
    try:
        api = RhApi("http://vocms00170:2113", debug=True)
        rr_data = api.json_all(query, inline_clobs=True)
    except Exception as ex:
        print("Error while using RestHub API: %s" % (ex))
        sys.exit(-1)

    return rr_data
예제 #3
0
    def get_list_of_lumis(self, query):
        """
        get list of lumis for runs with specified query
        """

        try:
            api = RhApi(self.restHubURL, debug=self.verbose)
            rr_data = api.json_all(query, inline_clobs=True)
        except Exception as ex:
            print("Error while using RestHub API: %s" % (ex))
            sys.exit(-1)

        return rr_data
예제 #4
0
    def get_list_of_runs(self, query):
        """
        return list of runs from restHub API
        """

        try:
            api = RhApi(self.restHubURL, debug=self.verbose)
            rr_data = api.json_all(query, inline_clobs=True)
        except Exception as ex:
            print("Error while using RestHub API: %s" % (ex))
            sys.exit(-1)

        # convert resthub format to useful list of runs
        # 0th value is runnumber as specified in __query

        list_of_runs = [el[0] for el in rr_data]
        return list_of_runs
    def writeJSON(self):
        from rhapi import DEFAULT_URL, RhApi
        api = RhApi(DEFAULT_URL, debug=False)

        p = {"class": self.group}
        results = api.json_all(self.query, p)
        #print results
        json_ = {}
        for entry in results:
            try:
                json_[str(entry[0])].append([entry[1], entry[2]])
            except:
                json_[str(entry[0])] = [[entry[1], entry[2]]]

        for key in json_.keys():
            json_[key] = self.merge_intervals(json_[key])
        with open(self.jsonfile, 'w') as f:
            f.write(json.dumps(json_, sort_keys=True))