Esempio n. 1
0
def sub_jobs_submit( jd_executable, job_type, affinity ,  subjobs_start,  number_of_jobs, jd_number_of_processes):
                                 
        jd = saga.job.description()
        
        for i in range(subjobs_start, int(number_of_jobs) + int(subjobs_start) ):

            #pick the executble different for preparing read files
            if  jd_executable == "bfast":
                 jd_executable_use = bfast_exe[affinity] + "/bfast"
            elif jd_executable == "solid2fastq":   
                 jd_executable_use = bfast_exe[affinity] + "/solid2fastq"
 
            else:
                 jd_executable_use = jd_executable
            
            # create job description
            uowd = troy.uow_description()

            print jd_executable_use
            uowd.set_attribute('Executable', jd_executable_use)
            uowd.set_attribute('NumberOfProcesses', str(jd_number_of_processes))

            uowd.set_attribute('SPMDVariation', 'single')
            
            # choose the job arguments based on type of job
            if job_type == "reads":
                uowd.set_vector_attribute('Arguments', \
                        ["-n",  "%s" %(bfast_reads_num[affinity]),  
                        "-o", "%s/%s.%s" %(bfast_reads_dir[affinity],shortreads_name ,dare_uuid),
                        "%s/*.csfasta"%(bfast_raw_reads_dir[affinity]),
                        "%s/*.qual" %(bfast_raw_reads_dir[affinity])])
                                  
            elif job_type == "count":
                uowd.set_vector_attribute('Arguments', \
                                [" -altr" , "%s/%s.%s.*" %(bfast_reads_dir[affinity],shortreads_name ,dare_uuid), 
                                "|",  "/usr/bin/wc", "-l" , 
                                ">", "%s/out.%s.txt"%(bfast_raw_reads_dir[affinity], dare_uuid)])
                                
            elif job_type == "matches":
                uowd.set_vector_attribute('Arguments', \
                         ["match",  
                         "-f",  "%s/%s.fa" %( bfast_ref_genome_dir[affinity], refgenome) , 
                         "-A", encoding_space, 
                         "-r",  "%s/%s.%s.fastq"%(bfast_reads_dir[affinity], shortreads_name,i+1),
                         "-n" ,str(jd_number_of_processes) ,
                         "-T" , "%s" %(bfast_tmp_dir[affinity]),
                         ">" , "%s/bfast.matches.file.%s.%s.%s.bmf" %(bfast_matches_dir[affinity],dare_uuid,refgenome,i+1)])  

            elif job_type == "localalign":
                uowd.set_vector_attribute('Arguments', \
                                ["localalign", 
                                "-f",  "%s/%s.fa"%(bfast_ref_genome_dir[affinity], refgenome),
                                "-A", encoding_space,
                                "-m", "%s/bfast.matches.file.%s.%s.%s.bmf"%(bfast_matches_dir[affinity],dare_uuid,refgenome,i+1),
                                ">", "%s/bfast.aligned.file.%s.%s.%s.baf" %(bfast_localalign_dir[affinity],dare_uuid,refgenome,i+1)])
                                
            elif job_type == "postprocess":
                uowd.set_vector_attribute('Arguments', \
                                ["postprocess",
                                "-f",  "%s/%s.fa" %(bfast_ref_genome_dir[affinity], refgenome),
                                "-A",  encoding_space,
                                "-i", "%s/bfast.aligned.file.%s.%s.%s.baf" %(bfast_localalign_dir[affinity],dare_uuid,refgenome,i+1),
                                ">", "%s/bfast.postprocess.file.%s.%s.%s.sam" %(bfast_postprocess_dir[affinity],dare_uuid,refgenome,i+1)])     
            
            elif job_type == "hostname":
                uowd.set_vector_attribute('Arguments', \
                               ['-f', '>', 'hostname%s.txt'%i, ';', '/bin/sleep', '15'])
                 
            
            else:
                uowd.set_vector_attribute('Arguments', [""])
            
            #jd.environment = ["affinity=affinity%s"%(affinity)]
            print "affinity%s"%(affinity)
            uowd.set_attribute('WorkingDirectory', work_dir[affinity])
            uowd.set_attribute('Output', os.path.join(work_dir[affinity], "stdout_" + job_type + \
                              "-"+ str(dare_uuid)+"-"+ str(i) + ".txt"))
            uowd.set_attribute('Error', os.path.join(work_dir[affinity], "stderr_"+ job_type + \
                              "-"+str(dare_uuid)+ "-"+str(i) + ".txt"))

            uows.append(bj.assign_uow(uowd))
            
            print "Submited sub-job " + "%d"%i + "."
                     
          
            logger.info( job_type + "subjob " + str(i))
            logger.info( "jd.number_of_processes " + str(jd_number_of_processes))
            print "jd.arguments"
           
            logger.info("affinity%s"%(affinity))
            logger.info( "jd exec " + jd_executable_use)
