logging.basicConfig(filename=logfile) log = logging.getLogger(os.path.basename(tool)) hdfs = pydoop.hdfs.hdfs("default", 0) log.debug("connected to hdfs at %s", hdfs.host) # hack to read the input path directly from the command line #input_paths = [ galaxy_input ] with open(galaxy_input) as f: input_paths = [s.rstrip("\n") for s in f.readlines()] output_path = os.path.join(hdfs.working_directory(), "galaxy-wrapper-%f" % random.random()) hdfs.close() log.debug("hdfs closed") log.debug("options: %s", options) log.debug("input: %s", input_paths) log.debug("output: %s", output_path) with open(galaxy_output, 'w') as f: f.write(output_path) command = [tool] command.extend(options) command.extend(input_paths) command.append(output_path) try:
def close(): """ Closes an the HDFS connection (disconnects to the namenode) """ hdfs.close()
logging.basicConfig(filename=logfile) log = logging.getLogger(os.path.basename(tool)) hdfs = pydoop.hdfs.hdfs("default", 0) log.debug("connected to hdfs at %s", hdfs.host) # hack to read the input path directly from the command line #input_paths = [ galaxy_input ] with open(galaxy_input) as f: input_paths = [ s.rstrip("\n") for s in f.readlines() ] output_path = os.path.join( hdfs.working_directory(), "galaxy-wrapper-%f" % random.random()) hdfs.close() log.debug("hdfs closed") log.debug("options: %s", options) log.debug("input: %s", input_paths) log.debug("output: %s", output_path) with open(galaxy_output, 'w') as f: f.write(output_path) command = [tool] command.extend(options) command.extend(input_paths) command.append(output_path) try: