コード例 #1
0
def SubmitJobToQueue(
        jobid,
        datapath,
        outpath,
        numseq,
        numseq_this_user,
        email,  #{{{
        host_ip,
        base_www_url):
    myfunc.WriteFile("Entering SubmitJobToQueue()\n", g_params['debugfile'],
                     "a", True)
    fafile = "%s/query.fa" % (datapath)

    if numseq == -1:
        numseq = myfunc.CountFastaSeq(fafile)
    if numseq_this_user == -1:
        numseq_this_user = numseq

    name_software = "boctopus2"
    runjob = "%s %s/run_job.py" % (python_exec, rundir)
    scriptfile = "%s/runjob;%s;%s;%s;%s;%d.sh" % (
        outpath, name_software, jobid, host_ip, email, numseq)
    code_str_list = []
    code_str_list.append("#!/bin/bash")
    code_str_list.append("source %s/bin/activate" % (virt_env_path))
    cmdline = "%s %s -outpath %s -tmpdir %s -jobid %s " % (
        runjob, fafile, outpath, datapath, jobid)
    if email != "":
        cmdline += "-email \"%s\" " % (email)
    if base_www_url != "":
        cmdline += "-baseurl \"%s\" " % (base_www_url)
    if g_params['isForceRun']:
        cmdline += "-force "
    if g_params['isOnlyGetCache']:
        cmdline += "-only-get-cache "
    code_str_list.append(cmdline)

    code = "\n".join(code_str_list)

    msg = "Write scriptfile %s" % (scriptfile)
    myfunc.WriteFile(msg + "\n", g_params['debugfile'], "a", True)

    myfunc.WriteFile(code, scriptfile, mode="w", isFlush=True)
    os.chmod(scriptfile, 0o755)

    myfunc.WriteFile("Getting priority" + "\n", g_params['debugfile'], "a",
                     True)
    priority = myfunc.GetSuqPriority(numseq_this_user)

    if email in vip_user_list:
        priority = 999999999.0

    myfunc.WriteFile("priority=%d\n" % (priority), g_params['debugfile'], "a",
                     True)

    st1 = webcom.SubmitSlurmJob(datapath, outpath, scriptfile,
                                g_params['debugfile'])

    return st1
コード例 #2
0
def SubmitJobToQueue(
        jobid,
        datapath,
        outpath,
        numseq,
        numseq_this_user,
        email,  #{{{
        host_ip,
        base_www_url):
    myfunc.WriteFile("Entering SubmitJobToQueue()\n", g_params['debugfile'],
                     "a", True)
    fafile = "%s/query.fa" % (datapath)

    if numseq == -1:
        numseq = myfunc.CountFastaSeq(fafile)
    if numseq_this_user == -1:
        numseq_this_user = numseq

    query_parafile = "%s/query.para.txt" % (outpath)

    query_para = {}
    content = myfunc.ReadFile(query_parafile)
    para_str = content
    if content != "":
        query_para = json.loads(content)

    try:
        name_software = query_para['name_software']
    except KeyError:
        name_software = "prodres"

    runjob = "%s %s/run_job.py" % (python_exec, rundir)
    scriptfile = "%s/runjob,%s,%s,%s,%s,%d.sh" % (
        outpath, name_software, jobid, host_ip, email, numseq)
    code_str_list = []
    code_str_list.append("#!/bin/bash")
    code_str_list.append("source %s/bin/activate" % (virt_env_path))
    cmdline = "%s %s -outpath %s -tmpdir %s -jobid %s " % (
        runjob, fafile, outpath, datapath, jobid)
    if email != "":
        cmdline += "-email \"%s\" " % (email)
    if base_www_url != "":
        cmdline += "-baseurl \"%s\" " % (base_www_url)
    if g_params['isForceRun']:
        cmdline += "-force "
    if g_params['isOnlyGetCache']:
        cmdline += "-only-get-cache "
    code_str_list.append(cmdline)

    code = "\n".join(code_str_list)

    msg = "Writting scriptfile %s" % (scriptfile)
    webcom.loginfo(msg, g_params['debugfile'])

    myfunc.WriteFile(code, scriptfile, mode="w", isFlush=True)
    os.chmod(scriptfile, 0o755)

    webcom.loginfo("Getting priority", g_params['debugfile'])
    priority = myfunc.GetSuqPriority(numseq_this_user)

    if email in vip_user_list:
        priority = 999999999.0

    webcom.loginfo("priority=%d" % (priority), g_params['debugfile'])

    st1 = webcom.SubmitSlurmJob(datapath, outpath, scriptfile,
                                g_params['debugfile'])

    return st1
コード例 #3
0
def SubmitJobToQueue(
        jobid,
        datapath,
        outpath,
        nummodel,
        nummodel_this_user,
        email,  #{{{
        host_ip,
        base_www_url):
    myfunc.WriteFile("Entering SubmitJobToQueue()\n", g_params['debugfile'],
                     "a")
    modelfile = "%s/query.pdb" % (datapath)
    seqfile = "%s/query.fa" % (datapath)

    if nummodel == -1:
        nummodel = myfunc.ReadFile(modelfile).count("\nENDMDL")
        if nummodel == 0:
            nummodel = 1
    if nummodel_this_user == -1:
        nummodel_this_user = nummodel

    query_parafile = "%s/query.para.txt" % (outpath)

    query_para = {}
    content = myfunc.ReadFile(query_parafile)
    para_str = content
    if content != "":
        query_para = json.loads(content)

    try:
        name_software = query_para['name_software']
    except KeyError:
        name_software = "proq3"

    runjob = "%s %s/run_job.py" % (python_exec, rundir)
    scriptfile = "%s/runjob,%s,%s,%s,%s,%d.sh" % (
        outpath, name_software, jobid, host_ip, email, nummodel)
    code_str_list = []
    code_str_list.append("#!/bin/bash")
    code_str_list.append("source %s/bin/activate" % (virt_env_path))
    cmdline = "%s %s -outpath %s -tmpdir %s -jobid %s " % (
        runjob, modelfile, outpath, datapath, jobid)
    if email != "":
        cmdline += "-email \"%s\" " % (email)
    if os.path.exists(seqfile):
        cmdline += "-fasta \"%s\" " % (seqfile)
    if base_www_url != "":
        cmdline += "-baseurl \"%s\" " % (base_www_url)
    if g_params['isForceRun']:
        cmdline += "-force "
    code_str_list.append(cmdline)

    code = "\n".join(code_str_list)

    msg = "Write scriptfile %s" % (scriptfile)
    myfunc.WriteFile(msg + "\n", g_params['debugfile'], "a")

    myfunc.WriteFile(code, scriptfile)
    os.chmod(scriptfile, 0o755)

    myfunc.WriteFile("Getting priority" + "\n", g_params['debugfile'], "a")
    priority = myfunc.GetSuqPriority(nummodel_this_user)

    if email in vip_user_list:
        priority = 999999999.0

    myfunc.WriteFile("priority=%d\n" % (priority), g_params['debugfile'], "a")

    st1 = webcom.SubmitSlurmJob(datapath, outpath, scriptfile,
                                g_params['debugfile'])

    return st1