Skip to content

Commit c411546

Browse files
committed
[fix] Remove tenant arg in workflow definition (#13212)
current tenant in workflow only work when the first time user do not exist, when user change the tenant in workflow but tenant exist, it will be ignore, so we try to remove it from workflow, and in #40 we try to create both user and tenant vis cli instead of auto create
1 parent 71a2d38 commit c411546

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python

dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ public Map<String, Long> getCodeAndVersion(String projectName, String processDef
220220
* @param timeout timeout for workflow working, if running time longer than timeout,
221221
* task will mark as fail
222222
* @param workerGroup run task in which worker group
223-
* @param tenantCode tenantCode
224223
* @param taskRelationJson relation json for nodes
225224
* @param taskDefinitionJson taskDefinitionJson
226225
* @param otherParamsJson otherParamsJson handle other params
@@ -236,13 +235,16 @@ public Long createOrUpdateWorkflow(String userName,
236235
int warningGroupId,
237236
int timeout,
238237
String workerGroup,
239-
String tenantCode,
240238
int releaseState,
241239
String taskRelationJson,
242240
String taskDefinitionJson,
243241
String otherParamsJson,
244242
String executionType) {
245243
User user = usersService.queryUser(userName);
244+
if (user.getTenantCode() == null) {
245+
throw new RuntimeException("Can not create or update workflow for user who not related to any tenant.");
246+
}
247+
246248
Project project = projectMapper.queryByName(projectName);
247249
long projectCode = project.getCode();
248250

@@ -257,12 +259,12 @@ public Long createOrUpdateWorkflow(String userName,
257259
ReleaseState.OFFLINE);
258260
processDefinitionService.updateProcessDefinition(user, projectCode, name,
259261
processDefinitionCode, description, globalParams,
260-
null, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson,
262+
null, timeout, user.getTenantCode(), taskRelationJson, taskDefinitionJson, otherParamsJson,
261263
executionTypeEnum);
262264
} else {
263265
Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name,
264266
description, globalParams,
265-
null, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson,
267+
null, timeout, user.getTenantCode(), taskRelationJson, taskDefinitionJson, otherParamsJson,
266268
executionTypeEnum);
267269
processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
268270
processDefinitionCode = processDefinition.getCode();

0 commit comments

Comments
 (0)