def create_defaults(default_job_launcher=JOB_LAUNCHER_QSUB): """Creates test-specific defaults so we don't tie the tests to changes in the real defaults""" defaults = { 'cheyenne': MachineDefaults( job_launcher_type=default_job_launcher, scratch_dir=os.path.join(os.path.sep, 'glade', 'scratch', get_user()), baseline_dir=os.path.join(os.path.sep, 'my', 'baselines'), account_required=True, create_test_retry=2, create_test_queue="regular", job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='regular', walltime='06:00:00', extra_args='', required_args= '-l select=1:ncpus=36:mpiprocs=1 -r n -l inception=login' ) }) } return defaults
def test_knownMachine_defaults(self): """Tests a machine known in the defaults structure, with no overriding arguments""" defaults = self.create_defaults() machine = create_machine('cheyenne', defaults, account='a123') self.assertMachineInfo(machine=machine, name='cheyenne', scratch_dir=os.path.join( os.path.sep, 'glade', 'scratch', get_user()), account='a123') self.assertQsubInfo( machine=machine, queue='regular', walltime='06:00:00', account='a123', required_args= '-l select=1:ncpus=36:mpiprocs=1 -r n -l inception=login', extra_args='')
# account_required: bool: whether an account number is required on this machine (not # really a default, but used for error-checking) # Note that the different job launcher types have different structures defining their # defaults, because different ones require different elements to be set. For now we only # have defaults for qsub, because other launchers (like no_batch) don't need any # arguments. QsubDefaults = namedtuple('QsubDefaults', ['queue', 'walltime', 'extra_args', 'required_args']) MACHINE_DEFAULTS = { 'cheyenne': MachineDefaults( job_launcher_type=JOB_LAUNCHER_QSUB, scratch_dir=os.path.join(os.path.sep, 'glade', 'scratch', get_user()), baseline_dir=os.path.join(os.path.sep, 'glade', 'p', 'cgd', 'tss', 'ctsm_baselines'), account_required=True, create_test_retry=0, job_launcher_defaults={ JOB_LAUNCHER_QSUB: QsubDefaults( queue='regular', walltime='11:50:00', extra_args='', # The following assumes a single node, with a single mpi proc; we may want # to add more flexibility in the future, making the node / proc counts # individually selectable required_args= '-l select=1:ncpus=36:mpiprocs=1 -V -r n -l inception=login -k oed'