You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hu...@apache.org on 2022/12/29 14:37:40 UTC

[iotdb] 01/05: define req & resp

This is an automated email from the ASF dual-hosted git repository.

hui pushed a commit to branch ml/thrift
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit a000b57b87db9b0012d04829ce19a9c679f19a5b
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Thu Dec 29 22:09:05 2022 +0800

    define req & resp
---
 .../src/main/thrift/confignode.thrift              | 59 ++++++++++++++---
 thrift-mlnode/src/main/thrift/mlnode.thrift        | 38 +++++++----
 thrift/src/main/thrift/datanode.thrift             | 76 ++++++++++++++++++++--
 3 files changed, 147 insertions(+), 26 deletions(-)

diff --git a/thrift-confignode/src/main/thrift/confignode.thrift b/thrift-confignode/src/main/thrift/confignode.thrift
index 670104b1ee..81a2393e2d 100644
--- a/thrift-confignode/src/main/thrift/confignode.thrift
+++ b/thrift-confignode/src/main/thrift/confignode.thrift
@@ -654,23 +654,62 @@ struct TUnsetSchemaTemplateReq{
   3: required string path
 }
 
-struct TCreateModelReq {}
+struct TCreateModelReq {
+  1: required string modelId
+  2: required byte modelTask
+  3: required bool isAuto
+  4: required map<string, string> modelConfigs
+  5: required list<string> queryExpressions
+  6: optional string queryFilter
+}
+
+struct TDropModelReq {
+  1: required string modelId
+}
+
+struct TShowModelReq {
+  1: optional string queriedModelId
+}
 
-struct TDropModelReq {}
+struct TModelInfo {
+  1: required string modelId
+  2: required map<string, string> modelInfo
+}
 
-struct TShowModelReq {}
+struct TShowModelResp {
+  1: required common.TSStatus status
+  2: required list<TModelInfo> modelInfoList
+}
 
-struct TShowModelResp {}
+struct TShowTrailReq {
+  1: required string modelId
+  2: optional string trailId
+}
 
-struct TShowTrailReq {}
+struct TTrailInfo {
+  1: required string modelId
+  2: required string trailId
+  3: required map<string, string> trailInfo
+}
 
-struct TShowTrailResp {}
+struct TShowTrailResp {
+  1: required common.TSStatus status
+  2: required list<TTrailInfo> trailInfoList
+}
 
-struct TGetModelInfoReq {}
+struct TGetModelInfoReq {
+  1: required string modelId
+}
 
-struct TGetModelInfoResp {}
+struct TGetModelInfoResp {
+  1: required common.TSStatus status
+  2: required TModelInfo modelInfo
+}
 
