def _iter_datasource_items(self, item, metadata_dict, entries, location_list, obj_dict): job_info_path = os.path.join(item, 'job.info') try: job_info_dict = DictFormat('=').parse(open(job_info_path)) if job_info_dict.get('exitcode') == 0: obj_dict['JOBINFO'] = job_info_dict yield (item, metadata_dict, entries, location_list, obj_dict) except Exception: self._log.log(logging.INFO2, 'Unable to parse job info file %r', job_info_path) clear_current_exception()
def _parse(self, proc): for section in accumulate(proc.stdout.iter(self._timeout), '', lambda x, buf: x == '\n'): try: lines = section.replace('\n\t', '').split('\n') job_info = DictFormat(' = ').parse(lines[1:]) job_info[CheckInfo.WMSID] = lines[0].split(':')[1].split('.')[0].strip() job_info[CheckInfo.RAW_STATUS] = job_info.pop('job_state') job_info[CheckInfo.QUEUE] = job_info.pop('queue', None) if 'exec_host' in job_info: exec_host = job_info.pop('exec_host').split('/')[0] job_info[CheckInfo.WN] = exec_host + '.' + job_info.get('server', '') except Exception: raise BackendError('Error reading job info:\n%s' % section) yield job_info
def _parse(self, proc): for section in accumulate(proc.stdout.iter(self._timeout), '', lambda x, buf: x == '\n'): try: lines = section.replace('\n\t', '').split('\n') job_info = DictFormat(' = ').parse(lines[1:]) job_info[CheckInfo.WMSID] = lines[0].split(':')[1].split( '.')[0].strip() job_info[CheckInfo.RAW_STATUS] = job_info.pop('job_state') job_info[CheckInfo.QUEUE] = job_info.pop('queue', None) if 'exec_host' in job_info: exec_host = job_info.pop('exec_host').split('/')[0] job_info[CheckInfo.WN] = exec_host + '.' + job_info.get( 'server', '') except Exception: raise BackendError('Error reading job info:\n%s' % section) yield job_info