You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/08/27 15:38:56 UTC

[dolphinscheduler] branch dev updated: [python] Auto location when create process definition (#11681)

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

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4dca488cd5 [python] Auto location when create process definition (#11681)
4dca488cd5 is described below

commit 4dca488cd50b4392d222167c01ae2a79fd295e77
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Sat Aug 27 23:38:46 2022 +0800

    [python] Auto location when create process definition (#11681)
    
    * Add auto format when submit process definition from python api
    * add UPDATING.md
    
    close: #8254
---
 .../apache/dolphinscheduler/api/python/PythonGateway.java  |  6 ++----
 dolphinscheduler-python/pydolphinscheduler/UPDATING.md     |  7 ++++---
 .../src/pydolphinscheduler/core/process_definition.py      | 14 --------------
 .../src/pydolphinscheduler/java_gateway.py                 |  2 --
 .../workflow/components/dag/use-graph-auto-layout.ts       |  2 ++
 5 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
index 2f7f9b9e61..bcb62f7333 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
@@ -203,7 +203,6 @@ public class PythonGateway {
      * and if would always fresh exists schedule if not null
      * @param warningType warning type
      * @param warningGroupId warning group id
-     * @param locations locations json object about all tasks
      * @param timeout timeout for process definition working, if running time longer than timeout,
      * task will mark as fail
      * @param workerGroup run task in which worker group
@@ -221,7 +220,6 @@ public class PythonGateway {
                                                 String schedule,
                                                 String warningType,
                                                 int warningGroupId,
-                                                String locations,
                                                 int timeout,
                                                 String workerGroup,
                                                 String tenantCode,
@@ -242,10 +240,10 @@ public class PythonGateway {
             // make sure process definition offline which could edit
             processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
             Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams,
-                    locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
+                    null, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
         } else {
             Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
-                    locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
+                null, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
             processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
             processDefinitionCode = processDefinition.getCode();
         }
diff --git a/dolphinscheduler-python/pydolphinscheduler/UPDATING.md b/dolphinscheduler-python/pydolphinscheduler/UPDATING.md
index d772c6f8f6..448ac37e15 100644
--- a/dolphinscheduler-python/pydolphinscheduler/UPDATING.md
+++ b/dolphinscheduler-python/pydolphinscheduler/UPDATING.md
@@ -24,10 +24,9 @@ It started after version 2.0.5 released
 
 ## dev
 
-* Change variable about where to keep pydolphinscheduler configuration from ``PYDOLPHINSCHEDULER_HOME`` to
-  ``PYDS_HOME`` which is same as other environment variable name.
+* Remove parameter ``task_location`` in process definition and Java Gateway service ([#11681](https://github.com/apache/dolphinscheduler/pull/11681))
 
-## 3.0.0a0
+## 3.0.0
 
 * Integrate Python gateway server into Dolphinscheduler API server, and you could start Python gateway service by command
   `./bin/dolphinscheduler-daemon.sh start api-server` instead of independent command
@@ -35,3 +34,5 @@ It started after version 2.0.5 released
 * Remove parameter `queue` from class `ProcessDefinition` to avoid confuse user when it change but not work
 * Change `yaml_parser.py` method `to_string` to magic method `__str__` make it more pythonic.
 * Use package ``ruamel.yaml`` replace ``pyyaml`` for write yaml file with comment.
+* Change variable about where to keep pydolphinscheduler configuration from ``PYDOLPHINSCHEDULER_HOME`` to
+  ``PYDS_HOME`` which is same as other environment variable name.
\ No newline at end of file
diff --git a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py
index 980b18e96d..df05b01ede 100644
--- a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py
+++ b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py
@@ -274,19 +274,6 @@ class ProcessDefinition(Base):
                 "timezoneId": self.timezone,
             }
 
-    # TODO inti DAG's tasks are in the same location with default {x: 0, y: 0}
-    @property
-    def task_location(self) -> List[Dict]:
-        """Return all tasks location for all process definition.
-
-        For now, we only set all location with same x and y valued equal to 0. Because we do not
-        find a good way to set task locations. This is requests from java gateway interface.
-        """
-        if not self.tasks:
-            return [self.tasks]
-        else:
-            return [{"taskCode": task_code, "x": 0, "y": 0} for task_code in self.tasks]
-
     @property
     def task_list(self) -> List["Task"]:  # noqa: F821
         """Return list of tasks objects."""
@@ -400,7 +387,6 @@ class ProcessDefinition(Base):
             json.dumps(self.param_json),
             self.warning_type,
             self.warning_group_id,
-            json.dumps(self.task_location),
             self.timeout,
             self.worker_group,
             self._tenant,
diff --git a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/java_gateway.py b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/java_gateway.py
index a460a466bb..59d411b62c 100644
--- a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/java_gateway.py
+++ b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/java_gateway.py
@@ -165,7 +165,6 @@ class JavaGate:
         global_params: str,
         warning_type: str,
         warning_group_id: int,
-        locations: str,
         timeout: int,
         worker_group: str,
         tenant_code: str,
@@ -186,7 +185,6 @@ class JavaGate:
             schedule,
             warning_type,
             warning_group_id,
-            locations,
             timeout,
             worker_group,
             tenant_code,
diff --git a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-graph-auto-layout.ts b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-graph-auto-layout.ts
index 853e7adc63..b662b192ef 100644
--- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-graph-auto-layout.ts
+++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-graph-auto-layout.ts
@@ -155,6 +155,8 @@ export function useGraphAutoLayout(options: Options) {
         format(formValue.value)
         toggle(false)
       })
+    } else {
+      format({} as LayoutConfig)
     }
   }