Ejemplo n.º 1
0
def start_barista(solver_filename):
    pid = os.getpid()
    print("Daemon PID:", pid, file=sys.stderr)

    net = BaristaNet(solver_filename)

    ipc_interface = net.get_ipc_interface()
    ipc_interface_filename = os.path.join(os.getcwd(),
                                          "barista-%d.interface" % pid)
    write_ipc_interface(ipc_interface, ipc_interface_filename)
    print(ipc_interface_filename + "," + str(pid), file=sys.stdout)

    # Close stdout so the pipe can return
    sys.stdout.close()
    os.close(1)

    # Compute until the cows come home
    while True:
        net.full_pass()