示例#1
0
    def test_update_job_dict(self):
        w = workflow_factory.BaseFactory()

        job_dict = {'configs': {'default1': 'value1',
                                'default2': 'value2'},
                    'params': {'param1': 'value1',
                               'param2': 'value2'},
                    'args': ['replace this', 'and this']}

        edp_configs = {'edp.streaming.mapper': '/usr/bin/cat',
                       'edp.streaming.reducer': '/usr/bin/wc'}
        configs = {'default2': 'changed'}
        configs.update(edp_configs)

        params = {'param1': 'changed'}

        exec_job_dict = {'configs': configs,
                         'params': params,
                         'args': ['replaced']}

        orig_exec_job_dict = copy.deepcopy(exec_job_dict)
        w.update_job_dict(job_dict, exec_job_dict)
        self.assertEqual({'edp_configs': edp_configs,
                          'configs': {'default1': 'value1',
                                      'default2': 'changed'},
                          'params': {'param1': 'changed',
                                     'param2': 'value2'},
                          'args': ['replaced']}, job_dict)

        self.assertEqual(orig_exec_job_dict, exec_job_dict)
示例#2
0
 def test_inject_swift_url_suffix(self):
     w = workflow_factory.BaseFactory()
     self.assertEqual(w.inject_swift_url_suffix("swift://ex/o"),
                      "swift://ex.sahara/o")
     self.assertEqual(w.inject_swift_url_suffix("swift://ex.sahara/o"),
                      "swift://ex.sahara/o")
     self.assertEqual(w.inject_swift_url_suffix("hdfs://my/path"),
                      "hdfs://my/path")