Пример #1
0
#!/usr/bin/python
from distsys.services import services

s = services()
Пример #2
0
#!/usr/bin/python

## Import builtins
import sys
from multiprocessing import Process, Pool

## Import distsys
from distsys.services import services

## Startup service
local_service = services(localhost=True)
num_clients = len(local_service.clients)

msg = "ping"
for client in local_service.clients:
    local_service.server(int(client), send_msg=msg)
Пример #3
0
    local_script_path = combo[1][0]
    file_name = local_script_path.split("/")[-1]
    project_name = combo[2]

    client_script_path = "~/distsys/bin/" + project_name + "/" + file_name

    if remote_file_exists(ip_addr, client_script_path):
        pass
    else:
        os.system('scp ' + local_script_path + ' ' + ip_addr + ':' + client_script_path)

    run_script(ip_addr, client_script_path)

    collect_results(ip_addr, project_name)


if __name__ == "__main__":
    s = services(localhost=False)
    num_clients = len(s.clients)

    ## Distribute script only if it hasnt yet.    
    client_files = distribute_data(num_clients, script_path, job=True)

    combo = []
    for i in range(num_clients):
        combo.append([s.clients[i], client_files[i], project_name])

    print "Distributing data..."
    pool = Pool(processes=num_clients)
    pool.map(run_job, combo)