def messages(self, tid): """Return task's messages.""" # Make sure we read the messages, even if we throw them away # later to prevent the task from blocking. messages = Task.messages(self, tid) # Strip out all formal messages. name = self._params[tid].name.upper() start = '%-5s%c' % (name, ehex(self._popsno[tid])) messages = [msg for msg in messages if not msg.startswith(start)] messages = [(1, msg) for msg in messages] user = ehex(self._userno[tid], 3, 0) ms_name = os.environ['DA01'] + '/MS' + AIPS.revision \ + user + '000.' + user + ';' ms_file = open(ms_name, mode='rb') (msgno,) = struct.unpack('i', ms_file.read(4)) while self._msgno[tid] < msgno: (task, popsno, priority, msg) = \ self.__read_message(ms_file, self._msgno[tid]) # Filter if popsno == self._popsno[tid]: msg = '%-5s%c: %s' % (task, ehex(popsno), msg) messages.append((priority, msg)) pass self._msgno[tid] += 1 continue ms_file.close() return messages
def messages(self, tid): """Return task's messages.""" # Make sure we read the messages, even if we throw them away # later to prevent the task from blocking. messages = Task.messages(self, tid) # Strip out all formal messages. start = '%-5s%d' % (self._params[tid].name.upper(), self._popsno[tid]) messages = [msg for msg in messages if not msg.startswith(start)] messages = [(1, msg) for msg in messages] user = ehex(self._userno[tid], 3, 0) ms_name = os.environ['DA01'] + '/MS' + AIPS.revision \ + user + '000.' + user + ';' ms_file = open(ms_name, mode='r') (msgno,) = struct.unpack('i', ms_file.read(4)) while self._msgno[tid] < msgno: (task, popsno, priority, msg) = \ self.__read_message(ms_file, self._msgno[tid]) # Filter if popsno == self._popsno[tid]: messages.append((priority, '%-5s%d: %s' % (task, popsno, msg))) pass self._msgno[tid] += 1 continue ms_file.close() return messages
def messages(self, tid): """Return task's messages. Return a list of messages each as a tuple (1, message) tid = Task id in pid table of process """ # Make sure we read the messages, even if we throw them away # later to prevent the task from blocking. messages = Task.messages(self, tid) #print "Raw",messages # Check that tid in bounds #if tid>len(self._popsno): # print "DEBUG Proxy/AIPSTask", messages, tid, len(self._popsno) # return messages # Convert into list of lines tmessage = [] for msg in messages: lmess = msg.splitlines(True) for mm in lmess: tmessage.append(mm) # Strip out all formal messages. start = '%-5s%d' % (self._params[tid].name.upper(), self._popsno[tid]) lmessages = [msg for msg in tmessage if msg.startswith(start)] #print "Filtered",lmessages pmessages = [msg for msg in tmessage if not msg.startswith(start)] #print "Print",pmessages # These messages will be looked up in the AIPS message log #messages = [(1, msg) for msg in lmessages] messages = [] user = ehex(self._userno[tid], 3, 0) ms_name = os.environ['DA01'] + '/MS' + AIPS.revision \ + user + '000.' + user + ';' ms_file = open(ms_name, mode='r') (msgno,) = struct.unpack('i', ms_file.read(4)) while self._msgno[tid] < msgno: (task, popsno, priority, msg) = \ self.__read_message(ms_file, self._msgno[tid]) # Filter if popsno == self._popsno[tid]: messages.append((priority, '%-5s%d: %s\n' % (task, popsno, msg))) pass self._msgno[tid] += 1 continue ms_file.close() # Add "print" messages if len(pmessages)>0: for msg in pmessages: messages.append((1,msg)) #print "returned messages",messages return messages
def messages(self, tid): """Return task's messages. Return a list of messages each as a tuple (1, message) tid = Task id in pid table of process """ # Add a default priority to the messages messages = Task.messages(self, tid) return [(1, msg) for msg in messages]
def messages(self, tid): """Return script's messages. Return a list of messages each as a tuple (1, message) tid = Script id in pid table of process """ # Make sure we read the messages, even if we throw them away # later to prevent the script from blocking. messages = Task.messages(self, tid) return [(1, msg) for msg in messages]
def messages(self, tid): """Return task's messages.""" # Add a default priority to the messages messages = Task.messages(self, tid) return [(1, msg) for msg in messages]