Esempio n. 2
0
def sub_jobs_submit(jd_executable, job_type, affinity, subjobs_start,
                    number_of_jobs, jd_number_of_processes):

    jd = saga.job.description()

    for i in range(subjobs_start, int(number_of_jobs) + int(subjobs_start)):

        #pick the executble different for preparing read files
        if jd_executable == "bfast":
            jd_executable_use = bfast_exe[affinity] + "/bfast"
        elif jd_executable == "solid2fastq":
            jd_executable_use = bfast_exe[affinity] + "/solid2fastq"

        else:
            jd_executable_use = jd_executable

        # create job description
        uowd = troy.uow_description()

        print(jd_executable_use)
        uowd.set_attribute('Executable', jd_executable_use)
        uowd.set_attribute('NumberOfProcesses', str(jd_number_of_processes))

        uowd.set_attribute('SPMDVariation', 'single')

        # choose the job arguments based on type of job
        if job_type == "reads":
            uowd.set_vector_attribute('Arguments', \
                    ["-n",  "%s" %(bfast_reads_num[affinity]),
                    "-o", "%s/%s.%s" %(bfast_reads_dir[affinity],shortreads_name ,dare_uuid),
                    "%s/*.csfasta"%(bfast_raw_reads_dir[affinity]),
                    "%s/*.qual" %(bfast_raw_reads_dir[affinity])])

        elif job_type == "count":
            uowd.set_vector_attribute('Arguments', \
                            [" -altr" , "%s/%s.%s.*" %(bfast_reads_dir[affinity],shortreads_name ,dare_uuid),
                            "|",  "/usr/bin/wc", "-l" ,
                            ">", "%s/out.%s.txt"%(bfast_raw_reads_dir[affinity], dare_uuid)])

        elif job_type == "matches":
            uowd.set_vector_attribute('Arguments', \
                     ["match",
                     "-f",  "%s/%s.fa" %( bfast_ref_genome_dir[affinity], refgenome) ,
                     "-A", encoding_space,
                     "-r",  "%s/%s.%s.fastq"%(bfast_reads_dir[affinity], shortreads_name,i+1),
                     "-n" ,str(jd_number_of_processes) ,
                     "-T" , "%s" %(bfast_tmp_dir[affinity]),
                     ">" , "%s/bfast.matches.file.%s.%s.%s.bmf" %(bfast_matches_dir[affinity],dare_uuid,refgenome,i+1)])

        elif job_type == "localalign":
            uowd.set_vector_attribute('Arguments', \
                            ["localalign",
                            "-f",  "%s/%s.fa"%(bfast_ref_genome_dir[affinity], refgenome),
                            "-A", encoding_space,
                            "-m", "%s/bfast.matches.file.%s.%s.%s.bmf"%(bfast_matches_dir[affinity],dare_uuid,refgenome,i+1),
                            ">", "%s/bfast.aligned.file.%s.%s.%s.baf" %(bfast_localalign_dir[affinity],dare_uuid,refgenome,i+1)])

        elif job_type == "postprocess":
            uowd.set_vector_attribute('Arguments', \
                            ["postprocess",
                            "-f",  "%s/%s.fa" %(bfast_ref_genome_dir[affinity], refgenome),
                            "-A",  encoding_space,
                            "-i", "%s/bfast.aligned.file.%s.%s.%s.baf" %(bfast_localalign_dir[affinity],dare_uuid,refgenome,i+1),
                            ">", "%s/bfast.postprocess.file.%s.%s.%s.sam" %(bfast_postprocess_dir[affinity],dare_uuid,refgenome,i+1)])

        elif job_type == "hostname":
            uowd.set_vector_attribute('Arguments', \
                           ['-f', '>', 'hostname%s.txt'%i, ';', '/bin/sleep', '15'])

        else:
            uowd.set_vector_attribute('Arguments', [""])

        #jd.environment = ["affinity=affinity%s"%(affinity)]
        print("affinity%s" % (affinity))
        uowd.set_attribute('WorkingDirectory', work_dir[affinity])
        uowd.set_attribute('Output', os.path.join(work_dir[affinity], "stdout_" + job_type + \
                          "-"+ str(dare_uuid)+"-"+ str(i) + ".txt"))
        uowd.set_attribute('Error', os.path.join(work_dir[affinity], "stderr_"+ job_type + \
                          "-"+str(dare_uuid)+ "-"+str(i) + ".txt"))

        uows.append(bj.assign_uow(uowd))

        print("Submited sub-job " + "%d" % i + ".")

        logger.info(job_type + "subjob " + str(i))
        logger.info("jd.number_of_processes " + str(jd_number_of_processes))
        print("jd.arguments")

        logger.info("affinity%s" % (affinity))
        logger.info("jd exec " + jd_executable_use)
Esempio n. 3
0
    jd.set_attribute('ProcessesPerHost', '1') # Ignored?
    jd.set_attribute('Queue', 'workq')
    jd.set_vector_attribute('JobProject', ['randomstring'])
    jd.set_attribute('WorkingDirectory', DEPLOYMENT_LOCATION)
    jd.set_attribute('WallTimeLimit', '12')
    bj.add_resource(troy.bigjob_type.SAGA, RESOURCE_URL, jd)

    print "Pilot Job/BigJob URL: ", bj.list_resources()


    #######################################################################
    # Submit UoW through BigJob
    uows = []
    WORKING_DIRECTORY = '/work/marksant/saga'
    for i in range (15):
        uowd = troy.uow_description()
        uowd.set_attribute('Executable', '/bin/hostname')
        uowd.set_attribute('NumberOfProcesses', '1')
        uowd.set_attribute('SPMDVariation', 'single')
        uowd.set_attribute('WorkingDirectory', WORKING_DIRECTORY)
        uowd.set_attribute('Output', 'stdout.txt')
        uowd.set_attribute('Error', 'stderr.txt')

        uowd.set_vector_attribute('Arguments', \
            ['-f', '>', 'hostname%s.txt'%i, ';', '/bin/sleep', '60'])
        uows.append(bj.assign_uow(uowd))
    
    # busy wait for completion
    while 1:
        uow_states = set()
        for i in range(len(uows)):