當前位置: 首頁>>代碼示例>>Python>>正文


Python EnvBase.get_children方法代碼示例

本文整理匯總了Python中CIME.XML.env_base.EnvBase.get_children方法的典型用法代碼示例。如果您正苦於以下問題:Python EnvBase.get_children方法的具體用法?Python EnvBase.get_children怎麽用?Python EnvBase.get_children使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CIME.XML.env_base.EnvBase的用法示例。


在下文中一共展示了EnvBase.get_children方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_children

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_children [as 別名]
    def get_children(self, name=None, attributes=None, root=None):
        if name in ("JOB_WALLCLOCK_TIME", "PROJECT", "CHARGE_ACCOUNT",
                        "PROJECT_REQUIRED", "JOB_QUEUE", "BATCH_COMMAND_FLAGS"):
            nodes = EnvBase.get_children(self, "entry", attributes={"id":name}, root=root)
        else:
            nodes = EnvBase.scan_children(self, name, attributes=attributes, root=root)

        return nodes
開發者ID:Katetc,項目名稱:cime,代碼行數:10,代碼來源:env_batch.py

示例2: create_job_groups

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_children [as 別名]
    def create_job_groups(self, batch_jobs):
        # Subtle: in order to support dynamic batch jobs, we need to remove the
        # job_submission group and replace with job-based groups

        orig_group = self.get_child("group", {"id":"job_submission"},
                                    err_msg="Looks like job groups have already been created")
        orig_group_children = EnvBase.get_children(self, root=orig_group)

        childnodes = []
        for child in reversed(orig_group_children):
            childnodes.append(child)

        self.remove_child(orig_group)

        for name, jdict in batch_jobs:
            new_job_group = self.make_child("group", {"id":name})
            for field in jdict.keys():
                val = jdict[field]
                node = self.make_child("entry", {"id":field,"value":val}, root=new_job_group)
                self.make_child("type", root=node, text="char")

            for child in childnodes:
                self.add_child(self.copy(child), root=new_job_group)
開發者ID:Katetc,項目名稱:cime,代碼行數:25,代碼來源:env_batch.py


注:本文中的CIME.XML.env_base.EnvBase.get_children方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。