Example #1
0
    def check(self):

        # Analyze the stderr and stdout files of the resource manager system.
        qerr_info = None
        qout_info = None
        if os.path.exists(self.qerr_filepath):
            with open(self.qerr_filepath, "r") as f:
                qerr_info = f.read()
        if os.path.exists(self.qout_filepath):
            with open(self.qout_filepath, "r") as f:
                qout_info = f.read()

        self.timelimit_error = None
        self.queue_errors = None
        if qerr_info or qout_info:
            from pymatgen.io.abinit.scheduler_error_parsers import get_parser
            qtype = self.queue_adapter.QTYPE
            scheduler_parser = get_parser(qtype, err_file=self.qerr_filepath,
                                          out_file=self.qout_filepath)

            if scheduler_parser is None:
                raise ValueError('Cannot find scheduler_parser for qtype {}'.format(qtype))

            scheduler_parser.parse()
            self.queue_errors = scheduler_parser.errors

            for error in self.queue_errors:
                if isinstance(error, TimeCancelError):
                    logger.debug('found timelimit error.')
                    self.timelimit_error = error
                    return True
        return False
 def test_get_parser(self):
     """
     Testing the get parser API
     """
     for (scheduler) in ALL_PARSERS:
         err_file = 'dummy'
         parser = get_parser(scheduler, err_file=err_file)
         self.assertIsInstance(parser.files, dict)
         self.assertIsInstance(parser.errors, list)
         self.assertIsInstance(parser.error_definitions, dict)
         self.assertEqual(parser.parse(), len(parser.error_definitions))
 def test_get_parser(self):
     """
     Testing the get parser API
     """
     for (scheduler) in ALL_PARSERS:
         err_file = 'dummy'
         parser = get_parser(scheduler, err_file=err_file)
         self.assertIsInstance(parser.files, dict)
         self.assertIsInstance(parser.errors, list)
         self.assertIsInstance(parser.error_definitions, dict)
         self.assertEqual(parser.parse(), len(parser.error_definitions))
 def check(self):
     """
     Check for the defined errors, put all found errors in self.errors, return True if any were found False if no
     errors were found
     """
     parser = get_parser(self.scheduler_adapter.name, err_file=self.err_file, out_file=self.out_file,
                         run_err_file=self.run_err_file, batch_err_file=self.batch_err_file)
     parser.parse()
     self.errors = parser.errors
     if len(self.errors) == 0:
         return False
     else:
         return True
Example #5
0
    def check(self):

        # Analyze the stderr and stdout files of the resource manager system.
        qerr_info = None
        qout_info = None
        if os.path.exists(self.qerr_filepath):
            with open(self.qerr_filepath, "r") as f:
                qerr_info = f.read()
        if os.path.exists(self.qout_filepath):
            with open(self.qout_filepath, "r") as f:
                qout_info = f.read()

        self.memory_error = None
        self.queue_errors = None
        if qerr_info or qout_info:
            from pymatgen.io.abinit.scheduler_error_parsers import get_parser
            qtype = self.queue_adapter.QTYPE
            scheduler_parser = get_parser(qtype,
                                          err_file=self.qerr_filepath,
                                          out_file=self.qout_filepath)

            if scheduler_parser is None:
                raise ValueError(
                    'Cannot find scheduler_parser for qtype {}'.format(qtype))

            scheduler_parser.parse()
            self.queue_errors = scheduler_parser.errors

            #TODO: handle the cases where it is Master or Slave here ... ?
            for error in self.queue_errors:
                if isinstance(error, MemoryCancelError):
                    logger.debug('found memory error.')
                    self.memory_error = error
                    return True
                if isinstance(error, MasterProcessMemoryCancelError):
                    logger.debug('found master memory error.')
                    self.memory_error = error
                    return True
                if isinstance(error, SlaveProcessMemoryCancelError):
                    logger.debug('found slave memory error.')
                    self.memory_error = error
                    return True
        return False
Example #6
0
    def check(self):

        # Analyze the stderr and stdout files of the resource manager system.
        qerr_info = None
        qout_info = None
        if os.path.exists(self.qerr_filepath):
            with open(self.qerr_filepath, "r") as f:
                qerr_info = f.read()
        if os.path.exists(self.qout_filepath):
            with open(self.qout_filepath, "r") as f:
                qout_info = f.read()

        self.memory_error = None
        self.queue_errors = None
        if qerr_info or qout_info:
            from pymatgen.io.abinit.scheduler_error_parsers import get_parser
            qtype = self.queue_adapter.QTYPE
            scheduler_parser = get_parser(qtype, err_file=self.qerr_filepath,
                                          out_file=self.qout_filepath)

            if scheduler_parser is None:
                raise ValueError('Cannot find scheduler_parser for qtype {}'.format(qtype))

            scheduler_parser.parse()
            self.queue_errors = scheduler_parser.errors

            #TODO: handle the cases where it is Master or Slave here ... ?
            for error in self.queue_errors:
                if isinstance(error, MemoryCancelError):
                    logger.debug('found memory error.')
                    self.memory_error = error
                    return True
                if isinstance(error, MasterProcessMemoryCancelError):
                    logger.debug('found master memory error.')
                    self.memory_error = error
                    return True
                if isinstance(error, SlaveProcessMemoryCancelError):
                    logger.debug('found slave memory error.')
                    self.memory_error = error
                    return True
        return False