def run(self): if self.command.package_uuid: workdir = os.path.join(get_packages_dir(), self.command.package_uuid) else: workdir = get_packages_dir() output, exitcode = launcher(self.command.start_file, self.command.params, workdir) return (output, exitcode)
def startRPC(self, port, eventListenerPort): logging.basicConfig(filename='worldpay-within-wrapper.log', level=logging.DEBUG) reqOS = ["darwin", "win32", "windows", "linux"] reqArch = ["x64", "ia32"] cfg = launcher.Config(reqOS, reqArch) launcherLocal = launcher.launcher() if eventListenerPort > 0: callbackPortString = " -callbackport=" + str(eventListenerPort) else: callbackPortString = "" rpcAgentName = launcher2.getRpcAgentName() logging.debug( str(os.getcwd()) + "/worldpay-within-rpc-agent-bins/" + rpcAgentName + "-port " + str(port) + " -logfile wpwithin.log -loglevel debug,warn,error,fatal,info" + str(callbackPortString)) process = launcherLocal.launch( cfg, os.getcwd() + "/worldpay-within-rpc-agent-bins/" + rpcAgentName, "-port " + str(port) + " -logfile wpwithin.log -loglevel debug,warn,error,fatal,info" + str(callbackPortString)) return process
def _launch(self): _createDirIfNeeded(self.cwd) self.pd = launcher(self.pdbinary, self.args, cwd=self.cwd, doneCb=self._doneCb) self.pd.launch() if self.runningCb is not None: self.runningCb(True) self.shouldRun=True
def log(self, type_log, item='0'): log = Log(client=self.id, type=type_log, item=item) logging.debug(f'type: {type_log} files: {item}') # change this time if you want to receive repeated log more often interval_min = datetime.now() - timedelta(minutes=INTERVAL_LOG) previous_log = Log.objects( client=self.id, type=type_log, item=str( ','.join(item)), date__gte=interval_min) if not previous_log: new_log = Log.objects.create(client=self.id, type=type_log, item=str(','.join(item))) attrs = [self.mail, self.hostname, str( type_log), str(','.join(item))] logging.debug(attrs) launcher(attrs, remote=self.remote)
def pre_deploy_phase(self): if not self.config.Triggers.pre_deploy_active: return False base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] base_path = os.path.dirname(base_path) path = "%s/%s" % (self.config.Triggers.folder, self.config.Triggers.pre_deploy_script) logger.info("Script path: %s" % path) try: output, exitcode = launcher(path, '', base_path) except Exception, e: logger.error("Script error: %s" % e)
def pre_deploy_phase(self): if not self.config.Triggers.pre_deploy_active: return False base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] base_path = os.path.dirname(base_path) path = "%s/%s" % ( self.config.Triggers.folder, self.config.Triggers.pre_deploy_script) logger.info("Script path: %s" % path) try: output, exitcode = launcher(path, '', base_path) except Exception, e: logger.error("Script error: %s" % e)
def _execute(self): logger.info("Watchdog - re-locking the access !") base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: base_path = os.path.dirname(base_path) if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] path = "%s/%s" % (self.triggers_folder, self.post_deploy_script) logger.info("Script path: %s" % path) output, exitcode = launcher(path, '', base_path) logger.debug("Script output: %s" % output) if exitcode == 0: logger.info("\033[31mMachine locked\033[0m") self.scheduled_to = None
def _execute(self): logger.info("Watchdog - re-locking the access !") base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: base_path = os.path.dirname(base_path) if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] path = "%s/%s" % ( self.triggers_folder, self.post_deploy_script) logger.info("Script path: %s" % path) output, exitcode = launcher(path, '', base_path) logger.debug("Script output: %s" % output) if exitcode == 0: logger.info("\033[31mMachine locked\033[0m") self.scheduled_to = None
def run(self): self.restore_state() # Wait before polling: # This is usefull when the agent is deployed in push mode, so it let the # push deployment finish before acting as a pull client #self.stop.wait(self.config.Poller.wait_poll) while not self.stop.is_set(): if self.last_update_ts is None or (time.time() - self.last_update_ts) > 3 * 60: logger.info("Checking for agent updates **** ...") self.last_update_ts = time.time() base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] base_path = os.path.dirname(base_path) try: output, exitcode = launcher('triggers/update.sh', '', base_path) except Exception, e: logger.error("Script error: %s" % e) logger.debug("Script output: %s" % output) if exitcode == 0: logger.info("Update success.") elif exitcode == 42: logger.info("Already on latest version.") else: logger.info("Update error.") else: logger.info("Polling for new commands") for cmd_dict in self.dlp_client.get_commands(): if self.is_new_command(cmd_dict): if self.pre_deploy_phase(): break command = Command( cmd_dict, (self.parallel_queue, self.simple_queue), self.dlp_client) self.commands.append(command) logger.info("Status:\n%s" % "\n".join(map(str, self.commands))) self.stop.wait(self.config.Poller.poll_interval)
def run(self): self.restore_state() # Wait before polling: # This is usefull when the agent is deployed in push mode, so it let the # push deployment finish before acting as a pull client #self.stop.wait(self.config.Poller.wait_poll) while not self.stop.is_set(): if self.last_update_ts is None or (time.time() - self.last_update_ts) > 3 * 60: logger.info("Checking for agent updates **** ...") self.last_update_ts = time.time() base_path = os.path.dirname(os.path.abspath(__file__)) if "library.zip" in base_path: if base_path.endswith("\\") or base_path.endswith("/"): base_path = base_path[:-1] base_path = os.path.dirname(base_path) try: output, exitcode = launcher('triggers/update.sh', '', base_path) except Exception, e: logger.error("Script error: %s" % e) logger.debug("Script output: %s" % output) if exitcode == 0: logger.info("Update success.") elif exitcode == 42: logger.info("Already on latest version.") else: logger.info("Update error.") else: logger.info("Polling for new commands") for cmd_dict in self.dlp_client.get_commands(): if self.is_new_command(cmd_dict): if self.pre_deploy_phase(): break command = Command(cmd_dict, (self.parallel_queue, self.simple_queue), self.dlp_client) self.commands.append(command) logger.info("Status:\n%s" % "\n".join(map(str, self.commands))) self.stop.wait(self.config.Poller.poll_interval)
def startRPC(self, port, eventListenerPort): logging.basicConfig(filename='worldpay-within-wrapper.log',level=logging.DEBUG) reqOS = ["darwin", "win32", "windows", "linux"] reqArch = ["x64", "ia32"] cfg = launcher.Config(reqOS, reqArch); launcherLocal = launcher.launcher() # define log file name for rpc agent, so e.g # for "runConsumerOWP.py" it will be: "rpc-wpwithin-runConsumerOWP.log" logfilename = os.path.basename(sys.argv[0]) logfilename = "rpc-wpwithin-" + logfilename.rsplit(".", 1)[0] + ".log" args = [] if eventListenerPort > 0: logging.debug(str(os.getcwd()) + "" + "-port " + str(port) + " -logfile " + logfilename + " -loglevel debug,warn,error,fatal,info" + " -callbackport " + str(eventListenerPort)) args = ['-port', str(port), '-logfile', logfilename, '-loglevel', 'debug,warn,error,fatal,info', '-callbackport', str(eventListenerPort)] else: logging.debug(str(os.getcwd()) + "" + "-port " + str(port) + " -logfile " + logfilename + " -loglevel debug,warn,error,fatal,info") args = ['-port', str(port), '-logfile', logfilename, '-loglevel', 'debug,warn,error,fatal,info'] process = launcherLocal.launch(cfg, os.getcwd() + "", args) return process
def fromlauncher(self): # Do launcher Stuff..... if not common.bypasslauncher: l = launcher.launcher() if common.running: l.renderLoadingScreen() if common.inlauncher == True: self.cleanup() # Load world graphics.level = levelparser.level(os.path.join(common.rootdir, "saves", common.levelname, "level.json")) common.g.tilemap = graphics.level.parseTiles() common.maph = len(common.g.tilemap[0])*common.tilewidth common.mapw = len(common.g.tilemap)*common.tilewidth # Initialize pause menu common.pausemenu = settings.pausemenu() # Create the chatbox common.cb = chatbox(10,common.height-25,500,20) common.cb.hide = True # go to mainloop self.loop()
gunshots.append(pygame.mixer.Sound("sounds/gunshot_04.wav")) akSound = pygame.mixer.Sound("sounds/ak.wav") akSoundLong = pygame.mixer.Sound("sounds/aklong.wav") # GUNSOUNDS PÄRIT LEHEL FREESPECIALEFFECTS # http://www.freespecialeffects.co.uk/pages/weapons.html # SOUNDTRACK: Thomas the dank engine :D pygame.mixer.music.load("sounds/aylmao.mp3") pygame.mixer.music.play() x = 0 # Initial map scroll position y = 0 pygame.mouse.set_cursor(*pygame.cursors.broken_x) # Muudab hiirekursori sihikulaadseks X täheks launcher.launcher(screen, displayInfo) Exit = False while not Exit: startTime = time.time() for i in pygame.event.get(): if i.type == pygame.QUIT: Exit = True elif i.type == pygame.KEYDOWN: if i.key == pygame.K_ESCAPE: Exit = True elif i.key == pygame.K_f: pygame.display.toggle_fullscreen() elif(not gameObjects.playerHP.hasRifle): if i.type == pygame.MOUSEBUTTONDOWN and i.button == 1: # 1 bullet per klikk gameObjects.makeBullet(displayInfo)
def abrirVentana4(self): d = launcher() d.show() d.exec_()