Browse Source

[python] Auto location when create process definition (#11681)

* Add auto format when submit process definition from python api
* add UPDATING.md

close: #8254
3.1.0-release
Jiajie Zhong 2 years ago committed by GitHub
parent
commit
4dca488cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
  2. 7
      dolphinscheduler-python/pydolphinscheduler/UPDATING.md
  3. 14
      dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/core/process_definition.py
  4. 2
      dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/java_gateway.py
  5. 2
      dolphinscheduler-ui/src/views/projects/workflow/components/dag/use-graph-auto-layout.ts

6
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();
}

7
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.

14
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,

2
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,

2
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)
}
}

Loading…
Cancel
Save