def submitSlaveJob(self, cmdArgs, slaveEnv, logDir, submissionRules, jobType): outputFile, errorsFile = submissionRules.getJobFiles() try: process = subprocess.Popen(cmdArgs, stdout=open(os.path.join(logDir, outputFile), "w"), stderr=open(os.path.join(logDir, errorsFile), "w"), cwd=logDir, env=self.getSlaveEnvironment(slaveEnv), startupinfo=plugins.getHideStartUpInfo()) errorMessage = None except OSError, e: errorMessage = "Failed to start slave process : " + str(e)
def submitSlaveJob(self, cmdArgs, slaveEnv, logDir, submissionRules, jobType): try: process = subprocess.Popen(cmdArgs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=logDir, env=self.getSlaveEnvironment(slaveEnv), startupinfo=plugins.getHideStartUpInfo()) stdout, stderr = process.communicate() errorMessage = self.findErrorMessage(stderr, cmdArgs, jobType) except OSError: errorMessage = self.getFullSubmitError("local machine is not a submit host: running '" + cmdArgs[0] + "' failed.", cmdArgs, jobType) if errorMessage: return None, errorMessage else: return self.findJobId(stdout), None
def submitSlaveJob(self, cmdArgs, slaveEnv, logDir, submissionRules, jobType): outputFile, errorsFile = submissionRules.getJobFiles() stdout = open(os.path.join(logDir, outputFile), "w") stderr = open(os.path.join(logDir, errorsFile), "w") createflags = subprocess.CREATE_NEW_PROCESS_GROUP if os.name == "nt" else 0 try: process = subprocess.Popen(cmdArgs, stdout=stdout, stderr=stderr, cwd=logDir, env=self.getSlaveEnvironment(slaveEnv), startupinfo=plugins.getHideStartUpInfo(), creationflags=createflags) errorMessage = None except OSError as e: stdout.close() stderr.close() errorMessage = "Failed to start slave process : " + str(e) if errorMessage: return None, self.getFullSubmitError(errorMessage, cmdArgs, jobType) else: jobId = str(process.pid) self.processes[jobId] = process return jobId, None
def getProcessStartUpInfo(self, test): # Used for hiding the windows if we're on Windows! if os.name == "nt" and test.getConfigValue("virtual_display_hide_windows") == "true" and \ not test.app.isRecording() and not test.app.isActionReplay(): return plugins.getHideStartUpInfo()
def runTaskKill(self, proc, extraArgs=[]): return subprocess.call([ "taskkill" ] + extraArgs + [ "/PID", str(proc.pid) ], stdout=open(os.devnull, "w"), stderr=subprocess.STDOUT, startupinfo=plugins.getHideStartUpInfo()) == 0