コード例 #1
0
 def size(self):
     """
     Calculates aggregate length of files contained in the directory
     or the length of a file in case regular file.
     :return: size of file
     :rtype: long
     """
     self._assert_exists_()
     return fs.file_size(self.path)
コード例 #2
0
ファイル: hdfs.py プロジェクト: epam/Merlin
 def size(self):
     """
     Calculates aggregate length of files contained in the directory
     or the length of a file in case regular file.
     :return: size of file
     :rtype: long
     """
     self._assert_exists_()
     return fs.file_size(self.path)
コード例 #3
0
 def test_directory_size_command(self):
     _stdout = "3137674753  /tmp/file.txt"
     with patch(HDFS_IS_DIR_FUNC) as mock_isdir:
         mock_isdir.return_value = True
         size = hdfs_client.file_size(
             "/tmp/file.txt",
             executor=lambda cmd, *args: self._assert_command_generation(
                 "hadoop fs -du -s /tmp/file.txt", stdout=_stdout)
             (cmd, *args))
         self.assertEqual(3137674753, size)
コード例 #4
0
ファイル: test_hdfs_client.py プロジェクト: epam/Merlin
 def test_directory_size_command(self):
     _stdout = "3137674753  /tmp/file.txt"
     with patch(HDFS_IS_DIR_FUNC) as mock_isdir:
         mock_isdir.return_value = True
         size = hdfs_client.file_size(
             "/tmp/file.txt",
             executor=lambda cmd, *args: self._assert_command_generation(
                 "hadoop fs -du -s /tmp/file.txt", stdout=_stdout
             )(cmd, *args),
         )
         self.assertEqual(3137674753, size)