def setup_stomp(): global stomp logging.info("Getting Stomp Connection:") try: stomp = getNewStompConnection('', StatsListener()) except: logging.error("setup_stomp(): Cannot connect.") raise
def increment_the_variable(self): try: self.stompClient = getNewStompConnection('', ConnectionListener()) except: log.error(''' Cannot connect to Stomp; make sure you're running a local ActiveMQ instance. You can start a docker container with ActiveMQ using the following : `docker run --name='activemq' -d -p 8161:8161 -p 61616:61616 -p 61613:61613 rmohr/activemq:5.10.0` ''') sys.exit(1)
def increment_the_variable(self): try: self.stompClient = getNewStompConnection('', ConnectionListener()) except: log.error(''' Cannot connect to Stomp; make sure you're running a local ActiveMQ instance. You can start a docker container with ActiveMQ using the following : `docker run --name='activemq' -d -p 8161:8161 -p 61616:61616 -p 61613:61613 rmohr/activemq:5.10.0` ''' ) sys.exit(1)
obj = {} issue_id = sys.argv[1] url = sys.argv[2] segs = url.split("/") pkgname = segs[4] pkgname_bare = pkgname.split("_")[0] obj['force'] = True obj['bioc_version'] = BIOC_VERSION obj['r_version'] = BIOC_R_MAP[BIOC_VERSION] obj['svn_url'] = url obj['repository'] = 'scratch' now = pacific.localize(now0) timestamp1 = now.strftime("%Y%m%d%H%M%S") timestamp2 = now.strftime("%a %b %d %Y %H:%M:%S") timestamp2 = timestamp2 + " GMT-%s (%s)" % (offset, tzname) obj['job_id'] = "%s_%s" % (pkgname_bare, timestamp1) obj['time'] = timestamp2 obj['client_id'] = "single_package_builder_autobuild:%s:%s" % (issue_id, pkgname) json = json.dumps(obj) logging.debug("Received JSON object: '%s'", json) try: stomp = getNewStompConnection('', MyListener()) except: logging.info("Cannot connect") raise this_frame = stomp.send(TOPICS['jobs'], json)
blderProcess.wait() logging.info( "on_message() blderProcess finished with status {s}.".format( s=blderProcess.returncode)) builder_log.close() logging.info("on_message() builder_log closed.") except Exception as e: logging.error("on_message() Caught exception: {e}".format(e=e)) return () else: logging.error("on_message() Invalid JSON: missing job_id key.") try: logging.debug("Attempting to connect using new communication module") stomp = getNewStompConnection('', MyListener()) logging.info("Connection established using new communication module") stomp.subscribe(destination=TOPICS['jobs'], id=uuid.uuid4().hex, ack='auto') logging.info("Subscribed to destination %s" % TOPICS['jobs']) stomp.subscribe(destination="/topic/keepalive", id=uuid.uuid4().hex, ack='auto') logging.info("Subscribed to %s" % "/topic/keepalive") except Exception as e: logging.error("main() Could not connect to RabbitMQ: %s." % e) raise logging.info('Waiting for messages; CTRL-C to exit.')