示例#1
0
 def test_mkdir_command_generator(self):
     hdfs_client.mkdir(
         path="/tmp/test",
         executor=lambda command, *args: self._assert_command_generation("hadoop fs -mkdir /tmp/test")(
             command, *args
         ),
     )
示例#2
0
    def create_directory(self, recursive=True):
        """
        Creates a new directory unless it already exists

        :param recursive: if True, will create all parent folders
        """
        if not self.exists():
            if recursive and not self.base_dir().exists():
                self.base_dir().create_directory(recursive)
            fs.mkdir(self.path).if_failed_raise(
                FileSystemException(
                    "Cannot create directory '{path}'".format(path=self.path)))
示例#3
0
文件: hdfs.py 项目: epam/Merlin
    def create_directory(self, recursive=True):
        """
        Creates a new directory unless it already exists

        :param recursive: if True, will create all parent folders
        """
        if not self.exists():
            if recursive and not self.base_dir().exists():
                self.base_dir().create_directory(recursive)
            fs.mkdir(self.path).if_failed_raise(
                FileSystemException("Cannot create directory '{path}'".format(path=self.path))
            )
示例#4
0
 def test_mkdir_command_generator_negative(self):
     hdfs_client.mkdir(
         "/tmp/test",
         executor=lambda command, *args: self.assertEqual(build_command(command, *args), "mkdir /tmp/test"),
     )
示例#5
0
 def test_mkdir_command_generator_negative(self):
     hdfs_client.mkdir(
         "/tmp/test",
         executor=lambda command, *args: self.assertEqual(
             build_command(command, *args), "mkdir /tmp/test"))
示例#6
0
 def test_mkdir_command_generator(self):
     hdfs_client.mkdir(
         path="/tmp/test",
         executor=lambda command, *args: self._assert_command_generation(
             "hadoop fs -mkdir /tmp/test")(command, *args))