コード例 #1
0
ファイル: test_pig.py プロジェクト: epam/Merlin
    def test_run_commands_from_string_without_param_substitution(self):
        _test_id = str(uuid.uuid4())
        _output_dir = "/tmp/data_{}".format(_test_id)
        _input_dir = self.copy_file_from_local(self.temp_file("hello,world,world", ".txt"))

        commands = "A = load '{}' using PigStorage(',');".format(_input_dir)
        commands += "B = foreach A generate \$0 as id;"
        commands += "STORE B into '{}';".format(_output_dir)
        try:
            _pig = Pig.load_commands_from_string(commands)
            _result = _pig.run()
            _result.if_failed_raise(AssertionError("test_run_commands_from_string failed"))
            self.assertTrue(HDFS(_output_dir).exists(), "Cannot find job output")
        finally:
            self.delete_file_in_hdfs(_input_dir)
            self.delete_file_in_hdfs(_output_dir)
コード例 #2
0
    def test_run_commands_from_string_without_param_substitution(self):
        _test_id = str(uuid.uuid4())
        _output_dir = "/tmp/data_{}".format(_test_id)
        _input_dir = self.copy_file_from_local(
            self.temp_file("hello,world,world", ".txt"))

        commands = "A = load '{}' using PigStorage(',');".format(_input_dir)
        commands += "B = foreach A generate \$0 as id;"
        commands += "STORE B into '{}';".format(_output_dir)
        try:
            _pig = Pig.load_commands_from_string(commands)
            _result = _pig.run()
            _result.if_failed_raise(
                AssertionError("test_run_commands_from_string failed"))
            self.assertTrue(
                HDFS(_output_dir).exists(), "Cannot find job output")
        finally:
            self.delete_file_in_hdfs(_input_dir)
            self.delete_file_in_hdfs(_output_dir)
コード例 #3
0
ファイル: test_pig.py プロジェクト: epam/Merlin
 def test_run_script_from_string(self):
     Pig.load_commands_from_string(
         commands="ls /",
         command_executor=mock_executor('pig -e "ls /"')).run()
コード例 #4
0
ファイル: test_pig.py プロジェクト: Mbaroudi/Merlin
 def test_run_script_from_string(self):
     Pig.load_commands_from_string(
         commands="ls /",
         command_executor=mock_executor('pig -e "ls /"')).run()