def start(self): if self.forbid_restart: return devnull = open(os.devnull, 'w') # worker output redirected to null; useful info comes via messages and logs self.process = subprocess.Popen( ['python', remote.__file__, self.id, self.appliance.as_json, conf.runtime['env']['ts']], stdout=devnull, ) at_exit(self.process.kill)
def start(self): if self.forbid_restart: return devnull = open(os.devnull, 'w') # worker output redirected to null; useful info comes via messages and logs self.process = subprocess.Popen( ['python', remote.__file__, self.id, self.appliance.as_json, conf.runtime['env']['ts']], stdout=devnull, ) at_exit(self.process.kill)
def start(self): if self.forbid_restart: return devnull = open(os.devnull, 'w') # worker output redirected to null; useful info comes via messages and logs self.process = subprocess.Popen([ sys.executable, remote.__file__, '--worker', self.id, '--appliance', self.appliance.as_json, '--ts', conf.runtime['env']['ts'], '--config', json.dumps(self.worker_config), ], stdout=devnull) at_exit(self.process.kill) at_exit(devnull.close)
def request_appliances(self, provision_request): self.request_pool(provision_request) try: result = wait_for(self.check_fullfilled, num_sec=provision_request.provision_timeout * 60, delay=5, message="requesting appliances was fulfilled") except Exception: pool = self.request_check() dump_pool_info(log, pool) log.debug("Destroying the pool on error.") self.destroy_pool() raise else: at_exit(self.destroy_pool) pool = self.request_check() dump_pool_info(log, pool) log.info("Provisioning took %.1f seconds", result.duration) return pool["appliances"]
def request_appliances(self, provision_request): self.request_pool(provision_request) try: result = wait_for( self.check_fullfilled, num_sec=provision_request.provision_timeout * 60, delay=5, message="requesting appliances was fulfilled" ) except Exception: pool = self.request_check() dump_pool_info(log, pool) log.debug("Destroying the pool on error.") self.destroy_pool() raise else: at_exit(self.destroy_pool) pool = self.request_check() dump_pool_info(log, pool) log.info("Provisioning took %.1f seconds", result.duration) return pool["appliances"]