Example #1
0
 def test_distcp(self):
     directory = HDFS("/tmp/bar")
     directory.create()
     new_file = HDFS("/tmp/test_dist.txt")
     new_file.create(directory=False)
     _host = "sandbox.hortonworks.com"
     try:
         self.assertTrue(new_file.exists(), "File was not created")
         _file = HDFS("hdfs://{host}:8020/tmp/test_dist.txt".format(host=_host))
         _file.distcp(dest="hdfs://{host}:8020/tmp/bar/test_dist.txt".format(host=_host))
         file_after_copy = HDFS("/tmp/bar/test_dist.txt")
         self.assertTrue(file_after_copy.exists(), "File was not copied")
     finally:
         new_file.delete()
         directory.delete(recursive=True)
         self.assertFalse(new_file.exists(), "File was not deleted")
         self.assertFalse(directory.delete(), "File was not deleted")
Example #2
0
 def test_distcp(self):
     directory = HDFS("/tmp/bar")
     directory.create()
     new_file = HDFS("/tmp/test_dist.txt")
     new_file.create(directory=False)
     _host = "sandbox.hortonworks.com"
     try:
         self.assertTrue(new_file.exists(), "File was not created")
         _file = HDFS("hdfs://{host}:8020/tmp/test_dist.txt".format(host=_host))
         _file.distcp(dest="hdfs://{host}:8020/tmp/bar/test_dist.txt".format(host=_host))
         file_after_copy = HDFS("/tmp/bar/test_dist.txt")
         self.assertTrue(file_after_copy.exists(), "File was not copied")
     finally:
         new_file.delete()
         directory.delete(recursive=True)
         self.assertFalse(new_file.exists(), "File was not deleted")
         self.assertFalse(directory.delete(), "File was not deleted")