def run_comparison(formdata, comparison_id):
    print "running comparison {}".format(comparison_id)
    print "formdata: {}".format(formdata)

    # lhs_container, lhs_command, lhs_

    comparison_home = 'comparisons/{}'.format(comparison_id)
    if not os.path.exists(comparison_home):
        os.makedirs(comparison_home)
    p_lhs = subprocess.Popen([
        './runserver.py', IPC_SOCKETNAME,
        str(comparison_id), 'lhs', formdata['dockerImageLHS'],
        formdata['commandLHS'], '/cutflowcomp/cutflow.yaml', 'output.yaml'
    ])
    p_rhs = subprocess.Popen([
        './runserver.py', IPC_SOCKETNAME,
        str(comparison_id), 'rhs', formdata['dockerImageRHS'],
        formdata['commandRHS'], '/cutflowcomp/cutflow.yaml', 'output.yaml'
    ])
    p_lhs.wait()
    p_rhs.wait()

    print "both processes exited, collecting results"
    context = zmq.Context()
    socket = context.socket(zmq.PUSH)
    socket.connect(IPC_SOCKETNAME)

    results = utils.collect_results(comparison_id)
    socket.send_json({
        'compid': str(comparison_id),
        'to': 'comp_results',
        'results': results
    })
    print "done with task"
def run_comparison(formdata,comparison_id):
    print "running comparison {}".format(comparison_id)
    print "formdata: {}".format(formdata)

    # lhs_container, lhs_command, lhs_

    comparison_home = 'comparisons/{}'.format(comparison_id)
    if not os.path.exists(comparison_home):
        os.makedirs(comparison_home)
    p_lhs = subprocess.Popen(['./runserver.py',IPC_SOCKETNAME,str(comparison_id),'lhs',
                              formdata['dockerImageLHS'],formdata['commandLHS'],
                              '/cutflowcomp/cutflow.yaml','output.yaml'
                              ])
    p_rhs = subprocess.Popen(['./runserver.py',IPC_SOCKETNAME,str(comparison_id),'rhs',
                              formdata['dockerImageRHS'],formdata['commandRHS'],
                              '/cutflowcomp/cutflow.yaml','output.yaml'
                              ])
    p_lhs.wait()
    p_rhs.wait()
    
    print "both processes exited, collecting results"
    context = zmq.Context()
    socket = context.socket(zmq.PUSH)
    socket.connect(IPC_SOCKETNAME)

    results = utils.collect_results(comparison_id)
    socket.send_json({'compid':str(comparison_id),'to':'comp_results','results':results})
    print "done with task"

    
Beispiel #3
0
def join(sid, data):
    print "got data {}".format(data)
    sio.enter_room(sid, data)
    sio.emit("luke", "to_room", room=data)
    # we joined the room and if a existing logile exits, we're sending it now
    for side in ["lhs", "rhs"]:
        logname = "comparisons/{}/{}.log".format(data, side)
        if os.path.exists(logname):
            sio.emit("update_logs", json.dumps({"side": side, "compid": data, "p": open(logname).read()}), room=sid)

    results = {"results": utils.collect_results(data)}
    if results["results"]:
        sio.emit("comp_results", json.dumps(results), room=sid)
Beispiel #4
0
def join(sid, data):
    print "got data {}".format(data)
    sio.enter_room(sid, data)
    sio.emit('luke', 'to_room', room=data)
    #we joined the room and if a existing logile exits, we're sending it now
    for side in ['lhs', 'rhs']:
        logname = 'comparisons/{}/{}.log'.format(data, side)
        if os.path.exists(logname):
            sio.emit('update_logs',
                     json.dumps({
                         'side': side,
                         'compid': data,
                         'p': open(logname).read()
                     }),
                     room=sid)

    results = {'results': utils.collect_results(data)}
    if results['results']:
        sio.emit('comp_results', json.dumps(results), room=sid)