def HDFS_Upload(uploadfile): if uploadfile: connect = MiniCluster(None, start_cluster=False) result = connect.ls("/") cluster = MiniCluster("/") if result: #raise Exception("An active Hadoop cluster is found! Not running tests!") if cluster.exists(uploadfile): hadoop_home = os.getenv('HADOOP_HOME') if hadoop_home is None: print "Can't find hadoop path!!!" cluster.terminate() sys.exit() upload_command = hadoop_home + "/bin/hadoop" + " dfs -put " + filename + " " + uploadfile #print upload_command os.system(upload_command) else: cluster.terminate() print "No path in HDFS" else: print "Hadoop is not running" cluster.terminate() else: sys.exit()