WenWeiTHU commented on code in PR #9365:
URL: https://github.com/apache/iotdb/pull/9365#discussion_r1141031575


##########
mlnode/iotdb/mlnode/client.py:
##########
@@ -40,12 +73,117 @@ def __init__(self, host, port):
         protocol = TCompactProtocol.TCompactProtocol(transport)
         self.__client = IMLNodeRPCService.Client(protocol)
 
-    def delete_model(self, model_path: str):
-        req = TDeleteModelReq(model_path)
-        return self.__client.deleteModel(req)
+    def create_training_task(self,
+                             model_id: str = 'test',
+                             is_auto: bool = False,
+                             model_configs: dict = {},
+                             query_expressions: list = [],
+                             query_filter: str = ''):
+        req = TCreateTrainingTaskReq(
+            modelId=model_id,
+            isAuto=is_auto,
+            modelConfigs={k: str(v) for k, v in model_configs.items()},
+            queryExpressions=[str(query) for query in query_expressions],
+            queryFilter=query_filter,
+        )
+        return self.__client.createTrainingTask(req)
+
+    def create_forecast_task(self):
+        req = TForecastReq()
+        return self.__client.forecast(req)
+
+    def delete_model(self,
+                     model_id: str = '',
+                     trial_id: str = ''):
+        req = TDeleteModelReq(modelId=model_id, trialId=trial_id)
+        res = self.__client.deleteModel(req)
+        return res
+
+
+class DataNodeClient(object):
+    def __init__(self, host, port):
+        self.__host = host
+        self.__port = port
+
+        transport = TTransport.TFramedTransport(
+            TSocket.TSocket(self.__host, self.__port)
+        )
+        if not transport.isOpen():
+            try:
+                transport.open()
+            except TTransport.TTransportException as e:
+                logger.exception("TTransportException!", exc_info=e)

Review Comment:
   we keep the same behavior like iotdb session: when the transport is not 
open, use the logger.exception



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to