-struct TUpdateModelInfoReq {}
+struct TUpdateModelInfoReq {
+  1: required string modelId
+  2: required map<string, string> modelInfo
+}
 
 service IConfigNodeRPCService {
 
@@ -1190,7 +1229,7 @@ service IConfigNodeRPCService {
   /**
    * Return the model table
    */
-  TShowModelResp showModel(TShowModelReq req)
+  TShowModelResp showModels(TShowModelReq req)
 
   /**
    * Return the trail table
diff --git a/thrift-mlnode/src/main/thrift/mlnode.thrift b/thrift-mlnode/src/main/thrift/mlnode.thrift
index 6d38dd7592..26e5267d16 100644
--- a/thrift-mlnode/src/main/thrift/mlnode.thrift
+++ b/thrift-mlnode/src/main/thrift/mlnode.thrift
@@ -20,23 +20,37 @@
 include "common.thrift"
 namespace py iotdb.thrift.mlnode
 
-struct TCreateTrainingTaskReq {}
-
-struct TDeleteModelReq {}
-
-struct TForecastReq {}
-
-struct TForecastResp {}
+struct TCreateTrainingTaskReq {
+  1: required string modelId
+  3: required bool isAuto
+  4: required map<string, string> modelConfigs
+  5: required list<string> queryExpressions
+  6: optional string queryFilter
+}
+
+struct TDeleteModelReq {
+  1: required string modelPath
+}
+
+struct TForecastReq {
+  1: required string modelPath
+  2: required list<binary> dataset
+}
+
+struct TForecastResp {
+  1: required common.TSStatus status
+  2: required binary forecastResult
+}
 
 service IMLNodeRPCService {
 
-    // -------------- For Config Node --------------
+  // -------------- For Config Node --------------
 
-    common.TSStatus createTrainingTask(TCreateTrainingTaskReq req)
+  common.TSStatus createTrainingTask(TCreateTrainingTaskReq req)
 
-    common.TSStatus deleteModel(TDeleteModelReq req)
+  common.TSStatus deleteModel(TDeleteModelReq req)
 
-    // -------------- For Data Node --------------
+  // -------------- For Data Node --------------
 
-    TForecastResp forecast(TForecastReq req)
+  TForecastResp forecast(TForecastReq req)
 }
\ No newline at end of file
diff --git a/thrift/src/main/thrift/datanode.thrift b/thrift/src/main/thrift/datanode.thrift
index 87f6519a38..1558755c45 100644
--- a/thrift/src/main/thrift/datanode.thrift
+++ b/thrift/src/main/thrift/datanode.thrift
@@ -351,13 +351,67 @@ struct TExecuteCQ {
   7: required string username
 }
 
-struct TDeleteModelMetricsReq {}
+// ====================================================
+// ML Node
+// ====================================================
+struct TDeleteModelMetricsReq {
+  1: required string modelId
+}
+
+struct TFetchTimeseriesReq {
+  1: required i64 sessionId
+  2: required i64 statementId
+  3: required list<string> queryExpressions
+  4: optional string queryFilter
+  5: optional i32 fetchSize
+  6: optional i64 timeout
+}
+
+struct TFetchTimeseriesResp {
+  1: required common.TSStatus status
+  2: required i64 queryId
+  3: required list<string> columnNameList
+  4: required list<string> columnTypeList
+  5: required map<string, i32> columnNameIndexMap
+  6: required list<binary> tsDataset
+  7: required bool hasMoreData
+}
 
-struct TFetchWindowBatchReq {}
+struct TFetchWindowBatchReq {
+  1: required i64 sessionId
+  2: required i64 statementId
+  3: required list<string> queryExpressions
+  4: required TGroupByTimeParameter groupByTimeParameter
+  5: optional string queryFilter
+  6: optional i32 fetchSize
+  7: optional i64 timeout
+}
 
-struct TFetchWindowBatchResp {}
+struct TGroupByTimeParameter {
+  1: required i64 startTime
+  2: required i64 endTime
+  3: required i64 interval
+  4: required i64 slidingStep
+  5: optional list<i32> indexes
+}
 
-struct TRecordModelMetricsReq {}
+struct TFetchWindowBatchResp {
+  1: required common.TSStatus status
+  2: required i64 queryId
+  3: required list<string> columnNameList
+  4: required list<string> columnTypeList
+  5: required map<string, i32> columnNameIndexMap
+  6: required list<list<binary>> windowDataset
+  7: required bool hasMoreData
+}
+
+struct TRecordModelMetricsReq {
+  1: required string modelId
+  2: required string trialId
+  3: required list<string> metrics
+  4: required i64 timestamp
+  5: required list<double> values
+}
 
 service IDataNodeRPCService {
 
@@ -651,12 +705,26 @@ service IDataNodeRPCService {
   */
   common.TSStatus executeCQ(TExecuteCQ req)
 
+ /**
+  * Delete model training metrics on DataNode
+  */
   common.TSStatus deleteModelMetrics(TDeleteModelMetricsReq req)
 
   // ----------------------------------- For ML Node -----------------------------------------------
 
+ /**
+  * Fecth the data of the specified time series
+  */
+  TFetchTimeseriesResp fetchTimeseries(TFetchTimeseriesReq req)
+
+ /**
+  * Fecth window batches of the specified time series
+  */
   TFetchWindowBatchResp fetchWindowBatch(TFetchWindowBatchReq req)
 
+ /**
+  * Record model training metrics on DataNode
+  */
   common.TSStatus recordModelMetrics(TRecordModelMetricsReq req)
 }