本文整理汇总了Python中CIME.XML.machines.Machines.has_batch_system方法的典型用法代码示例。如果您正苦于以下问题:Python Machines.has_batch_system方法的具体用法?Python Machines.has_batch_system怎么用?Python Machines.has_batch_system使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.machines.Machines
的用法示例。
在下文中一共展示了Machines.has_batch_system方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestScheduler
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import has_batch_system [as 别名]
class TestScheduler(object):
###############################################################################
###########################################################################
def __init__(self, test_names, test_data=None,
no_run=False, no_build=False, no_setup=False, no_batch=None,
test_root=None, test_id=None,
machine_name=None, compiler=None,
baseline_root=None, baseline_cmp_name=None, baseline_gen_name=None,
clean=False, namelists_only=False,
project=None, parallel_jobs=None,
walltime=None, proc_pool=None,
use_existing=False, save_timing=False, queue=None,
allow_baseline_overwrite=False, output_root=None,
force_procs=None, force_threads=None, mpilib=None,
input_dir=None, pesfile=None, mail_user=None, mail_type=None):
###########################################################################
self._cime_root = CIME.utils.get_cime_root()
self._cime_model = get_model()
self._save_timing = save_timing
self._queue = queue
self._test_data = {} if test_data is None else test_data # Format: {test_name -> {data_name -> data}}
self._mpilib = mpilib # allow override of default mpilib
self._completed_tests = 0
self._input_dir = input_dir
self._pesfile = pesfile
self._allow_baseline_overwrite = allow_baseline_overwrite
self._mail_user = mail_user
self._mail_type = mail_type
self._machobj = Machines(machine=machine_name)
self._model_build_cost = 4
# If user is forcing procs or threads, re-write test names to reflect this.
if force_procs or force_threads:
test_names = _translate_test_names_for_new_pecount(test_names, force_procs, force_threads)
self._no_setup = no_setup
self._no_build = no_build or no_setup or namelists_only
self._no_run = no_run or self._no_build
self._output_root = output_root
# Figure out what project to use
if project is None:
self._project = CIME.utils.get_project()
if self._project is None:
self._project = self._machobj.get_value("PROJECT")
else:
self._project = project
# We will not use batch system if user asked for no_batch or if current
# machine is not a batch machine
self._no_batch = no_batch or not self._machobj.has_batch_system()
expect(not (self._no_batch and self._queue is not None),
"Does not make sense to request a queue without batch system")
# Determine and resolve test_root
if test_root is not None:
self._test_root = test_root
elif self._output_root is not None:
self._test_root = self._output_root
else:
self._test_root = self._machobj.get_value("CIME_OUTPUT_ROOT")
if self._project is not None:
self._test_root = self._test_root.replace("$PROJECT", self._project)
self._test_root = os.path.abspath(self._test_root)
self._test_id = test_id if test_id is not None else CIME.utils.get_timestamp()
self._compiler = self._machobj.get_default_compiler() if compiler is None else compiler
self._clean = clean
self._namelists_only = namelists_only
self._walltime = walltime
if parallel_jobs is None:
self._parallel_jobs = min(len(test_names),
self._machobj.get_value("MAX_MPITASKS_PER_NODE"))
else:
self._parallel_jobs = parallel_jobs
self._baseline_cmp_name = baseline_cmp_name # Implies comparison should be done if not None
self._baseline_gen_name = baseline_gen_name # Implies generation should be done if not None
# Compute baseline_root
self._baseline_root = baseline_root if baseline_root is not None \
else self._machobj.get_value("BASELINE_ROOT")
if self._project is not None:
self._baseline_root = self._baseline_root.replace("$PROJECT", self._project)
self._baseline_root = os.path.abspath(self._baseline_root)
if baseline_cmp_name or baseline_gen_name:
if self._baseline_cmp_name:
full_baseline_dir = os.path.join(self._baseline_root, self._baseline_cmp_name)
expect(os.path.isdir(full_baseline_dir),
#.........这里部分代码省略.........
示例2: SystemTest
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import has_batch_system [as 别名]
class SystemTest(object):
###############################################################################
###########################################################################
def __init__(self, test_names,
no_run=False, no_build=False, no_batch=None,
test_root=None, test_id=None,
machine_name=None,compiler=None,
baseline_root=None, baseline_name=None,
clean=False,compare=False, generate=False, namelists_only=False,
project=None, parallel_jobs=None,
xml_machine=None, xml_compiler=None, xml_category=None,xml_testlist=None):
###########################################################################
self._cime_root = CIME.utils.get_cime_root()
self._cime_model = CIME.utils.get_model()
# needed for perl interface
os.environ["CIMEROOT"] = self._cime_root
self._machobj = Machines(machine=machine_name)
machine_name = self._machobj.get_machine_name()
self._no_build = no_build if not namelists_only else True
self._no_run = no_run if not self._no_build else True
# Figure out what project to use
if (project is None):
self._project = CIME.utils.get_project()
if (self._project is None):
self._project = self._machobj.get_value("PROJECT")
else:
self._project = project
# We will not use batch system if user asked for no_batch or if current
# machine is not a batch machine
self._no_batch = no_batch or not self._machobj.has_batch_system()
self._test_root = test_root if test_root is not None else self._machobj.get_value("CESMSCRATCHROOT")
if (self._project is not None):
self._test_root = self._test_root.replace("$PROJECT", self._project)
self._test_root = os.path.abspath(self._test_root)
self._test_id = test_id if test_id is not None else CIME.utils.get_utc_timestamp()
self._compiler = compiler if compiler is not None else self._machobj.get_default_compiler()
expect(self._machobj.is_valid_compiler(self._compiler),
"Compiler %s not valid for machine %s" % (self._compiler,machine_name))
self._clean = clean
self._namelists_only = namelists_only
# Extra data associated with tests, do not modify after construction
# test_name -> test_data
# test_data: name -> value
self._test_data = {}
# If xml options are provided get tests from xml file, otherwise use acme dictionary
if(not test_names and (xml_machine is not None or xml_category is not None or xml_compiler is not None or xml_testlist is not None)):
test_data = CIME.test_utils.get_tests_from_xml(xml_machine, xml_category, xml_compiler, xml_testlist, machine_name, compiler)
test_names = [item["name"] for item in test_data]
for test_datum in test_data:
self._test_data[test_datum["name"]] = test_datum
else:
expect(len(test_names) > 0, "No tests to run")
test_names = update_acme_tests.get_full_test_names(test_names, machine_name, self._compiler)
if (parallel_jobs is None):
self._parallel_jobs = min(len(test_names), int(self._machobj.get_value("MAX_TASKS_PER_NODE")))
else:
self._parallel_jobs = parallel_jobs
self._baseline_cmp_name = None
self._baseline_gen_name = None
self._compare = False
self._generate = False
if (compare or generate):
# Figure out what baseline name to use
if (baseline_name is None):
if(compare is not None and isinstance(compare,str)):
self._baseline_cmp_name = compare
self._compare = True
if(generate is not None and isinstance(generate,str)):
self._baseline_gen_name = generate
self._generate = True
branch_name = CIME.utils.get_current_branch(repo=self._cime_root)
expect(branch_name is not None, "Could not determine baseline name from branch, please use -b option")
if(self._compare and self._baseline_cmp_name is None):
self._baseline_cmp_name = os.path.join(self._compiler, branch_name)
if(self._generate and self._baseline_gen_name is None):
self._baseline_gen_name = os.path.join(self._compiler, branch_name)
else:
if(compare):
self._compare = True
self._baseline_cmp_name = baseline_name
if (not self._baseline_cmp_name.startswith("%s/" % self._compiler)):
self._baseline_cmp_name = os.path.join(self._compiler, self._baseline_cmp_name)
if(generate):
self._generate = True
self._baseline_gen_name = baseline_name
if (not self._baseline_gen_name.startswith("%s/" % self._compiler)):
self._baseline_gen_name = os.path.join(self._compiler, self._baseline_gen_name)
#.........这里部分代码省略.........
示例3: TestScheduler
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import has_batch_system [as 别名]
class TestScheduler(object):
###############################################################################
###########################################################################
def __init__(self, test_names, test_data=None,
no_run=False, no_build=False, no_setup=False, no_batch=None,
test_root=None, test_id=None,
machine_name=None, compiler=None,
baseline_root=None, baseline_cmp_name=None, baseline_gen_name=None,
clean=False, namelists_only=False,
project=None, parallel_jobs=None,
walltime=None, proc_pool=None,
use_existing=False, save_timing=False, queue=None, allow_baseline_overwrite=False):
###########################################################################
self._cime_root = CIME.utils.get_cime_root()
self._cime_model = CIME.utils.get_model()
self._allow_baseline_overwrite = allow_baseline_overwrite
self._save_timing = save_timing
self._queue = queue
self._test_data = {} if test_data is None else test_data # Format: {test_name -> {data_name -> data}}
self._machobj = Machines(machine=machine_name)
self._no_setup = no_setup
self._no_build = no_build or no_setup or namelists_only
self._no_run = no_run or self._no_build
# Figure out what project to use
if project is None:
self._project = CIME.utils.get_project()
if self._project is None:
self._project = self._machobj.get_value("PROJECT")
else:
self._project = project
# We will not use batch system if user asked for no_batch or if current
# machine is not a batch machine
self._no_batch = no_batch or not self._machobj.has_batch_system()
expect(not (self._no_batch and self._queue is not None),
"Does not make sense to request a queue without batch system")
# Determine and resolve test_root
self._test_root = self._machobj.get_value("CESMSCRATCHROOT") if test_root is None else test_root
if self._project is not None:
self._test_root = self._test_root.replace("$PROJECT", self._project)
self._test_root = os.path.abspath(self._test_root)
self._test_id = test_id if test_id is not None else CIME.utils.get_timestamp()
self._compiler = self._machobj.get_default_compiler() if compiler is None else compiler
self._clean = clean
self._namelists_only = namelists_only
self._walltime = walltime
if parallel_jobs is None:
self._parallel_jobs = min(len(test_names),
int(self._machobj.get_value("MAX_TASKS_PER_NODE")))
else:
self._parallel_jobs = parallel_jobs
self._baseline_cmp_name = baseline_cmp_name # Implies comparison should be done if not None
self._baseline_gen_name = baseline_gen_name # Implies generation should be done if not None
if baseline_cmp_name or baseline_gen_name:
# Compute baseline_root
self._baseline_root = baseline_root if baseline_root is not None \
else self._machobj.get_value("CCSM_BASELINE")
if self._project is not None:
self._baseline_root = self._baseline_root.replace("$PROJECT", self._project)
self._baseline_root = os.path.abspath(self._baseline_root)
if self._baseline_cmp_name:
full_baseline_dir = os.path.join(self._baseline_root, self._baseline_cmp_name)
expect(os.path.isdir(full_baseline_dir),
"Missing baseline comparison directory %s" % full_baseline_dir)
# the following is to assure that the existing generate directory is not overwritten
if self._baseline_gen_name:
full_baseline_dir = os.path.join(self._baseline_root, self._baseline_gen_name)
existing_baselines = []
for test_name in test_names:
test_baseline = os.path.join(full_baseline_dir, test_name)
if os.path.isdir(test_baseline):
existing_baselines.append(test_baseline)
expect(allow_baseline_overwrite or len(existing_baselines) == 0,
"Baseline directories already exists %s\n"\
"Use --allow_baseline_overwrite to avoid this error"%existing_baselines)
else:
self._baseline_root = None
# This is the only data that multiple threads will simultaneously access
# Each test has it's own value and setting/retrieving items from a dict
# is atomic, so this should be fine to use without mutex.
# Since the name-list phase can fail without aborting later phases, we
# need some extra state to remember tests that had namelist problems.
# name -> (phase, status, has_namelist_problem)
#.........这里部分代码省略.........
示例4: SystemTest
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import has_batch_system [as 别名]
class SystemTest(object):
###############################################################################
###########################################################################
def __init__(self, test_names,
no_run=False, no_build=False, no_batch=None,
test_root=None, test_id=None,
machine_name=None, compiler=None,
baseline_root=None, baseline_name=None,
clean=False, compare=False, generate=False, namelists_only=False,
project=None, parallel_jobs=None,
xml_machine=None, xml_compiler=None, xml_category=None,
xml_testlist=None, walltime=None, proc_pool=None,
use_existing=False):
###########################################################################
self._cime_root = CIME.utils.get_cime_root()
self._cime_model = CIME.utils.get_model()
# needed for perl interface
os.environ["CIMEROOT"] = self._cime_root
# if machine_name is set use it, otherwise if xml_machine is set use it,
# otherwise probe for machine_name
if machine_name is None:
machine_name = xml_machine
self._machobj = Machines(machine=machine_name)
machine_name = self._machobj.get_machine_name()
self._no_build = no_build if not namelists_only else True
self._no_run = no_run if not self._no_build else True
# Figure out what project to use
if project is None:
self._project = CIME.utils.get_project()
if self._project is None:
self._project = self._machobj.get_value("PROJECT")
else:
self._project = project
# We will not use batch system if user asked for no_batch or if current
# machine is not a batch machine
self._no_batch = no_batch or not self._machobj.has_batch_system()
self._test_root = test_root if test_root is not None \
else self._machobj.get_value("CESMSCRATCHROOT")
if self._project is not None:
self._test_root = self._test_root.replace("$PROJECT", self._project)
self._test_root = os.path.abspath(self._test_root)
self._test_id = test_id if test_id is not None else CIME.utils.get_utc_timestamp()
# if compiler is set use it, otherwise if xml_compiler is set use it,
# otherwise use the default compiler for the machine
if compiler is not None:
self._compiler = compiler
elif xml_compiler is not None:
self._compiler = xml_compiler
else:
self._compiler = self._machobj.get_default_compiler()
expect(self._machobj.is_valid_compiler(self._compiler),
"Compiler %s not valid for machine %s" % (self._compiler, machine_name))
self._clean = clean
self._namelists_only = namelists_only
# Extra data associated with tests, do not modify after construction
# test_name -> test_data
# test_data: name -> value
self._test_xml = {}
# If xml options are provided get tests from xml file, otherwise use acme dictionary
if not test_names and (xml_machine is not None or xml_category is not None or
xml_compiler is not None or xml_testlist is not None):
test_data = CIME.test_utils.get_tests_from_xml(xml_machine, xml_category,
xml_compiler, xml_testlist,
machine_name, compiler)
test_names = [item["name"] for item in test_data]
for test_datum in test_data:
self._test_xml[test_datum["name"]] = test_datum
else:
expect(len(test_names) > 0, "No tests to run")
test_names = update_acme_tests.get_full_test_names(test_names,
machine_name, self._compiler)
if walltime is not None:
for test in test_names:
if test in self._test_xml:
test_datum = self._test_xml[test]
else:
test_datum = {}
self._test_xml[test] = test_datum
test_datum["wallclock"] = walltime
if parallel_jobs is None:
self._parallel_jobs = min(len(test_names),
int(self._machobj.get_value("MAX_TASKS_PER_NODE")))
else:
#.........这里部分代码省略.........