Skip to content

Commit

Permalink
[Service] Register pipeline description
Browse files Browse the repository at this point in the history
 - Register pipeline description
 - Add unittest to register pipeline

Signed-off-by: gichan2-jang <[email protected]>
  • Loading branch information
gichan-jang committed Jul 3, 2023
1 parent 17a0438 commit 81d1251
Show file tree
Hide file tree
Showing 10 changed files with 779 additions and 8 deletions.
20 changes: 18 additions & 2 deletions c/include/ml-api-service.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,22 @@ int ml_service_query_create (ml_option_h option, ml_service_h *handle);
*/
int ml_service_query_request (ml_service_h handle, const ml_tensors_data_h input, ml_tensors_data_h *output);

/**
* @brief Creates ml remote service handle with given ml-option handle.
* @details The caller should set one of "remote_sender" and "remote_receiver" as a service type in @a ml_option.
* @remarks The @a handle should be destroyed using ml_service_destroy().
* @param[in] option The option used for creating query service.
* @param[out] handle Newly created query service handle is returned.
* @return @c 0 on Success. Otherwise a negative error value.
* @retval #ML_ERROR_NONE Successful.
* @retval #ML_ERROR_NOT_SUPPORTED Not supported.
* @retval #ML_ERROR_INVALID_PARAMETER Fail. The parameter is invalid.
* @retval #ML_ERROR_OUT_OF_MEMORY Failed to allocate required memory.
* @retval #ML_ERROR_STREAMS_PIPE Failed to launch the pipeline.
* @retval #ML_ERROR_TRY_AGAIN The pipeline is not ready yet.
*/
int ml_remote_service_create (ml_option_h option, ml_service_h *handle);

/**
* @todo DRAFT. API name should be determined later.
* @brief Register new information, such as neural network models or pipeline descriptions, on a remote server.
Expand Down Expand Up @@ -280,7 +296,7 @@ int ml_service_query_request (ml_service_h handle, const ml_tensors_data_h input
* ml_option_set (client_option_h, "dest_host", dest_host, g_free);
*
* // Create query service.
* ml_service_query_create (client_option_h, &client_h);
* ml_remote_service_create (client_option_h, &client_h);
*
* ml_option_h query_option_h = NULL;
* ml_option_create (&query_option_h);
Expand All @@ -302,7 +318,7 @@ int ml_service_query_request (ml_service_h handle, const ml_tensors_data_h input
*
* @endcode
*/
int ml_service_query_register (ml_service_h handle, ml_option_h option, void *data);
int ml_remote_service_register (ml_service_h handle, ml_option_h option, void *data, size_t data_len);

/**
* @brief Registers new information of a neural network model.
Expand Down
15 changes: 11 additions & 4 deletions c/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ endif
nns_capi_single_srcs = files('ml-api-inference-single.c')
nns_capi_pipeline_srcs = files('ml-api-inference-pipeline.c')
nns_capi_service_srcs = files('ml-api-service-common.c','ml-api-service-agent-client.c', 'ml-api-service-query-client.c')
if nnstreamer_edge_dep.found()
nns_capi_service_srcs += files('ml-api-remote-service.c')
endif

# Build ML-API Common Lib First.
nns_capi_common_shared_lib = shared_library ('capi-ml-common',
Expand Down Expand Up @@ -97,12 +100,16 @@ nns_capi_dep = declare_dependency(link_with: nns_capi_lib,
include_directories: nns_capi_include
)


# Service API
if get_option('enable-ml-service')
ml_service_deps = [nns_capi_dep, ml_agentd_deps]
if nnstreamer_edge_dep.found()
ml_service_deps += nnstreamer_edge_dep
endif

nns_capi_service_shared_lib = shared_library ('capi-ml-service',
nns_capi_service_srcs,
dependencies: [nns_capi_dep, ml_agentd_deps],
dependencies: ml_service_deps,
include_directories: [nns_capi_include, ml_agentd_incs],
install: true,
install_dir: api_install_libdir,
Expand All @@ -112,7 +119,7 @@ if get_option('enable-ml-service')

nns_capi_service_static_lib = static_library ('capi-ml-service',
nns_capi_service_srcs,
dependencies: [nns_capi_dep, ml_agentd_deps],
dependencies: ml_service_deps,
include_directories: [nns_capi_include, ml_agentd_incs],
install: true,
link_with: ml_agentd_lib,
Expand All @@ -125,7 +132,7 @@ if get_option('enable-ml-service')
endif

nns_capi_service_dep = declare_dependency(link_with: nns_capi_service_lib,
dependencies: [nns_capi_dep, ml_agentd_deps],
dependencies: ml_service_deps,
include_directories: nns_capi_include
)
endif
Loading

0 comments on commit 81d1251

Please sign in to comment.