def submitJobs(jobs,verbose=False): # set hostname hostname = commands.getoutput('hostname') for job in jobs: job.creationHost = hostname # serialize strJobs = pickle.dumps(jobs) # instantiate curl curl = Curl() curl.sslCert = _x509() curl.sslKey = _x509() curl.verbose = verbose # execute url = baseURLSSL + '/submitJobs' data = {'jobs':strJobs} curl.verifyHost = False status,output = curl.post(url,data) if status!=0: print(output) return status,None try: return status,pickle.loads(output) except Exception as e: logging.error(traceback.format_exc()) return 1,[]
def killJobs(ids,verbose=False): # serialize strIDs = pickle.dumps(ids) # instantiate curl curl = Curl() curl.sslCert = _x509() curl.sslKey = _x509() curl.verbose = verbose # execute url = baseURLSSL + '/killJobs' data = {'ids':strIDs} status,output = curl.post(url,data) try: return status,pickle.loads(output) except Exception as e: logging.error(traceback.format_exc()) return 1,[]