CIME.XML.env_batch.EnvBatch
- class CIME.XML.env_batch.EnvBatch(case_root=None, infile='env_batch.xml', read_only=False)[source]
Bases:
EnvBase
Methods
__init__
initialize an object interface to file env_batch.xml in the case directory
Add element node to self at root
Add elements from srcobj to self under the appropriate group element, entries to be added must have a child element <file> with value "infile"
attrib
cancel_job
change_file
check_if_comp_var
Returns True if timestamp matches what is expected
Remove the <group>, <file>, <values> and <value> childnodes from node
compare_xml
copy
create_job_groups
get
get_all_queues
get_batch_directives
get_batch_mail_type
get_batch_system_type
get_child
get_child_content
This is the critical function, its interface and performance are crucial.
get_default_queue
Set the value of an entry to the default value for that entry
get_description
get_element_text
get_elements_from_child_content
get_groups
get_id
get_job_id
get_job_overrides
get_jobs
get_node_element_info
get_nodes_by_id
get_optional_child
Get queue specifications from node.
get_raw_record
A value in the xml file may contain references to other xml variables or to environment variables.
get_status
return a list of touples (flag, name)
get_type_info
get_valid_value_string
get_valid_values
Must default subgroup to something in order to provide single return value
Handle this case: <entry id ...> <values> <value A="a1">X</value> <value A="a2">Y</value> <value A="a3" B="b1">Z</value> </values> </entry>
Same functionality as get_value but it returns a list, if the value in xml contains commas the list have multiple elements split on commas
get_version
has
invalidate
A subclass is doing caching, we need to lock the tree structure in order to avoid invalidating cache.
make_all_batch_files
make_batch_script
make_child
make_child_comment
name
overwrite_existing_entries
pop
queue_meets_spec
Read and parse an xml file into the object.
read_fd
remove_child
Get an xml element matching nodename with optional attributes.
scan_children
Get an xml element matching nodename with optional attributes.
select_best_queue
set
set_batch_system
set_batch_system_type
set_components
set_default_value
set_element_text
set_job_defaults
set_name
set_text
set_valid_values
Override the entry_id set_value function with some special cases for this class
no_batch indicates that the jobs should be run directly rather that submitted to a queueing system job is the first job in the workflow sequence to start user_prereq is a batch system prerequisite as requested by the user skip_pnl indicates that the preview_namelist should not be run by this job allow_fail indicates that the prereq job need only complete not nessasarily successfully to start the next job resubmit_immediate indicates that all jobs indicated by the RESUBMIT option should be submitted at the same time instead of waiting to resubmit at the end of the first sequence workflow is a logical indicating whether only "job" is submitted or the workflow sequence starting with "job" is submitted
text
to_string
unlock
validate_timestamp
validate an XML file against a provided schema file using pylint
Write an xml file from data in self
zip
- class CacheEntry(tree, root, modtime)[source]
Bases:
tuple
- add_elements_by_group(srcobj, attributes=None, infile=None)[source]
Add elements from srcobj to self under the appropriate group element, entries to be added must have a child element <file> with value “infile”
- get_children(name=None, attributes=None, root=None)[source]
This is the critical function, its interface and performance are crucial.
You can specify attributes={key:None} if you want to select children with the key attribute but you don’t care what its value is.
- get_default_value(node, attributes=None)[source]
Set the value of an entry to the default value for that entry
- get_queue_specs(qnode)[source]
Get queue specifications from node.
Returns (nodemin, nodemax, jobname, walltimemax, jobmin, jobmax, is_strict)
- get_resolved_value(raw_value, allow_unresolved_envvars=False, subgroup=None)[source]
A value in the xml file may contain references to other xml variables or to environment variables. These are refered to in the perl style with $name and $ENV{name}.
>>> obj = GenericXML() >>> os.environ["FOO"] = "BAR" >>> os.environ["BAZ"] = "BARF" >>> obj.get_resolved_value("one $ENV{FOO} two $ENV{BAZ} three") 'one BAR two BARF three' >>> obj.get_resolved_value("2 + 3 - 1") '4' >>> obj.get_resolved_value("0001-01-01") '0001-01-01' >>> obj.get_resolved_value("$SHELL{echo hi}") == 'hi' True
- get_value(item, attribute=None, resolved=True, subgroup=None)[source]
Must default subgroup to something in order to provide single return value
- get_value_match(vid, attributes=None, exact_match=False, entry_node=None, replacement_for_none=None)[source]
Handle this case: <entry id …>
- <values>
<value A=”a1”>X</value> <value A=”a2”>Y</value> <value A=”a3” B=”b1”>Z</value>
</values>
</entry>
If replacement_for_none is provided, then: if the found text value would give a None value, instead replace it with the value given by the replacement_for_none argument. (However, still return None if no match is found.) This may or may not be needed, but is in place to maintain some old logic.
- get_values(vid, attribute=None, resolved=True, subgroup=None)[source]
Same functionality as get_value but it returns a list, if the value in xml contains commas the list have multiple elements split on commas
- lock()[source]
A subclass is doing caching, we need to lock the tree structure in order to avoid invalidating cache.
- read(infile, schema=None)[source]
Read and parse an xml file into the object. The schema variable can either be a path to an xsd schema file or a dictionary of paths to files by version.
- scan_child(nodename, attributes=None, root=None)[source]
Get an xml element matching nodename with optional attributes.
Error unless exactly one match.
- scan_optional_child(nodename, attributes=None, root=None)[source]
Get an xml element matching nodename with optional attributes.
Return None if no match.
- set_value(item, value, subgroup=None, ignore_type=False)[source]
Override the entry_id set_value function with some special cases for this class
- submit_jobs(case, no_batch=False, job=None, user_prereq=None, skip_pnl=False, allow_fail=False, resubmit_immediate=False, mail_user=None, mail_type=None, batch_args=None, dry_run=False, workflow=True)[source]
no_batch indicates that the jobs should be run directly rather that submitted to a queueing system job is the first job in the workflow sequence to start user_prereq is a batch system prerequisite as requested by the user skip_pnl indicates that the preview_namelist should not be run by this job allow_fail indicates that the prereq job need only complete not nessasarily successfully to start the next job resubmit_immediate indicates that all jobs indicated by the RESUBMIT option should be submitted at the same time instead of
waiting to resubmit at the end of the first sequence
workflow is a logical indicating whether only “job” is submitted or the workflow sequence starting with “job” is submitted