Esempio n. 1
0
def getProductionArchitecture(release_name, tcBaseURL = tcBaseURL, dryRun=False):
    url = tcBaseURL+'public/py_getReleaseArchitectures?default=1&release=%s' % (release_name)
    print "going to receive release %s architectures: %s" % (release_name, url) 
    raw_output = str(doWget(url))
    architecture = None
    if raw_output:
      print "raw output: " + raw_output
      architecture = loads(raw_output)
    return architecture
Esempio n. 2
0
def getRequestData(request, dryRun=False, tcBaseURL = tcBaseURL):
    url = tcBaseURL+'public/getCustomIBRequestInformation?request_id=' + str(request)
    raw_output = str(doWget(url))
    print "Output-Size: " + str(len(raw_output))  
    print "raw output:\n" + raw_output
    if not raw_output:
      return None
    data = loads(raw_output)
    print "data=" + str(data)
    return data
Esempio n. 3
0
def call(obj, method, **kwds):
  obj = str(obj).strip("/")
  print obj,":", method
  print kwds
  if method == "GET":
    opts = urlencode(kwds)
    result = ws_sso_content_reader.getContent(join(DEFAULT_API_URL, obj) + "?" + opts, None, method)
  elif method in ["POST", "PATCH", "DELETE"]:
    opts = dumps(kwds)
    result = ws_sso_content_reader.getContent(join(DEFAULT_API_URL, obj), opts, method)
    print result
  return loads(result)
Esempio n. 4
0
def listPendingTasks(state="Pending", release_pattern=".*", architecture_pattern=".*", tcBaseURL=tcBaseURL):
    url = tcBaseURL+'public/getCustomIBRequests?state=Pending'
    raw_output = str(doWget(url))
    if not raw_output:
      return None
    requests = loads(raw_output)
    data = [getRequestData(request, dryRun=False, tcBaseURL = tcBaseURL) for request in requests]
    data2 = [r for r in data if r and re.match(release_pattern, r["release_name"])]
    data3 = [r for r in data2 if re.match(architecture_pattern, r["architecture_name"])]
    data4 = [r for r in data3 if r["type"].startswith("TASK")]
    data5 = [r for r in data4 if r.has_key("tags")]
    return [(x["id"], x["architecture_name"], x["release_name"], x["tags"]) for x in data5]
Esempio n. 5
0
def getBuildingRequests(rel=None, architecture_names=None, dryRun=False, tcBaseURL = tcBaseURL, type='IB'):    
    url = tcBaseURL+'public/getCustomIBRequests?state=Building&types=%s' % (type)
    print "going to receive pending %s requests: %s" % (type, url)
    raw_output = str(doWget(url))
    print "raw output: " + raw_output
    requests = loads(raw_output)
    ret_data = []
    for request in requests:
        data = getRequestData(request, dryRun=dryRun, tcBaseURL = tcBaseURL)
        if data and (not rel or data["release_name"].startswith("CMSSW_" + rel)):
            if architecture_names:
                for architecture_name in architecture_names:
                    if data['architecture_name'] == architecture_name:
                        ret_data.append(data)
            else:
                ret_data.append(data)
    return ret_data
Esempio n. 6
0
def getPendingRequests(release_pattern=None, architecture_pattern=None, requestType='IB',dryRun=False, tcBaseURL = tcBaseURL):    
    url = tcBaseURL+'public/getCustomIBRequests?state=Pending&types=%s' % (requestType)
    if dryRun:
      print "going to receive pending %s requests: %s" % (requestType, url)
    raw_output = str(doWget(url))
    if not raw_output:
      return None
    requests = loads(raw_output)
    for request in requests:
        data = getRequestData(request, dryRun=dryRun, tcBaseURL = tcBaseURL)
        if data:
            if release_pattern and not re.match(release_pattern, data['release_name']):
                continue
            if architecture_pattern and not re.match(architecture_pattern, data['architecture_name']):
                continue
            print "Found request with release name %s and architecture %s" % (data['release_name'], data['architecture_name'],)
            return data
    return None