def handle_lifecycle_control(self, ctrl): """ participant control thread """ if ctrl.message == "start": self.worker_config = dap(worker_config(config=ctrl.config)) self.launcher = Launcher( amqp_host=ctrl.config.get("boss", "amqp_host"), amqp_user=ctrl.config.get("boss", "amqp_user"), amqp_pass=ctrl.config.get("boss", "amqp_pwd"), amqp_vhost=ctrl.config.get("boss", "amqp_vhost"))
def handle_lifecycle_control(self, ctrl): if ctrl.message == "start": self.config = tester_config(config=ctrl.config) self.launcher = Launcher(amqp_host = ctrl.config.get("boss", "amqp_host"), amqp_user = ctrl.config.get("boss", "amqp_user"), amqp_pass = ctrl.config.get("boss", "amqp_pwd"), amqp_vhost = ctrl.config.get("boss", "amqp_vhost") )
def launch(process, fields): """ BOSS process launcher :param process: process definition :param fields: dict of workitem fields """ launcher = Launcher(amqp_host=settings.boss_host, amqp_user=settings.boss_user, amqp_pass=settings.boss_pass, amqp_vhost=settings.boss_vhost) fields.update({"priority": "high"}) launcher.launch(process, fields)
def launch(process, fields): """ BOSS process launcher :param process: process definition file :param fields: dict of workitem fields """ with open(process, mode='r') as process_file: pdef = process_file.read() launcher = Launcher(amqp_host=settings.BOSS_HOST, amqp_user=settings.BOSS_USER, amqp_pass=settings.BOSS_PASS, amqp_vhost=settings.BOSS_VHOST) print "launching to (%s,%s)" % (settings.BOSS_HOST, settings.BOSS_VHOST) launcher.launch(pdef, fields)
else "" for line in config_file.readlines()] pconf = json.loads("\n".join(lines)) print "Found valid conf %s.conf" % pdef[:-5] except IOError as exc: # we don't care if there is no .conf file # so we ignore errorcode 2 which is file not found # otherwise print the error and don't launch the process if not exc.errno == 2: raise if workitem: wid = open(workitem).read() pconf.update(json.loads(wid)) config = ConfigParser.ConfigParser({ "amqp_host": "127.0.0.1:5672", "amqp_user": "******", "amqp_pwd": "boss", "amqp_vhost": "boss" }) if os.path.exists("/etc/skynet/skynet.conf"): config.readfp(open('/etc/skynet/skynet.conf')) launcher = Launcher(amqp_host=config.get("boss", "amqp_host"), amqp_user=config.get("boss", "amqp_user"), amqp_pass=config.get("boss", "amqp_pwd"), amqp_vhost=config.get("boss", "amqp_vhost")) launcher.launch(process, pconf)