Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
n,last_id = mysql.add_task(param)
print(u"INFO, job initial, 0")
unique_id = last_id
if (specifynode == 1):
J = Jenkins(jenkinsurl)
jobs = Jobs(J)
job = jobs[jobname]
build_params['UNIQUE_ID'] = unique_id
invoke = job.invoke(build_params=build_params)
print("INFO, specifynode true")
elif (specifynode == 0):
client = gear.Client()
client.addServer(gear_server, port = gear_port)
client.waitForServer() # Wait for at least one server to be connected
build_params['UNIQUE_ID'] = unique_id
job = gear.Job('build:' + jobname, json.dumps(build_params))
client.submitJob(job)
print("INFO, specifynode false")
param=(1, unique_id)
mysql.update_task_status(param)
print(u"INFO, job submit, 1")
print(u"INFO, job unique id :" + str(unique_id))
url = "http://10.48.55.39:8889/jobstatus/?job=" + str(unique_id)
print(u"INFO, you could link " + url + " to trace the job status")
except Exception as e:
print(e)
finally:
mysql.close()
return url