예제 #1
0
def run_p(name):
    process_manager = app.config['PROCESS_MANAGER']
    processor_manager = app.config['PROCESSOR_MANAGER']
    body = request.json
    processor = Processor.from_json_request(body)
    processor = _run_p(name, processor, processor_manager, process_manager)
    response = processor.to_json_response(time.time())
    return jsonify(response)
예제 #2
0
def stop_all_p():
    processor_manager = app.config['PROCESSOR_MANAGER']
    processors = Processor.from_json_request(request.json, many=True)
    names = list(map(lambda psor: psor.name, processors))
    results = []
    for name in names:
        processor = _stop_p(name, processor_manager)
        results.append(processor)
    response = Processor.to_json_responses(*results, time.time())
    return jsonify(response)
예제 #3
0
def run_all_p():
    process_manager = app.config['PROCESS_MANAGER']
    processor_manager = app.config['PROCESSOR_MANAGER']
    body = request.json

    processors = Processor.from_json_request(body, many=True)
    results = []
    for processor in processors:
        name = processor.name
        processor = _run_p(name, processor, processor_manager, process_manager)
        results.append(processor)
    response = Processor.to_json_responses(*results, time.time())
    return jsonify(response)