Esempio n. 1
0
 def test_copy_from_local_command_generator(self):
     hdfs_client.copy_from_local(
         localsrc="~/data.txt",
         hdfsdst="/tmp/dir",
         executor=lambda command, *args: self.assertEqual(
             build_command(command, *args),
             "hadoop fs -copyFromLocal ~/data.txt /tmp/dir"))
Esempio n. 2
0
 def test_copy_from_local_command_generator(self):
     hdfs_client.copy_from_local(
         localsrc="~/data.txt",
         hdfsdst="/tmp/dir",
         executor=lambda command, *args: self.assertEqual(
             build_command(command, *args), "hadoop fs -copyFromLocal ~/data.txt /tmp/dir"
         ),
     )
Esempio n. 3
0
    def copy_to_hdfs(self, hdfs_path):
        """
        Copies file from local file system to HDFS.

        :param file to copy:
        """
        self.assert_exists()
        hdfs.copy_from_local(
            localsrc=self.path,
            hdfsdst=hdfs_path
        ).if_failed_raise(
            CommandException(
                "Cannot copy '{path}' to HDFS".format(path=self.path)
            )
        )