Exemple #1
0
def basic_process_run_results_f(f):
    """ Copy each list of infiles to each outfile and delete infiles

        f: file containing one set of mapping instructions per line

        example f:
         f1.txt f2.txt f3.txt f_combined.txt
         f1.log f2.log f3.log f_combined.log

        If f contained the two lines above, this function would
         concatenate f1.txt, f2.txt, and f3.txt into f_combined.txt
         and f1.log, f2.log, and f3.log into f_combined.log
    """
    infiles_lists, out_filepaths = parse_tmp_to_final_filepath_map_file(f)
    for infiles_list, out_filepath in zip(infiles_lists, out_filepaths):
        try:
            of = open(out_filepath, 'w')
        except IOError:
            raise IOError(
                "Poller can't open final output file: %s" % out_filepath +
                "\nLeaving individual jobs output.\n Do you have write access?"
            )

        for fp in infiles_list:
            for line in open(fp):
                of.write('%s\n' % line.strip('\n'))
        of.close()
    # It is a good idea to have your clean_up_callback return True.
    # That way, if you get mixed up and pass it as check_run_complete_callback,
    # you'll get an error right away rather than going into an infinite loop
    return True
Exemple #2
0
def verbose_process_run_results_f(f):
    """ Copy each list of infiles to each outfile and delete infiles (verbose)

        f: file containing one set of mapping instructions per line

        example f:
         f1.txt f2.txt f3.txt f_combined.txt
         f1.log f2.log f3.log f_combined.log

        If f contained the two lines above, this function would
         concatenate f1.txt, f2.txt, and f3.txt into f_combined.txt
         and f1.log, f2.log, and f3.log into f_combined.log
    """
    infiles_lists, out_filepaths = parse_tmp_to_final_filepath_map_file(f)
    for infiles_list, out_filepath in zip(infiles_lists, out_filepaths):
        try:
            of = open(out_filepath, 'w')
            print 'Final result file (%s) contains temp files:'\
                % out_filepath
        except IOError:
            raise IOError("Poller can't open final output file: %s" % out_filepath +
                          "\nLeaving individual jobs output.\n Do you have write access?")

        for fp in infiles_list:
            print '\t%s' % fp
            for line in open(fp):
                of.write(line)
        of.close()
    return True
Exemple #3
0
def basic_process_run_results_f(f):
    """ Copy each list of infiles to each outfile and delete infiles

        f: file containing one set of mapping instructions per line

        example f:
         f1.txt f2.txt f3.txt f_combined.txt
         f1.log f2.log f3.log f_combined.log

        If f contained the two lines above, this function would
         concatenate f1.txt, f2.txt, and f3.txt into f_combined.txt
         and f1.log, f2.log, and f3.log into f_combined.log
    """
    infiles_lists, out_filepaths = parse_tmp_to_final_filepath_map_file(f)
    for infiles_list, out_filepath in zip(infiles_lists, out_filepaths):
        try:
            of = open(out_filepath, 'w')
        except IOError:
            raise IOError("Poller can't open final output file: %s" % out_filepath +
                          "\nLeaving individual jobs output.\n Do you have write access?")

        for fp in infiles_list:
            for line in open(fp):
                of.write('%s\n' % line.strip('\n'))
        of.close()
    # It is a good idea to have your clean_up_callback return True.
    # That way, if you get mixed up and pass it as check_run_complete_callback,
    # you'll get an error right away rather than going into an infinite loop
    return True
Exemple #4
0
def verbose_process_run_results_f(f):
    """ Copy each list of infiles to each outfile and delete infiles (verbose)
    
        f: file containing one set of mapping instructions per line
        
        example f:
         f1.txt f2.txt f3.txt f_combined.txt
         f1.log f2.log f3.log f_combined.log
         
        If f contained the two lines above, this function would 
         concatenate f1.txt, f2.txt, and f3.txt into f_combined.txt
         and f1.log, f2.log, and f3.log into f_combined.log
    """
    infiles_lists,out_filepaths = parse_tmp_to_final_filepath_map_file(f)
    for infiles_list, out_filepath in zip(infiles_lists,out_filepaths):
        try:
            of = open(out_filepath,'w')
            print 'Final result file (%s) contains temp files:'\
             % out_filepath
        except IOError:
            raise IOError,\
             "Poller can't open final output file: %s" % out_filepath  +\
             "\nLeaving individual jobs output.\n Do you have write access?"

        for fp in infiles_list:
            print '\t%s' % fp
            for line in open(fp):
               of.write(line)
        of.close()
    return True