コード例 #1
0
 def copy(self, dest):
     """
     Copies files to dest
     :param dest: path to destination file
     :type dest: HDFS
     """
     self._assert_exists_()
     fs.copy(self.path, dest.path).if_failed_raise(
         CommandException("Cannot copy '{path}' to {dst}".format(
             path=self.path, dst=dest)))
コード例 #2
0
ファイル: hdfs.py プロジェクト: epam/Merlin
 def copy(self, dest):
     """
     Copies files to dest
     :param dest: path to destination file
     :type dest: HDFS
     """
     self._assert_exists_()
     fs.copy(self.path, dest.path).if_failed_raise(
         CommandException("Cannot copy '{path}' to {dst}".format(path=self.path, dst=dest))
     )
コード例 #3
0
    def test_copy_command_generator(self):
        hdfs_client.copy(files="/tmp/data.txt",
                         dest="/raw/dir",
                         executor=lambda command, *args: self.assertEqual(
                             build_command(command, *args),
                             "hadoop fs -cp /tmp/data.txt /raw/dir"))

        with patch(HDFS_IS_DIR_FUNC) as mock_isdir:
            mock_isdir.return_value = True
            hdfs_client.copy(
                files=["/tmp/file_001.txt", "/tmp/file_002.txt"],
                dest="/raw/dir",
                executor=lambda command, *args: self.assertEqual(
                    build_command(command, *args),
                    "hadoop fs -cp /tmp/file_001.txt /tmp/file_002.txt /raw/dir"
                ))
コード例 #4
0
ファイル: test_hdfs_client.py プロジェクト: epam/Merlin
    def test_copy_command_generator(self):
        hdfs_client.copy(
            files="/tmp/data.txt",
            dest="/raw/dir",
            executor=lambda command, *args: self.assertEqual(
                build_command(command, *args), "hadoop fs -cp /tmp/data.txt /raw/dir"
            ),
        )

        with patch(HDFS_IS_DIR_FUNC) as mock_isdir:
            mock_isdir.return_value = True
            hdfs_client.copy(
                files=["/tmp/file_001.txt", "/tmp/file_002.txt"],
                dest="/raw/dir",
                executor=lambda command, *args: self.assertEqual(
                    build_command(command, *args), "hadoop fs -cp /tmp/file_001.txt /tmp/file_002.txt /raw/dir"
                ),
            )