Ejemplo n.º 1
0
 def __init__(self, port, emark):
     tcp_server.__init__(self, port)
     tmp = pylib_io.run_shell_command("hostname")
     try:
         self.hostname = tmp[0].strip("\n")
     except IndexError:
         self.hostname = "<unknown>"
     self.emark = emark
Ejemplo n.º 2
0
 def __init__(self, port, emark):
     tcp_server.__init__(self, port)
     tmp = pylib_io.run_shell_command("hostname")
     try:
         self.hostname = tmp[0].strip("\n")
     except IndexError:
         self.hostname = "<unknown>"
     self.emark = emark
Ejemplo n.º 3
0
 def __init__(self, port, emark):
     tcp_client.__init__(self, jobend_re)
     self.port = port
     self.emark = emark
     tmp = pylib_io.run_shell_command("hostname")
     try:
         self.hostname = tmp[0].strip("\n")
     except IndexError:
         self.hostname = "<unknown>"
     self.emark = emark
Ejemplo n.º 4
0
 def __init__(self, port, emark):
     tcp_client.__init__(self, jobend_re)
     self.port = port
     self.emark = emark
     tmp = pylib_io.run_shell_command("hostname")
     try:
         self.hostname = tmp[0].strip("\n")
     except IndexError:
         self.hostname = "<unknown>"
     self.emark = emark
Ejemplo n.º 5
0
def find_batch_jobs(job_db):
    """
    Find all jobs in the job queue and return them in the form of a
    set. 
    """
    res = set()
    count = 0;
    
    txt = pylib_io.run_shell_command(bjobs_cmd)
    for i in txt:
        mo = ejob_re.search(i)
        if mo:
            count = count+1
            job = mo.group()
            assoc = job_db.find_entry(job)
            if assoc:
                res.update(assoc)
            else:
                res.add(job)

    return count,res
Ejemplo n.º 6
0
            



if __name__ == '__main__':
    cores  = 2
    getcpu = False
    opts, args = getopt.gnu_getopt(sys.argv[1:], "hCc:")

    for option, optarg in opts:
        if option == "-h":
            print __doc__
            sys.exit()
        elif option == "-c":
            cores = int(optarg)
        elif option == "-C":
            getcpu = True
        else:
            sys.exit("Unknown option "+ option)

    if getcpu:
        cpu = pylib_io.run_shell_command(
            'cat /proc/cpuinfo | grep "cpu MHz\|bogomips"|head -2')
        cpu = "".join(["# "+i for i in cpu])
        
    jobs = sys.stdin.readlines()

    control = prunner(jobs, cpu)

    control.run(cores)