def get_scheduler(self): try: ThisPlugin = SchedulerFactory(self.get_scheduler_type()) # I call the init without any parameter return ThisPlugin() except MissingPluginError as e: raise ConfigurationError('No scheduler found for {} [type {}], message: {}'.format( self.name, self.get_scheduler_type(), e.message))
def test_existing_schedulers(self): """ Test listing all preinstalled schedulers """ schedulers = all_plugins('schedulers') self.assertIsInstance(schedulers, list) for i in schedulers: self.assertTrue(issubclass(SchedulerFactory(i), Scheduler))
def test_existing_schedulers(self): """ Test listing all preinstalled schedulers """ entry_points = get_entry_points('aiida.schedulers') self.assertIsInstance(entry_points, list) for entry_point in entry_points: cls = SchedulerFactory(entry_point.name) self.assertTrue(issubclass(cls, Scheduler), 'Scheduler plugin class {} is not subclass of {}'.format(cls, Scheduler))
def test_existing_schedulers(self): """ Test listing all preinstalled schedulers """ schedulers = all_plugins('schedulers') self.assertIsInstance(schedulers, list) for i in schedulers: cls = SchedulerFactory(i) self.assertTrue( issubclass(cls, Scheduler), 'Scheduler plugin class {} is not subclass of {}'.format( cls, Scheduler))
def _shouldcall_default_mpiprocs_per_machine(self): """ Return True if the scheduler can accept 'default_mpiprocs_per_machine', False otherwise. If there is a problem in determining the scheduler, return True to avoid exceptions. """ try: SchedulerClass = SchedulerFactory(self.get_scheduler_type()) except MissingPluginError: # Return True if the Scheduler was not found... return True JobResourceClass = SchedulerClass._job_resource_class if JobResourceClass is None: # Odd situation... return False return JobResourceClass.accepts_default_mpiprocs_per_machine()