Ejemplo n.º 1
0
def daemon_main():
    rtype, baseurl, port = conf.WEBTLSMDD.split(":")
    host_port = ("localhost", int(port))

    sys.stdout.write("STARTING webtlsmdd.py DAEMON..................: %s\n" %
                     misc.timestamp())
    sys.stdout.write("webtlsmdd.py xmlrpc server version............: %s\n" %
                     (const.VERSION))
    sys.stdout.write("listening for incoming connections at URL.....: %s\n" %
                     (conf.WEBTLSMDD))
    sys.stdout.write("job (working) directory.......................: %s\n" %
                     (conf.TLSMD_WORK_DIR))

    os.chdir(conf.TLSMD_WORK_DIR)

    ## Switched from handle_SIGCHLD to SIG_IGN. Christoph Champ, 2008-03-10
    signal.signal(signal.SIGCHLD, SIG_IGN)

    webtlsmdd = WebTLSMDDaemon()

    try:
        xmlrpc_server = WebTLSMD_XMLRPCServer(host_port)
    except socket.error:
        sys.stderr.write("[ERROR] unable to bind to host,port: %s\n" %
                         (str(host_port)))
        raise SystemExit

    xmlrpc_server.webtlsmdd = webtlsmdd
    xmlrpc_server.register_instance(webtlsmdd)
    xmlrpc_server.serve_forever()
Ejemplo n.º 2
0
def main():
    t = misc.timestamp()
    msg  = "[%s] WebTLSMD Job Cleanup: " % t
    msg += "Checking database for old jobs to remove."
    print msg

    job_list = mysql.job_list()
    jdict_remove_list = []

    for jdict in job_list:
        if jdict["via_pdb"] and jdict["state"] != ("running" or "queued"):
            print "[%s] saving to database PDB: %s" % (
                t, jdict["structure_id"])
            mysql.archive_pdb_jobs(jdict["job_id"])

        if check_remove(jdict):
            jdict_remove_list.append(jdict)

    for jdict in jdict_remove_list:
        try:
            print "[%s] %10s  %40s  %d Days Old" % (
                t, jdict["job_id"], jdict.get("email", "No Email"), 
                jdict["days"])
        except:
            print "[%s] %10s  Bad submission status" % (t, jdict["job_id"])

        mysql.archive_old_jobs(jdict["job_id"])

        try:
            remove_job(jdict["job_id"])
        except:
            msg  = "[%s] ERROR: Could not remove files/directories " % t
            msg += "associated with job_id: %s" % jdict["job_id"]
            print msg
Ejemplo n.º 3
0
def daemon_main():
    rtype, baseurl, port = conf.WEBTLSMDD.split(":")
    host_port = ("localhost", int(port))

    sys.stdout.write("STARTING webtlsmdd.py DAEMON..................: %s\n" % misc.timestamp())
    sys.stdout.write("webtlsmdd.py xmlrpc server version............: %s\n" % (const.VERSION))
    sys.stdout.write("listening for incoming connections at URL.....: %s\n" % (conf.WEBTLSMDD))
    sys.stdout.write("job (working) directory.......................: %s\n" % (conf.TLSMD_WORK_DIR))

    os.chdir(conf.TLSMD_WORK_DIR)

    ## Switched from handle_SIGCHLD to SIG_IGN. Christoph Champ, 2008-03-10
    signal.signal(signal.SIGCHLD, SIG_IGN)

    webtlsmdd = WebTLSMDDaemon()

    try:
        xmlrpc_server = WebTLSMD_XMLRPCServer(host_port)
    except socket.error:
        sys.stderr.write("[ERROR] unable to bind to host,port: %s\n" % (str(host_port)))
        raise SystemExit

    xmlrpc_server.webtlsmdd = webtlsmdd
    xmlrpc_server.register_instance(webtlsmdd)
    xmlrpc_server.serve_forever()
Ejemplo n.º 4
0
def log_write(x):
    sys.stdout.write("[%s] " % misc.timestamp() + x + "\n")
    sys.stdout.flush()
Ejemplo n.º 5
0
def log_write(x):
    sys.stdout.write("[%s] " % misc.timestamp() + x + "\n")
    sys.stdout.flush()