def notifyExecutorOperation(self, procId, operation, clientKey = "", clientMode = "" ): LOG("Notifying executor operation " + repr(operation) + ", " + repr(procId)) # Build the notification message msg = MsgHelper.createMessage(CtxMessages.MSG_EXEC_OP) msg[CtxMessages.FIELD_PROC_ID] = procId msg[CtxMessages.FIELD_EXOP] = operation msg[CtxMessages.FIELD_GUI_KEY] = clientKey msg[CtxMessages.FIELD_GUI_MODE] = clientMode msg[ExcMessages.FIELD_EXEC_STATUS] = self.getExecutor(procId).getStatus() msg[ExcMessages.FIELD_CONDITION] = self.getExecutor(procId).getCondition() msg[CtxMessages.FIELD_OPEN_MODE] = self.getExecutor(procId).getOpenMode() clientKeys = self.getClients() LOG("All clients: " + repr(clientKeys)) # Notify parent procedure also, if it is present executor = self.getExecutor(procId) if executor: parent = executor.getParent() if parent is not None: clientKeys += [parent] LOG("Notifying clients: " + repr(clientKeys)) if len(clientKeys)>0: self.messageToClients(procId, clientKeys, msg) LOG("Notifying executor operation done")
def buildExecutorInfo(self, procId, resp ): executor = self.getExecutor(procId) pname = ProcedureManager.instance().getProcedure(procId).name() if executor is None: txt = "No such executor: " + repr(procId) reason = " " resp[ExcMessages.FIELD_PROC_ID] = procId resp[ExcMessages.FIELD_PARENT_PROC] = " " resp[ExcMessages.FIELD_PROC_NAME] = pname resp[ExcMessages.FIELD_ASRUN_NAME] = " " resp[ExcMessages.FIELD_LOG_NAME] = " " resp[ExcMessages.FIELD_EXEC_PORT] = "0" resp[ExcMessages.FIELD_EXEC_STATUS] = server.executor.status.UNINIT resp[ExcMessages.FIELD_CONDITION] = "" resp[ExcMessages.FIELD_GUI_LIST] = " " resp[ExcMessages.FIELD_GUI_CONTROL] = " " resp[CtxMessages.FIELD_OPEN_MODE] = " " resp[ExcMessages.FIELD_LINE] = "0" resp[ExcMessages.FIELD_CSP] = procId else: control = executor.getControllingClient() if control is None: control = " " guiList = "" for gui in executor.getMonitoringClients(): if len(guiList)>0: guiList = guiList + "," guiList = guiList + str(gui) resp[ExcMessages.FIELD_PROC_ID] = procId resp[ExcMessages.FIELD_PARENT_PROC] = executor.getParent() resp[ExcMessages.FIELD_PROC_NAME] = pname resp[ExcMessages.FIELD_ASRUN_NAME] = executor.getAsRunFile() resp[ExcMessages.FIELD_LOG_NAME] = executor.getLogFile() resp[ExcMessages.FIELD_EXEC_PORT] = executor.getPort() resp[ExcMessages.FIELD_EXEC_STATUS] = executor.getStatus() resp[ExcMessages.FIELD_CONDITION] = executor.getCondition() resp[ExcMessages.FIELD_GUI_LIST] = guiList resp[ExcMessages.FIELD_GUI_CONTROL] = control resp[CtxMessages.FIELD_OPEN_MODE] = executor.getOpenMode() resp[ExcMessages.FIELD_CSP] = executor.getStackPosition() resp[ExcMessages.FIELD_ACTION_LABEL] = executor.getUserActionLabel() resp[ExcMessages.FIELD_ACTION_SEV] = executor.getUserActionSeverity() aen = executor.getUserActionEnabled() if aen: resp[ExcMessages.FIELD_ACTION_ENABLED] = "True" else: resp[ExcMessages.FIELD_ACTION_ENABLED] = "False" return resp