예제 #1
0
def create_service(template_id, service_name, model_storage, resource_storage,
                   plugin_manager, logger):
    """
    Creates a service from the specified service template
    """
    body = request.json
    inputs = {}
    if 'inputs' in body:
        inputs = body['inputs']
    core = Core(model_storage, resource_storage, plugin_manager)
    service = core.create_service(template_id, inputs, service_name)

    logger.info("service {} created".format(service.name))
    return "service {} created".format(service.name), 200
예제 #2
0
def create_service(template_id, service_name, model_storage, resource_storage,
                   plugin_manager, logger):
    """
    Creates a service from the specified service template
    """
    body = request.json or {}
    if "multipart/form-data" in request.headers['Content-Type']:
        body = json.load(request.files['input_values']._file)
    inputs = {}
    if 'inputs' in body:
        inputs = body['inputs']
    core = Core(model_storage, resource_storage, plugin_manager)
    service = core.create_service(template_id, inputs, service_name)

    logger.info("service {} created".format(service.name))
    return "service {} created".format(service.name), 200, service