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)
def createTaskRequest(release_name, architecture_name, request_type="TASK", tcBaseURL = tcBaseURL, **kwds): print "Scheduling a task associated to release %s for architecture %s. Payload:" % (release_name, architecture_name) for (k,v) in kwds.iteritems(): print ": ".join((str(k), str(v))) if not re.match("^CMSSW_\d+_\d+_.*",release_name): return args = {"release_name": release_name, "architecture_name": architecture_name, "type": request_type, "dict": dumps(kwds)} url = urllib.urlencode(args) output = doWget(tcBaseURL + 'requestTask?' + url) if not output == None and len(output) == 0: print "Done" else: print "Error occured when scheduling the qa, output:" + str(output)
#!/usr/bin/env python import sys, os import tagCollectorAPI from optparse import OptionParser from all_json import loads,dumps if __name__ == '__main__': parser = OptionParser(usage="%(prog)s [--dry-run] -r <release-cycle> -p <parent-release> <archs>") parser.add_option("-n", "--dry-run", dest="dryRun", action="store_true", help="Do not actually execute") parser.add_option("-r", "--releasecycle", dest="releaseCycles", help="Release cycle") parser.add_option("-p", "--parent-release", dest="parentRelease", help="Parent release") opts, args = parser.parse_args() if not args: parser.error("Please specify at least one architecture") if len(args) != 1: parser.error("Please specify one and only one release cycle you want to create an IB for.") architectures = args[0].split(',') json_archs = dumps([x.strip() for x in architectures]) release = 'CMSSW_' + opts.releaseCycles.replace('.','_') + '_X' isReleaseCreated, snapshotName = tagCollectorAPI.mkSnapshot(release, architectures=json_archs, parentRelease=opts.parentRelease) if not isReleaseCreated: parser.error("Could not create release.") if not snapshotName: parser.error("Could not create snapshot.") #tagCollectorAPI.createIBRequest(snapshotName, architectures)