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)))
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)) )
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" ))
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" ), )