コード例 #1
0
ファイル: test_hdfs_client.py プロジェクト: epam/Merlin
 def test_touchz(self):
     hdfs_client.touchz(
         path="/user/test/data.txt",
         executor=lambda cmd, *args: self._assert_command_generation("hadoop fs -touchz /user/test/data.txt")(
             cmd, *args
         ),
     )
コード例 #2
0
    def create_file(self, recursive=True):
        """
        Creates a new empty file unless it already exists

        :param recursive: if True, will create parent folders
        """
        if not self.exists():
            if recursive and not self.base_dir().exists():
                self.base_dir().create_directory(recursive)
            fs.touchz(self.path).if_failed_raise(
                FileSystemException(
                    "Cannot create file '{path}'".format(path=self.path)))
コード例 #3
0
ファイル: hdfs.py プロジェクト: epam/Merlin
    def create_file(self, recursive=True):
        """
        Creates a new empty file unless it already exists

        :param recursive: if True, will create parent folders
        """
        if not self.exists():
            if recursive and not self.base_dir().exists():
                self.base_dir().create_directory(recursive)
            fs.touchz(self.path).if_failed_raise(
                FileSystemException("Cannot create file '{path}'".format(path=self.path))
            )
コード例 #4
0
 def test_touchz(self):
     hdfs_client.touchz(
         path="/user/test/data.txt",
         executor=lambda cmd, *args: self._assert_command_generation(
             "hadoop fs -touchz /user/test/data.txt")(cmd, *args))