def setup(self, executor, initialStatus, ctxName=None, contextPort=None): self.executor = executor self.useContext = (ctxName != None) self.contextPort = contextPort failMode = (initialStatus == server.executor.status.ERROR) LOG("Setting up UI remote client interface (fail mode = " + repr(failMode) + ", useContext=" + repr(self.useContext) + ")") ClientInterfaceBase.setup(self, ctxName, failMode) if self.useContext: LOG("Setting up controller IO channel") self.__ctxIFC.connect("localhost", self.contextPort, self.executor.processMessage, self.executor.processRequest, self.executor.connectionLost) csp = executor.procId if "#" in csp: idx = csp.find("#") csp = csp[0:idx] response = None if self.useContext: LOG("Send login message to context") msg = MessageClass() msg.setType(MSG_TYPE_REQUEST) msg.setId(ExcMessages.REQ_NOTIF_EXEC_OPEN) msg.setSender(executor.procId) msg.setReceiver("CTX") msg[ExcMessages.FIELD_PROC_ID] = executor.procId msg[ExcMessages.FIELD_CSP] = csp msg[ExcMessages.FIELD_EXEC_STATUS] = initialStatus msg[ExcMessages.FIELD_EXEC_PORT] = 0 msg[ExcMessages.FIELD_ASRUN_NAME] = self._getAsRun() msg[ExcMessages.FIELD_LOG_NAME] = LOG.getLogFile().name if failMode: msg[FIELD_ERROR] = self.executor.errorMessage msg[FIELD_REASON] = self.executor.errorReason response = self.__ctxIFC.sendRequest(msg) LOG("Logged in context") else: LOG("Creating command line interface") cmdline = CommandShell() cmdline.start() self.ready = True return response
def setup(self, executor, initialStatus, ctxName = None, contextPort = None ): self.executor = executor self.useContext = (ctxName != None) self.contextPort = contextPort failMode = (initialStatus == server.executor.status.ERROR) LOG("Setting up UI remote client interface (fail mode = " + repr(failMode) + ", useContext=" + repr(self.useContext) + ")") ClientInterfaceBase.setup(self, ctxName, failMode) if self.useContext: LOG("Setting up controller IO channel") self.__ctxIFC.connect("localhost", self.contextPort, self.executor.processMessage, self.executor.processRequest, self.executor.connectionLost ) csp = executor.procId if "#" in csp: idx = csp.find("#") csp = csp[0:idx] response = None if self.useContext: LOG("Send login message to context") msg = MessageClass() msg.setType(MSG_TYPE_REQUEST) msg.setId(ExcMessages.REQ_NOTIF_EXEC_OPEN) msg.setSender(executor.procId) msg.setReceiver("CTX") msg[ExcMessages.FIELD_PROC_ID] = executor.procId msg[ExcMessages.FIELD_CSP] = csp msg[ExcMessages.FIELD_EXEC_STATUS] = initialStatus msg[ExcMessages.FIELD_EXEC_PORT] = 0 msg[ExcMessages.FIELD_ASRUN_NAME] = self._getAsRun() msg[ExcMessages.FIELD_LOG_NAME] = LOG.getLogFile().name if failMode: msg[FIELD_ERROR] = self.executor.errorMessage msg[FIELD_REASON] = self.executor.errorReason response = self.__ctxIFC.sendRequest(msg) LOG("Logged in context") else: LOG("Creating command line interface") cmdline = CommandShell() cmdline.start() self.ready = True return response
def setup(self, ctxName): ClientInterfaceBase.setup(self, ctxName) LOG("Command line test CIF setup") self.ready = True