Пример #1
0
    def build_workflow_xml(self,
                           job_tracker,
                           name_node,
                           script,
                           prepare={},
                           job_xml=None,
                           configuration=None,
                           params={},
                           arguments={},
                           files=[],
                           archives=[]):

        self._add_jobtracker_namenode_elements(job_tracker, name_node)

        for k, v in prepare.items():
            self._add_to_prepare_element(k, v)

        self._add_job_xml_element(job_xml)
        self._add_configuration_elements(configuration)

        x.add_text_element_to_tag(self.doc, self.tag_name, 'script', script)

        x.add_equal_separated_dict(self.doc, self.tag_name, 'param', params)
        x.add_equal_separated_dict(self.doc, self.tag_name, 'argument',
                                   arguments)

        self._add_files_and_archives(files, archives)
Пример #2
0
    def test_add_equal_separated_dict(self):
        doc = self.create_default_doc()
        x.add_equal_separated_dict(doc, 'test', 'dict_item',
                                   {'a': 'b', 'c': 'd'})
        self.assertEqual(doc.toprettyxml(indent="  "),
                         """<?xml version="1.0" ?>
<test>
  <dict_item>a=b</dict_item>
  <dict_item>c=d</dict_item>
</test>
""")
Пример #3
0
    def test_add_equal_separated_dict(self):
        doc = self.create_default_doc()
        x.add_equal_separated_dict(doc, 'test', 'dict_item', {
            'a': 'b',
            'c': 'd'
        })
        self.assertEqual(
            doc.toprettyxml(indent="  "), """<?xml version="1.0" ?>
<test>
  <dict_item>a=b</dict_item>
  <dict_item>c=d</dict_item>
</test>
""")
Пример #4
0
    def build_workflow_xml(self, script, job_xml, prepare={},
                           configuration=None, params={},
                           files=[], archives=[]):

        for k, v in prepare.items():
            self._add_to_prepare_element(k, v)

        self._add_job_xml_element(job_xml)
        self._add_configuration_elements(configuration)

        x.add_text_element_to_tag(self.doc, self.tag_name,
                                  'script', script)

        x.add_equal_separated_dict(self.doc, self.tag_name, 'param', params)

        self._add_files_and_archives(files, archives)