Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def republish_job(self, buildreq):
if (isinstance(buildreq, BuildRequest)) :
routing_key = pybit.get_build_route_name(buildreq.get_dist(),
buildreq.get_arch(),
buildreq.get_suite(),
buildreq.get_format())
try:
msg = jsonpickle.encode(buildreq)
self.message_chan.basic_publish(amqp.Message(msg),
exchange=pybit.exchange_name,
routing_key=routing_key,
mandatory=True)
except amqp.AMQPConnectionException as e:
logging.debug("Couldn't connect to channel. traceback: %s" % e)
def wait(self):
current_build_env = build_env_suite_arch.buildenv
current_packageinstance = self.process_packageinstance(current_build_env, current_arch, current_package, current_dist, current_format, current_suite, master_flag)
if current_packageinstance.id :
new_job = self.db.put_job(current_packageinstance,None)
if (new_job and new_job.id):
# self.log.debug("\nCREATED NEW JOB: %s\n", jsonpickle.encode(new_job))
self.cancel_superceded_jobs(new_job)
# NEW STUFF FOR RESUBMITTING JOBS
build_request_obj = BuildRequest(new_job,transport,
"%s:%s" % (self.settings['web']['hostname'], self.settings['web']['port']));
build_req = jsonpickle.encode(build_request_obj)
self.db.log_buildRequest(build_request_obj)
#print "SENDING REQUEST WITH DATA", str(build_req)
msg = amqp.Message(build_req)
msg.properties["delivery_mode"] = 2
routing_key = pybit.get_build_route_name(new_job.packageinstance.get_distribution_name(),
new_job.packageinstance.get_arch_name(),
new_job.packageinstance.get_suite_name(),
new_job.packageinstance.get_format_name())
build_queue = pybit.get_build_queue_name(new_job.packageinstance.get_distribution_name(),
new_job.packageinstance.get_arch_name(),
new_job.packageinstance.get_suite_name(),
new_job.packageinstance.get_format_name())
self.add_message_queue(build_queue, routing_key, chan)
chan.basic_publish(msg,exchange=pybit.exchange_name,routing_key=routing_key,mandatory=True)
#self.log.debug("\n____________SENDING %s ____________TO____________ %s", build_req, routing_key)
self.log.debug("SENDING BUILD REQUEST FOR JOB ID %i %s %s %s %s %s %s",
new_job.id,
new_job.packageinstance.get_distribution_name(),
new_job.packageinstance.get_package_version(),
new_job.packageinstance.get_distribution_name(),
def republish_job(self, buildreq):
if isinstance(buildreq, BuildRequest):
routing_key = pybit.get_build_route_name(buildreq.get_dist(), buildreq.get_arch(),
buildreq.get_suite(), buildreq.get_format())
try:
msg = jsonpickle.encode(buildreq)
self.message_chan.basic_publish(amqp.Message(msg), exchange=pybit.exchange_name,
routing_key=routing_key, mandatory=True)
except amqp.AMQPConnectionException as e:
logging.debug("Couldn't connect to channel. traceback: %s" % e)
self.state = "UNKNOWN"
self.arch = arch
self.distribution = distribution
self.pkg_format = pkg_format
self.listen_list = dict()
self.conn = None
self.command_chan = None
self.message_chan = None
self.settings = settings
self.poll_time = 60
self.distros = {}
self.handlers = {}
if 'poll_time' in self.settings:
self.poll_time = self.settings['poll_time']
for suite in suites:
route = pybit.get_build_route_name(self.distribution,
self.arch, suite, self.pkg_format)
queue = pybit.get_build_queue_name(self.distribution,
self.arch, suite, self.pkg_format)
self.listen_list[suite] = {
'route': route,
'queue': queue}
self.plugin_handler ()
self.conn_info = conn_info
if (self.distribution in self.distros):
self.format_handler = self.distros[self.distribution]
logging.info ("Using %s build client" % self.distribution)
elif (self.pkg_format == "deb" and "Debian" in self.distros) :
self.format_handler = self.distros['Debian']
logging.warning ("Using default Debian build client for %s package format" % self.pkg_format)
else:
self.state = "UNKNOWN"
self.arch = arch
self.distribution = distribution
self.pkg_format = pkg_format
self.listen_list = dict()
self.conn = None
self.command_chan = None
self.message_chan = None
self.settings = settings
self.poll_time = 60
self.distros = {}
self.handlers = {}
if 'poll_time' in self.settings:
self.poll_time = self.settings['poll_time']
for suite in suites:
route = pybit.get_build_route_name(self.distribution, self.arch, suite, self.pkg_format)
queue = pybit.get_build_queue_name(self.distribution, self.arch, suite, self.pkg_format)
self.listen_list[suite] = {
'route': route,
'queue': queue}
self.plugin_handler()
self.conn_info = conn_info
if self.distribution in self.distros:
self.format_handler = self.distros[self.distribution]
logging.info("Using %s build client" % self.distribution)
elif self.pkg_format == "deb" and "Debian" in self.distros:
self.format_handler = self.distros['Debian']
logging.warning("Using default Debian build client for %s package format" % self.pkg_format)
else:
logging.debug("Empty build client")
self.format_handler = None