Skip to content

Commit

Permalink
[Android] include database
Browse files Browse the repository at this point in the history
Separate node info for pipeline, and include mlops database based on sqlite to build android library.

Signed-off-by: Jaeyun Jung <[email protected]>
  • Loading branch information
jaeyun-jung committed Jan 20, 2025
1 parent dd9e8b1 commit 35e5a32
Show file tree
Hide file tree
Showing 8 changed files with 375 additions and 214 deletions.
2 changes: 1 addition & 1 deletion daemon/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Machine Learning Agent
ml_agent_incs = include_directories('.', 'include')
ml_agent_lib_srcs = files('modules.c', 'gdbus-util.c', 'mlops-agent-interface.c',
ml_agent_lib_srcs = files('modules.c', 'gdbus-util.c', 'mlops-agent-interface.c', 'mlops-agent-node.c',
'pipeline-dbus-impl.cc', 'model-dbus-impl.cc', 'resource-dbus-impl.cc', 'service-db.cc')

ml_agent_deps = [
Expand Down
40 changes: 22 additions & 18 deletions daemon/mlops-agent-android.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "log.h"
#include "mlops-agent-interface.h"
#include "mlops-agent-internal.h"
#include "mlops-agent-node.h"
#include "service-db-util.h"

/**
* @brief An interface exported for setting the description of a pipeline.
Expand All @@ -26,7 +28,7 @@ ml_agent_pipeline_set_description (const char *name, const char *pipeline_desc)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_pipeline_set (name, pipeline_desc);
}

/**
Expand All @@ -39,7 +41,7 @@ ml_agent_pipeline_get_description (const char *name, char **pipeline_desc)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_pipeline_get (name, pipeline_desc);
}

/**
Expand All @@ -52,7 +54,7 @@ ml_agent_pipeline_delete (const char *name)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_pipeline_delete (name);
}

/**
Expand All @@ -65,7 +67,7 @@ ml_agent_pipeline_launch (const char *name, int64_t * id)
g_return_val_if_reached (-EINVAL);
}

return 0;
return mlops_node_create (name, MLOPS_NODE_TYPE_PIPELINE, id);
}

/**
Expand All @@ -74,7 +76,7 @@ ml_agent_pipeline_launch (const char *name, int64_t * id)
int
ml_agent_pipeline_start (const int64_t id)
{
return 0;
return mlops_node_start (id);
}

/**
Expand All @@ -83,7 +85,7 @@ ml_agent_pipeline_start (const int64_t id)
int
ml_agent_pipeline_stop (const int64_t id)
{
return 0;
return mlops_node_stop (id);
}

/**
Expand All @@ -92,7 +94,7 @@ ml_agent_pipeline_stop (const int64_t id)
int
ml_agent_pipeline_destroy (const int64_t id)
{
return 0;
return mlops_node_destroy (id);
}

/**
Expand All @@ -101,7 +103,7 @@ ml_agent_pipeline_destroy (const int64_t id)
int
ml_agent_pipeline_get_state (const int64_t id, int *state)
{
return 0;
return mlops_node_get_state (id, (GstState *) state);
}

/**
Expand All @@ -115,7 +117,8 @@ ml_agent_model_register (const char *name, const char *path,
if (!STR_IS_VALID (name) || !STR_IS_VALID (path) || !version) {
g_return_val_if_reached (-EINVAL);
}
return 0;

return svcdb_model_add (name, path, activate, description, app_info, version);
}

/**
Expand All @@ -128,7 +131,8 @@ ml_agent_model_update_description (const char *name,
if (!STR_IS_VALID (name) || !STR_IS_VALID (description) || version == 0U) {
g_return_val_if_reached (-EINVAL);
}
return 0;

return svcdb_model_update_description (name, version, description);
}

/**
Expand All @@ -141,7 +145,7 @@ ml_agent_model_activate (const char *name, const uint32_t version)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_model_activate (name, version);
}

/**
Expand All @@ -154,7 +158,7 @@ ml_agent_model_get (const char *name, const uint32_t version, char **model_info)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_model_get (name, version, model_info);
}

/**
Expand All @@ -167,7 +171,7 @@ ml_agent_model_get_activated (const char *name, char **model_info)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_model_get_activated (name, model_info);
}

/**
Expand All @@ -180,7 +184,7 @@ ml_agent_model_get_all (const char *name, char **model_info)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_model_get_all (name, model_info);
}

/**
Expand All @@ -195,7 +199,7 @@ ml_agent_model_delete (const char *name, const uint32_t version,
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_model_delete (name, version, force);
}

/**
Expand All @@ -209,7 +213,7 @@ ml_agent_resource_add (const char *name, const char *path,
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_resource_add (name, path, description, app_info);
}

/**
Expand All @@ -222,7 +226,7 @@ ml_agent_resource_delete (const char *name)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_resource_delete (name);
}

/**
Expand All @@ -235,5 +239,5 @@ ml_agent_resource_get (const char *name, char **res_info)
g_return_val_if_reached (-EINVAL);
}

return 0;
return svcdb_resource_get (name, res_info);
}
5 changes: 3 additions & 2 deletions daemon/mlops-agent-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ ml_agent_pipeline_set_description (const char *name, const char *pipeline_desc)
{
MachinelearningServicePipeline *mlsp;
gboolean result;
gint ret;

if (!STR_IS_VALID (name) || !STR_IS_VALID (pipeline_desc)) {
g_return_val_if_reached (-EINVAL);
Expand All @@ -213,10 +214,10 @@ ml_agent_pipeline_set_description (const char *name, const char *pipeline_desc)
}

result = machinelearning_service_pipeline_call_set_pipeline_sync (mlsp,
name, pipeline_desc, NULL, NULL, NULL);
name, pipeline_desc, &ret, NULL, NULL);
g_object_unref (mlsp);

g_return_val_if_fail (result, -EIO);
g_return_val_if_fail (ret == 0 && result, ret);
return 0;
}

Expand Down
Loading

0 comments on commit 35e5a32

Please sign in to comment.