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 2023/02/17 07:00:51 UTC

[iotdb] 15/16: add common enum in common.thrift

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

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

commit f1a88c608037a6b3538472889330f893428e104b
Author: Minghui Liu <li...@foxmail.com>
AuthorDate: Mon Jan 30 15:12:29 2023 +0800

    add common enum in common.thrift
---
 .../commons/model/ForecastTrailInformation.java    | 12 +++++++++-
 .../iotdb/commons/model/ModelInformation.java      |  6 ++++-
 .../org/apache/iotdb/commons/model/ModelState.java | 28 ----------------------
 .../org/apache/iotdb/commons/model/ModelTask.java  | 24 -------------------
 .../iotdb/commons/model/TrailInformation.java      | 15 ++++++++++--
 .../org/apache/iotdb/commons/model/TrailState.java | 22 -----------------
 thrift-commons/src/main/thrift/common.thrift       | 22 +++++++++++++++++
 7 files changed, 51 insertions(+), 78 deletions(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/ForecastTrailInformation.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/ForecastTrailInformation.java
index 36ad6800a3..f98d7339ea 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/ForecastTrailInformation.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/model/ForecastTrailInformation.java
@@ -19,4 +19,14 @@
 
 package org.apache.iotdb.commons.model;
 
-public class ForecastTrailInformation extends TrailInformation {}
+import java.nio.ByteBuffer;
+
+public class ForecastTrailInformation extends TrailInformation {
+
+    private long outputLen;
+
+    @Override
+    public ByteBuffer serializeShowTrailResult() {
+        return null;
+    }
+}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java
index d94d16bfd5..308c1d7f36 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelInformation.java
@@ -19,6 +19,8 @@
 
 package org.apache.iotdb.commons.model;
 
+import org.apache.iotdb.common.rpc.thrift.ModelTask;
+import org.apache.iotdb.common.rpc.thrift.TrainingState;
 import org.apache.iotdb.tsfile.utils.PublicBAOS;
 
 import java.io.DataOutputStream;
@@ -33,7 +35,9 @@ public class ModelInformation {
 
   private String modelId;
   private ModelTask modelTask;
-  private ModelState modelState;
+  private String modelType;
+
+  private TrainingState modelState;
 
   private List<String> queryExpressions;
   private String queryFilter;
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelState.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelState.java
deleted file mode 100644
index 37d13ceade..0000000000
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelState.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.commons.model;
-
-public enum ModelState {
-  CREATED,
-  TRAINING,
-  FINISHED,
-  ERROR,
-  UNKNOWN
-}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelTask.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelTask.java
deleted file mode 100644
index 8327c21672..0000000000
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/ModelTask.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.commons.model;
-
-public enum ModelTask {
-  FORECAST
-}
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailInformation.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailInformation.java
index 7dd3831e7c..0b35c3a98e 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailInformation.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailInformation.java
@@ -19,12 +19,23 @@
 
 package org.apache.iotdb.commons.model;
 
+import org.apache.iotdb.common.rpc.thrift.Activation;
+import org.apache.iotdb.common.rpc.thrift.TrainingState;
+
 import java.nio.ByteBuffer;
 
 public abstract class TrailInformation {
 
-  private String trailId;
-  private TrailState trailState;
+  protected String trailId;
+  protected TrainingState trailState;
+
+  protected long batchSize;
+  protected double learningRate;
+  protected long epochs;
+
+  protected long dModel;
+  protected long dFF;
+  protected Activation activation;
 
   public abstract ByteBuffer serializeShowTrailResult();
 }
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailState.java b/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailState.java
deleted file mode 100644
index 5a777a885f..0000000000
--- a/node-commons/src/main/java/org/apache/iotdb/commons/model/TrailState.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.commons.model;
-
-public enum TrailState {}
diff --git a/thrift-commons/src/main/thrift/common.thrift b/thrift-commons/src/main/thrift/common.thrift
index fecceb80a8..108010de8b 100644
--- a/thrift-commons/src/main/thrift/common.thrift
+++ b/thrift-commons/src/main/thrift/common.thrift
@@ -123,3 +123,25 @@ struct TFilesResp {
   1: required TSStatus status
   2: required list<TFile> files
 }
+
+// for MLNode
+enum TrainingState {
+
+}
+
+enum ModelTask {
+  FORECAST
+}
+
+enum EvaluateMetric {
+  MSE,
+  MAE,
+  RMSE
+}
+
+enum Activation {
+  RELU,
+  GELU,
+  SIGMOID,
+  TANH
+}
\ No newline at end of file