status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId); } /** * find sub process instance * * @param parentProcessId parentProcessId * @param parentTaskId parentTaskId * @return process instance */ @Override public ProcessInstance findSubProcessInstance(Integer parentProcessId, Integer parentTaskId) { ProcessInstance processInstance = null; ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryByParentId(parentProcessId, parentTaskId); if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) { return processInstance; } processInstance = findProcessInstanceById(processInstanceMap.getProcessInstanceId()); return processInstance; } /** * find parent process instance * * @param subProcessId subProcessId * @return process instance */ @Override public ProcessInstance findParentProcessInstance(Integer subProcessId) { ProcessInstance processInstance = null; ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(subProcessId); if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
return processInstance; } processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId()); return processInstance; } /** * update process instance * * @param processInstance processInstance * @return update process instance result */ @Override public int updateProcessInstance(ProcessInstance processInstance) { return processInstanceMapper.updateById(processInstance); } /** * for show in page of taskInstance */ @Override public void changeOutParam(TaskInstance taskInstance) { if (Strings.isNullOrEmpty(taskInstance.getVarPool())) { return; } List<Property> properties = JSONUtils.toList(taskInstance.getVarPool(), Property.class); if (CollectionUtils.isEmpty(properties)) { return; } Map<String, Object> taskParams = JSONUtils.parseObject(taskInstance.getTaskParams(), new TypeReference<Map<String, Object>>() { });
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
Object localParams = taskParams.get(LOCAL_PARAMS); if (localParams == null) { return; } List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class); Map<String, String> outProperty = new HashMap<>(); for (Property info : properties) { if (info.getDirect() == Direct.OUT) { outProperty.put(info.getProp(), info.getValue()); } } for (Property info : allParam) { if (info.getDirect() == Direct.OUT) { String paramName = info.getProp(); info.setValue(outProperty.get(paramName)); } } taskParams.put(LOCAL_PARAMS, allParam); taskInstance.setTaskParams(JSONUtils.toJsonString(taskParams)); } /** * convert integer list to string list * * @param intList intList * @return string list */ private List<String> convertIntListToString(List<Integer> intList) { if (intList == null) { return new ArrayList<>(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
List<String> result = new ArrayList<>(intList.size()); for (Integer intVar : intList) { result.add(String.valueOf(intVar)); } return result; } /** * query schedule by id * * @param id id * @return schedule */ @Override public Schedule querySchedule(int id) { return scheduleMapper.selectById(id); } /** * query Schedule by processDefinitionCode * * @param processDefinitionCode processDefinitionCode * @see Schedule */ @Override public List<Schedule> queryReleaseSchedulerListByProcessDefinitionCode(long processDefinitionCode) { return scheduleMapper.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode); } /** * query Schedule by processDefinitionCode * * @param processDefinitionCodeList processDefinitionCodeList
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* @see Schedule */ @Override public Map<Long, String> queryWorkerGroupByProcessDefinitionCodes(List<Long> processDefinitionCodeList) { List<Schedule> processDefinitionScheduleList = scheduleMapper.querySchedulesByProcessDefinitionCodes(processDefinitionCodeList); return processDefinitionScheduleList.stream().collect(Collectors.toMap(Schedule::getProcessDefinitionCode, Schedule::getWorkerGroup)); } /** * query dependent process definition by process definition code * * @param processDefinitionCode processDefinitionCode * @see DependentProcessDefinition */ @Override public List<DependentProcessDefinition> queryDependentProcessDefinitionByProcessDefinitionCode(long processDefinitionCode) { return workFlowLineageMapper.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode); } /** * query need failover process instance * * @param host host * @return process instance list */ @Override public List<ProcessInstance> queryNeedFailoverProcessInstances(String host) { return processInstanceMapper.queryByHostAndStatus(host, ExecutionStatus.getNeedFailoverWorkflowInstanceState()); } @Override public List<String> queryNeedFailoverProcessInstanceHost() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
return processInstanceMapper.queryNeedFailoverProcessInstanceHost(ExecutionStatus.getNeedFailoverWorkflowInstanceState()); } /** * process need failover process instance * * @param processInstance processInstance */ @Override @Transactional(rollbackFor = RuntimeException.class) public void processNeedFailoverProcessInstances(ProcessInstance processInstance) { processInstance.setHost(Constants.NULL); processInstanceMapper.updateById(processInstance); ProcessDefinition processDefinition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); Command cmd = new Command(); cmd.setProcessDefinitionCode(processDefinition.getCode()); cmd.setProcessDefinitionVersion(processDefinition.getVersion()); cmd.setProcessInstanceId(processInstance.getId()); cmd.setCommandParam(String.format("{\"%s\":%d}", Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId())); cmd.setExecutorId(processInstance.getExecutorId()); cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS); createCommand(cmd); } /** * query all need failover task instances by host * * @param host host * @return task instance list */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@Override public List<TaskInstance> queryNeedFailoverTaskInstances(String host) { return taskInstanceMapper.queryByHostAndStatus(host, ExecutionStatus.getNeedFailoverWorkflowInstanceState()); } /** * find data source by id * * @param id id * @return datasource */ @Override public DataSource findDataSourceById(int id) { return dataSourceMapper.selectById(id); } /** * update process instance state by id * * @param processInstanceId processInstanceId * @param executionStatus executionStatus * @return update process result */ @Override public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) { ProcessInstance instance = processInstanceMapper.selectById(processInstanceId); instance.setState(executionStatus); return processInstanceMapper.updateById(instance); } /** * find process instance by the task id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* * @param taskId taskId * @return process instance */ @Override public ProcessInstance findProcessInstanceByTaskId(int taskId) { TaskInstance taskInstance = taskInstanceMapper.selectById(taskId); if (taskInstance != null) { return processInstanceMapper.selectById(taskInstance.getProcessInstanceId()); } return null; } /** * find udf function list by id list string * * @param ids ids * @return udf function list */ @Override public List<UdfFunc> queryUdfFunListByIds(Integer[] ids) { return udfFuncMapper.queryUdfByIdStr(ids, null); } /** * find tenant code by resource name * * @param resName resource name * @param resourceType resource type * @return tenant code */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
public String queryTenantCodeByResName(String resName, ResourceType resourceType) { String fullName = resName.startsWith("/") ? resName : String.format("/%s", resName); List<Resource> resourceList = resourceMapper.queryResource(fullName, resourceType.ordinal()); if (CollectionUtils.isEmpty(resourceList)) { return ""; } int userId = resourceList.get(0).getUserId(); User user = userMapper.selectById(userId); if (Objects.isNull(user)) { return ""; } Tenant tenant = tenantMapper.queryById(user.getTenantId()); if (Objects.isNull(tenant)) { return ""; } return tenant.getTenantCode(); } /** * find schedule list by process define codes. * * @param codes codes * @return schedule list */ @Override public List<Schedule> selectAllByProcessDefineCode(long[] codes) { return scheduleMapper.selectAllByProcessDefineArray(codes); } /** * find last scheduler process instance in the date interval
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* * @param definitionCode definitionCode * @param dateInterval dateInterval * @return process instance */ @Override public ProcessInstance findLastSchedulerProcessInterval(Long definitionCode, DateInterval dateInterval) { return processInstanceMapper.queryLastSchedulerProcess(definitionCode, dateInterval.getStartTime(), dateInterval.getEndTime()); } /** * find last manual process instance interval * * @param definitionCode process definition code * @param dateInterval dateInterval * @return process instance */ @Override public ProcessInstance findLastManualProcessInterval(Long definitionCode, DateInterval dateInterval) { return processInstanceMapper.queryLastManualProcess(definitionCode, dateInterval.getStartTime(), dateInterval.getEndTime()); } /** * find last running process instance * * @param definitionCode process definition code * @param startTime start time * @param endTime end time
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* @return process instance */ @Override public ProcessInstance findLastRunningProcess(Long definitionCode, Date startTime, Date endTime) { return processInstanceMapper.queryLastRunningProcess(definitionCode, startTime, endTime, ExecutionStatus.getNeedFailoverWorkflowInstanceState()); } /** * query user queue by process instance * * @param processInstance processInstance * @return queue */ @Override public String queryUserQueueByProcessInstance(ProcessInstance processInstance) { String queue = ""; if (processInstance == null) { return queue; } User executor = userMapper.selectById(processInstance.getExecutorId()); if (executor != null) { queue = executor.getQueue(); } return queue; } /** * query project name and user name by processInstanceId. *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* @param processInstanceId processInstanceId * @return projectName and userName */ @Override public ProjectUser queryProjectWithUserByProcessInstanceId(int processInstanceId) { return projectMapper.queryProjectWithUserByProcessInstanceId(processInstanceId); } /** * get task worker group * * @param taskInstance taskInstance * @return workerGroupId */ @Override public String getTaskWorkerGroup(TaskInstance taskInstance) { String workerGroup = taskInstance.getWorkerGroup(); if (!Strings.isNullOrEmpty(workerGroup)) { return workerGroup; } int processInstanceId = taskInstance.getProcessInstanceId(); ProcessInstance processInstance = findProcessInstanceById(processInstanceId); if (processInstance != null) { return processInstance.getWorkerGroup(); } logger.info("task : {} will use default worker group", taskInstance.getId()); return Constants.DEFAULT_WORKER_GROUP; } /** * get have perm project list *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* @param userId userId * @return project list */ @Override public List<Project> getProjectListHavePerm(int userId) { List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId); List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId); if (createProjects == null) { createProjects = new ArrayList<>(); } if (authedProjects != null) { createProjects.addAll(authedProjects); } return createProjects; } /** * list unauthorized udf function * * @param userId user id * @param needChecks data source id array * @return unauthorized udf function list */ @Override public <T> List<T> listUnauthorized(int userId, T[] needChecks, AuthorizationType authorizationType) { List<T> resultList = new ArrayList<>(); if (Objects.nonNull(needChecks) && needChecks.length > 0) { Set<T> originResSet = new HashSet<>(Arrays.asList(needChecks)); switch (authorizationType) { case RESOURCE_FILE_ID: case UDF_FILE:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
List<Resource> ownUdfResources = resourceMapper.listAuthorizedResourceById(userId, needChecks); addAuthorizedResources(ownUdfResources, userId); Set<Integer> authorizedResourceFiles = ownUdfResources.stream().map(Resource::getId).collect(toSet()); originResSet.removeAll(authorizedResourceFiles); break; case RESOURCE_FILE_NAME: List<Resource> ownResources = resourceMapper.listAuthorizedResource(userId, needChecks); addAuthorizedResources(ownResources, userId); Set<String> authorizedResources = ownResources.stream().map(Resource::getFullName).collect(toSet()); originResSet.removeAll(authorizedResources); break; case DATASOURCE: Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId, needChecks).stream().map(DataSource::getId).collect(toSet()); originResSet.removeAll(authorizedDatasources); break; case UDF: Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet()); originResSet.removeAll(authorizedUdfs); break; default: break; } resultList.addAll(originResSet); } return resultList; } /** * get user by user id * * @param userId user id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
* @return User */ @Override public User getUserById(int userId) { return userMapper.selectById(userId); } /** * get resource by resource id * * @param resourceId resource id * @return Resource */ @Override public Resource getResourceById(int resourceId) { return resourceMapper.selectById(resourceId); } /** * list resources by ids * * @param resIds resIds * @return resource list */ @Override public List<Resource> listResourceByIds(Integer[] resIds) { return resourceMapper.listResourceByIds(resIds); } /** * format task app id in task instance */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
public String formatTaskAppId(TaskInstance taskInstance) { ProcessInstance processInstance = findProcessInstanceById(taskInstance.getProcessInstanceId()); if (processInstance == null) { return ""; } ProcessDefinition definition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); if (definition == null) { return ""; } return String.format("%s_%s_%s", definition.getId(), processInstance.getId(), taskInstance.getId()); } /** * switch process definition version to process definition log version */ @Override public int switchVersion(ProcessDefinition processDefinition, ProcessDefinitionLog processDefinitionLog) { if (null == processDefinition || null == processDefinitionLog) { return Constants.DEFINITION_FAILURE; } processDefinitionLog.setId(processDefinition.getId()); processDefinitionLog.setReleaseState(ReleaseState.OFFLINE); processDefinitionLog.setFlag(Flag.YES); int result = processDefineMapper.updateById(processDefinitionLog); if (result > 0) { result = switchProcessTaskRelationVersion(processDefinitionLog); if (result <= 0) { return Constants.EXIT_CODE_FAILURE; } } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} @Override public int switchProcessTaskRelationVersion(ProcessDefinition processDefinition) { List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()); if (!processTaskRelationList.isEmpty()) { processTaskRelationMapper.deleteByCode(processDefinition.getProjectCode(), processDefinition.getCode()); } List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); int batchInsert = processTaskRelationMapper.batchInsert(processTaskRelationLogList); if (batchInsert == 0) { return Constants.EXIT_CODE_FAILURE; } else { int result = 0; for (ProcessTaskRelationLog taskRelationLog : processTaskRelationLogList) { int switchResult = switchTaskDefinitionVersion(taskRelationLog.getPostTaskCode(), taskRelationLog.getPostTaskVersion()); if (switchResult != Constants.EXIT_CODE_FAILURE) { result++; } } return result; } } @Override public int switchTaskDefinitionVersion(long taskCode, int taskVersion) { TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (taskDefinition == null) { return Constants.EXIT_CODE_FAILURE; } if (taskDefinition.getVersion() == taskVersion) { return Constants.EXIT_CODE_SUCCESS;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskVersion); if (taskDefinitionUpdate == null) { return Constants.EXIT_CODE_FAILURE; } taskDefinitionUpdate.setUpdateTime(new Date()); taskDefinitionUpdate.setId(taskDefinition.getId()); return taskDefinitionMapper.updateById(taskDefinitionUpdate); } /** * get resource ids * * @param taskDefinition taskDefinition * @return resource ids */ @Override public String getResourceIds(TaskDefinition taskDefinition) { Set<Integer> resourceIds = null; AbstractParameters params = taskPluginManager.getParameters(ParametersNode.builder().taskType(taskDefinition.getTaskType()).taskParams(taskDefinition.getTaskParams()).build()); if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) { resourceIds = params.getResourceFilesList(). stream() .filter(t -> t.getId() != 0) .map(ResourceInfo::getId) .collect(toSet()); } if (CollectionUtils.isEmpty(resourceIds)) { return ""; } return Joiner.on(",").join(resourceIds);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} @Override public int saveTaskDefine(User operator, long projectCode, List<TaskDefinitionLog> taskDefinitionLogs, Boolean syncDefine) { Date now = new Date(); List<TaskDefinitionLog> newTaskDefinitionLogs = new ArrayList<>(); List<TaskDefinitionLog> updateTaskDefinitionLogs = new ArrayList<>(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { taskDefinitionLog.setProjectCode(projectCode); taskDefinitionLog.setUpdateTime(now); taskDefinitionLog.setOperateTime(now); taskDefinitionLog.setOperator(operator.getId()); taskDefinitionLog.setResourceIds(getResourceIds(taskDefinitionLog)); if (taskDefinitionLog.getCode() == 0) { try { taskDefinitionLog.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { logger.error("Task code get error, ", e); return Constants.DEFINITION_FAILURE; } } if (taskDefinitionLog.getVersion() == 0) { taskDefinitionLog.setVersion(Constants.VERSION_FIRST); } TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper .queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion()); if (definitionCodeAndVersion == null) { taskDefinitionLog.setUserId(operator.getId()); taskDefinitionLog.setCreateTime(now); newTaskDefinitionLogs.add(taskDefinitionLog);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
continue; } if (taskDefinitionLog.equals(definitionCodeAndVersion)) { continue; } taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId()); Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode()); taskDefinitionLog.setVersion(version + 1); taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime()); updateTaskDefinitionLogs.add(taskDefinitionLog); } int insertResult = 0; int updateResult = 0; for (TaskDefinitionLog taskDefinitionToUpdate : updateTaskDefinitionLogs) { TaskDefinition task = taskDefinitionMapper.queryByCode(taskDefinitionToUpdate.getCode()); if (task == null) { newTaskDefinitionLogs.add(taskDefinitionToUpdate); } else { insertResult += taskDefinitionLogMapper.insert(taskDefinitionToUpdate); if (Boolean.TRUE.equals(syncDefine)) { taskDefinitionToUpdate.setId(task.getId()); updateResult += taskDefinitionMapper.updateById(taskDefinitionToUpdate); } else { updateResult++; } } } if (!newTaskDefinitionLogs.isEmpty()) { insertResult += taskDefinitionLogMapper.batchInsert(newTaskDefinitionLogs);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
if (Boolean.TRUE.equals(syncDefine)) { updateResult += taskDefinitionMapper.batchInsert(newTaskDefinitionLogs); } else { updateResult += newTaskDefinitionLogs.size(); } } return (insertResult & updateResult) > 0 ? 1 : Constants.EXIT_CODE_SUCCESS; } /** * save processDefinition (including create or update processDefinition) */ @Override public int saveProcessDefine(User operator, ProcessDefinition processDefinition, Boolean syncDefine, Boolean isFromProcessDefine) { ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition); Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinition.getCode()); int insertVersion = version == null || version == 0 ? Constants.VERSION_FIRST : version + 1; processDefinitionLog.setVersion(insertVersion); processDefinitionLog.setReleaseState(!isFromProcessDefine || processDefinitionLog.getReleaseState() == ReleaseState.ONLINE ? ReleaseState.ONLINE : ReleaseState.OFFLINE); processDefinitionLog.setOperator(operator.getId()); processDefinitionLog.setOperateTime(processDefinition.getUpdateTime()); int insertLog = processDefineLogMapper.insert(processDefinitionLog); int result = 1; if (Boolean.TRUE.equals(syncDefine)) { if (0 == processDefinition.getId()) { result = processDefineMapper.insert(processDefinitionLog); } else { processDefinitionLog.setId(processDefinition.getId()); result = processDefineMapper.updateById(processDefinitionLog); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
return (insertLog & result) > 0 ? insertVersion : 0; } /** * save task relations */ @Override public int saveTaskRelation(User operator, long projectCode, long processDefinitionCode, int processDefinitionVersion, List<ProcessTaskRelationLog> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs, Boolean syncDefine) { if (taskRelationList.isEmpty()) { return Constants.EXIT_CODE_SUCCESS; } Map<Long, TaskDefinitionLog> taskDefinitionLogMap = null; if (CollectionUtils.isNotEmpty(taskDefinitionLogs)) { taskDefinitionLogMap = taskDefinitionLogs.stream() .collect(Collectors.toMap(TaskDefinition::getCode, taskDefinitionLog -> taskDefinitionLog)); } Date now = new Date(); for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { processTaskRelationLog.setProjectCode(projectCode); processTaskRelationLog.setProcessDefinitionCode(processDefinitionCode); processTaskRelationLog.setProcessDefinitionVersion(processDefinitionVersion); if (taskDefinitionLogMap != null) { TaskDefinitionLog preTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPreTaskCode()); if (preTaskDefinitionLog != null) { processTaskRelationLog.setPreTaskVersion(preTaskDefinitionLog.getVersion()); } TaskDefinitionLog postTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPostTaskCode()); if (postTaskDefinitionLog != null) { processTaskRelationLog.setPostTaskVersion(postTaskDefinitionLog.getVersion());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} } processTaskRelationLog.setCreateTime(now); processTaskRelationLog.setUpdateTime(now); processTaskRelationLog.setOperator(operator.getId()); processTaskRelationLog.setOperateTime(now); } int insert = taskRelationList.size(); if (Boolean.TRUE.equals(syncDefine)) { List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); if (!processTaskRelationList.isEmpty()) { Set<Integer> processTaskRelationSet = processTaskRelationList.stream().map(ProcessTaskRelation::hashCode).collect(toSet()); Set<Integer> taskRelationSet = taskRelationList.stream().map(ProcessTaskRelationLog::hashCode).collect(toSet()); boolean result = CollectionUtils.isEqualCollection(processTaskRelationSet, taskRelationSet); if (result) { return Constants.EXIT_CODE_SUCCESS; } processTaskRelationMapper.deleteByCode(projectCode, processDefinitionCode); } insert = processTaskRelationMapper.batchInsert(taskRelationList); } int resultLog = processTaskRelationLogMapper.batchInsert(taskRelationList); return (insert & resultLog) > 0 ? Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE; } @Override public boolean isTaskOnline(long taskCode) { List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByTaskCode(taskCode); if (!processTaskRelationList.isEmpty()) { Set<Long> processDefinitionCodes = processTaskRelationList .stream()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
.map(ProcessTaskRelation::getProcessDefinitionCode) .collect(toSet()); List<ProcessDefinition> processDefinitionList = processDefineMapper.queryByCodes(processDefinitionCodes); for (ProcessDefinition processDefinition : processDefinitionList) { if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { return true; } } } return false; } /** * Generate the DAG Graph based on the process definition id * Use temporarily before refactoring taskNode * * @param processDefinition process definition * @return dag graph */ @Override public DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) { List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion()); List<TaskNode> taskNodeList = transformTask(taskRelations, Lists.newArrayList()); ProcessDag processDag = DagHelper.getProcessDag(taskNodeList, new ArrayList<>(taskRelations)); return DagHelper.buildDagGraph(processDag); } /** * generate DagData */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@Override public DagData genDagData(ProcessDefinition processDefinition) { List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion()); List<TaskDefinitionLog> taskDefinitionLogList = genTaskDefineList(taskRelations); List<TaskDefinition> taskDefinitions = taskDefinitionLogList.stream().map(t -> (TaskDefinition) t).collect(Collectors.toList()); return new DagData(processDefinition, taskRelations, taskDefinitions); } @Override public List<TaskDefinitionLog> genTaskDefineList(List<ProcessTaskRelation> processTaskRelations) { Set<TaskDefinition> taskDefinitionSet = new HashSet<>(); for (ProcessTaskRelation processTaskRelation : processTaskRelations) { if (processTaskRelation.getPreTaskCode() > 0) { taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion())); } if (processTaskRelation.getPostTaskCode() > 0) { taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion())); } } if (taskDefinitionSet.isEmpty()) { return Lists.newArrayList(); } return taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionSet); } @Override public List<TaskDefinitionLog> getTaskDefineLogListByRelation(List<ProcessTaskRelation> processTaskRelations) { List<TaskDefinitionLog> taskDefinitionLogs = new ArrayList<>(); Map<Long, Integer> taskCodeVersionMap = new HashMap<>(); for (ProcessTaskRelation processTaskRelation : processTaskRelations) { if (processTaskRelation.getPreTaskCode() > 0) { taskCodeVersionMap.put(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} if (processTaskRelation.getPostTaskCode() > 0) { taskCodeVersionMap.put(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion()); } } taskCodeVersionMap.forEach((code, version) -> { taskDefinitionLogs.add((TaskDefinitionLog) this.findTaskDefinition(code, version)); }); return taskDefinitionLogs; } /** * find task definition by code and version */ @Override public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersion) { return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion); } /** * find process task relation list by process */ @Override public List<ProcessTaskRelation> findRelationByCode(long processDefinitionCode, int processDefinitionVersion) { List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinitionCode, processDefinitionVersion); return processTaskRelationLogList.stream().map(r -> (ProcessTaskRelation) r).collect(Collectors.toList()); } /** * add authorized resources * * @param ownResources own resources * @param userId userId
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
*/ private void addAuthorizedResources(List<Resource> ownResources, int userId) { List<Integer> relationResourceIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 7); List<Resource> relationResources = CollectionUtils.isNotEmpty(relationResourceIds) ? resourceMapper.queryResourceListById(relationResourceIds) : new ArrayList<>(); ownResources.addAll(relationResources); } /** * Use temporarily before refactoring taskNode */ @Override public List<TaskNode> transformTask(List<ProcessTaskRelation> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) { Map<Long, List<Long>> taskCodeMap = new HashMap<>(); for (ProcessTaskRelation processTaskRelation : taskRelationList) { taskCodeMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> { if (v == null) { v = new ArrayList<>(); } if (processTaskRelation.getPreTaskCode() != 0L) { v.add(processTaskRelation.getPreTaskCode()); } return v; }); } if (CollectionUtils.isEmpty(taskDefinitionLogs)) { taskDefinitionLogs = genTaskDefineList(taskRelationList); } Map<Long, TaskDefinitionLog> taskDefinitionLogMap = taskDefinitionLogs.stream() .collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); List<TaskNode> taskNodeList = new ArrayList<>(); for (Entry<Long, List<Long>> code : taskCodeMap.entrySet()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMap.get(code.getKey()); if (taskDefinitionLog != null) { TaskNode taskNode = new TaskNode(); taskNode.setCode(taskDefinitionLog.getCode()); taskNode.setVersion(taskDefinitionLog.getVersion()); taskNode.setName(taskDefinitionLog.getName()); taskNode.setDesc(taskDefinitionLog.getDescription()); taskNode.setType(taskDefinitionLog.getTaskType().toUpperCase()); taskNode.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN); taskNode.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes()); taskNode.setRetryInterval(taskDefinitionLog.getFailRetryInterval()); Map<String, Object> taskParamsMap = taskNode.taskParamsToJsonObj(taskDefinitionLog.getTaskParams()); taskNode.setConditionResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.CONDITION_RESULT))); taskNode.setSwitchResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.SWITCH_RESULT))); taskNode.setDependence(JSONUtils.toJsonString(taskParamsMap.get(Constants.DEPENDENCE))); taskParamsMap.remove(Constants.CONDITION_RESULT); taskParamsMap.remove(Constants.DEPENDENCE); taskNode.setParams(JSONUtils.toJsonString(taskParamsMap)); taskNode.setTaskInstancePriority(taskDefinitionLog.getTaskPriority()); taskNode.setWorkerGroup(taskDefinitionLog.getWorkerGroup()); taskNode.setEnvironmentCode(taskDefinitionLog.getEnvironmentCode()); taskNode.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN, taskDefinitionLog.getTimeoutNotifyStrategy(), taskDefinitionLog.getTimeout()))); taskNode.setDelayTime(taskDefinitionLog.getDelayTime()); taskNode.setPreTasks(JSONUtils.toJsonString(code.getValue().stream().map(taskDefinitionLogMap::get).map(TaskDefinition::getCode).collect(Collectors.toList()))); taskNode.setTaskGroupId(taskDefinitionLog.getTaskGroupId()); taskNode.setTaskGroupPriority(taskDefinitionLog.getTaskGroupPriority()); taskNode.setCpuQuota(taskDefinitionLog.getCpuQuota()); taskNode.setMemoryMax(taskDefinitionLog.getMemoryMax());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
taskNodeList.add(taskNode); } } return taskNodeList; } @Override public Map<ProcessInstance, TaskInstance> notifyProcessList(int processId) { HashMap<ProcessInstance, TaskInstance> processTaskMap = new HashMap<>(); ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(processId); if (processInstanceMap == null) { return processTaskMap; } ProcessInstance fatherProcess = this.findProcessInstanceById(processInstanceMap.getParentProcessInstanceId()); TaskInstance fatherTask = this.findTaskInstanceById(processInstanceMap.getParentTaskInstanceId()); if (fatherProcess != null) { processTaskMap.put(fatherProcess, fatherTask); } return processTaskMap; } @Override public DqExecuteResult getDqExecuteResultByTaskInstanceId(int taskInstanceId) { return dqExecuteResultMapper.getExecuteResultById(taskInstanceId); } @Override public int updateDqExecuteResultUserId(int taskInstanceId) { DqExecuteResult dqExecuteResult = dqExecuteResultMapper.selectOne(new QueryWrapper<DqExecuteResult>().eq(TASK_INSTANCE_ID, taskInstanceId)); if (dqExecuteResult == null) { return -1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
} ProcessInstance processInstance = processInstanceMapper.selectById(dqExecuteResult.getProcessInstanceId()); if (processInstance == null) { return -1; } ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()); if (processDefinition == null) { return -1; } dqExecuteResult.setProcessDefinitionId(processDefinition.getId()); dqExecuteResult.setUserId(processDefinition.getUserId()); dqExecuteResult.setState(DqTaskState.DEFAULT.getCode()); return dqExecuteResultMapper.updateById(dqExecuteResult); } @Override public int updateDqExecuteResultState(DqExecuteResult dqExecuteResult) { return dqExecuteResultMapper.updateById(dqExecuteResult); } @Override public int deleteDqExecuteResultByTaskInstanceId(int taskInstanceId) { return dqExecuteResultMapper.delete( new QueryWrapper<DqExecuteResult>() .eq(TASK_INSTANCE_ID, taskInstanceId)); } @Override public int deleteTaskStatisticsValueByTaskInstanceId(int taskInstanceId) { return dqTaskStatisticsValueMapper.delete( new QueryWrapper<DqTaskStatisticsValue>() .eq(TASK_INSTANCE_ID, taskInstanceId)); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@Override public DqRule getDqRule(int ruleId) { return dqRuleMapper.selectById(ruleId); } @Override public List<DqRuleInputEntry> getRuleInputEntry(int ruleId) { return DqRuleUtils.transformInputEntry(dqRuleInputEntryMapper.getRuleInputEntryList(ruleId)); } @Override public List<DqRuleExecuteSql> getDqExecuteSql(int ruleId) { return dqRuleExecuteSqlMapper.getExecuteSqlList(ruleId); } @Override public DqComparisonType getComparisonTypeById(int id) { return dqComparisonTypeMapper.selectById(id); } /** * the first time (when submit the task ) get the resource of the task group * * @param taskId task id */ @Override public boolean acquireTaskGroup(int taskId, String taskName, int groupId, int processId, int priority) { TaskGroup taskGroup = taskGroupMapper.selectById(groupId); if (taskGroup == null) { return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
if (taskGroup.getStatus() == Flag.NO.getCode()) { return true; } TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskId); if (taskGroupQueue == null) { taskGroupQueue = insertIntoTaskGroupQueue(taskId, taskName, groupId, processId, priority, TaskGroupQueueStatus.WAIT_QUEUE); } else { if (taskGroupQueue.getStatus() == TaskGroupQueueStatus.ACQUIRE_SUCCESS) { return true; } taskGroupQueue.setInQueue(Flag.NO.getCode()); taskGroupQueue.setStatus(TaskGroupQueueStatus.WAIT_QUEUE); this.taskGroupQueueMapper.updateById(taskGroupQueue); } List<TaskGroupQueue> highPriorityTasks = taskGroupQueueMapper.queryHighPriorityTasks(groupId, priority, TaskGroupQueueStatus.WAIT_QUEUE.getCode()); if (CollectionUtils.isNotEmpty(highPriorityTasks)) { this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId()); return false; } int count = taskGroupMapper.selectAvailableCountById(groupId); if (count == 1 && robTaskGroupResouce(taskGroupQueue)) { return true; } this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId()); return false; } /** * try to get the task group resource(when other task release the resource)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
*/ @Override public boolean robTaskGroupResouce(TaskGroupQueue taskGroupQueue) { TaskGroup taskGroup = taskGroupMapper.selectById(taskGroupQueue.getGroupId()); int affectedCount = taskGroupMapper.updateTaskGroupResource(taskGroup.getId(), taskGroupQueue.getId(), TaskGroupQueueStatus.WAIT_QUEUE.getCode()); if (affectedCount > 0) { taskGroupQueue.setStatus(TaskGroupQueueStatus.ACQUIRE_SUCCESS); this.taskGroupQueueMapper.updateById(taskGroupQueue); this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId()); return true; } return false; } @Override public boolean acquireTaskGroupAgain(TaskGroupQueue taskGroupQueue) { return robTaskGroupResouce(taskGroupQueue); } @Override public void releaseAllTaskGroup(int processInstanceId) { List<TaskInstance> taskInstances = this.taskInstanceMapper.loadAllInfosNoRelease(processInstanceId, TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()); for (TaskInstance info : taskInstances) { releaseTaskGroup(info); } } /** * release the TGQ resource when the corresponding task is finished. * * @return the result code and msg */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@Override public TaskInstance releaseTaskGroup(TaskInstance taskInstance) { TaskGroup taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId()); if (taskGroup == null) { return null; } TaskGroupQueue thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId()); if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) { return null; } try { while (taskGroupMapper.releaseTaskGroupResource(taskGroup.getId(), taskGroup.getUseSize() , thisTaskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()) != 1) { thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId()); if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) { return null; } taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId()); } } catch (Exception e) { logger.error("release the task group error", e); } logger.info("updateTask:{}", taskInstance.getName()); changeTaskGroupQueueStatus(taskInstance.getId(), TaskGroupQueueStatus.RELEASE); TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(), TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode()); if (taskGroupQueue == null) { return null; } while (this.taskGroupQueueMapper.updateInQueueCAS(Flag.NO.getCode(), Flag.YES.getCode(), taskGroupQueue.getId()) != 1) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(), TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode()); if (taskGroupQueue == null) { return null; } } return this.taskInstanceMapper.selectById(taskGroupQueue.getTaskId()); } /** * release the TGQ resource when the corresponding task is finished. * * @param taskId task id * @return the result code and msg */ @Override public void changeTaskGroupQueueStatus(int taskId, TaskGroupQueueStatus status) { TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.queryByTaskId(taskId); taskGroupQueue.setStatus(status); taskGroupQueue.setUpdateTime(new Date(System.currentTimeMillis())); taskGroupQueueMapper.updateById(taskGroupQueue); } /** * insert into task group queue * * @param taskId task id * @param taskName task name * @param groupId group id * @param processId process id * @param priority priority * @return result and msg code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
*/ @Override public TaskGroupQueue insertIntoTaskGroupQueue(Integer taskId, String taskName, Integer groupId, Integer processId, Integer priority, TaskGroupQueueStatus status) { TaskGroupQueue taskGroupQueue = new TaskGroupQueue(taskId, taskName, groupId, processId, priority, status); taskGroupQueue.setCreateTime(new Date()); taskGroupQueue.setUpdateTime(new Date()); taskGroupQueueMapper.insert(taskGroupQueue); return taskGroupQueue; } @Override public int updateTaskGroupQueueStatus(Integer taskId, int status) { return taskGroupQueueMapper.updateStatusByTaskId(taskId, status); } @Override public int updateTaskGroupQueue(TaskGroupQueue taskGroupQueue) { return taskGroupQueueMapper.updateById(taskGroupQueue); } @Override public TaskGroupQueue loadTaskGroupQueue(int taskId) { return this.taskGroupQueueMapper.queryByTaskId(taskId); } @Override public void sendStartTask2Master(ProcessInstance processInstance, int taskId, org.apache.dolphinscheduler.remote.command.CommandType taskType) { TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand( processInstance.getId(), taskId ); Host host = new Host(processInstance.getHost());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,750
[Feature][Master] Failover workflow instance in priority
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description When failing over a workflow instance, it should be based on the priority of the instance ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10750
https://github.com/apache/dolphinscheduler/pull/10754
35a10d092f566c07137da5fb67b21cee644cdc8f
182b9c9b26acf9e375a1b6fd1813c5d9bfd16104
2022-07-03T17:06:03Z
java
2022-07-04T15:35:24Z
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
stateEventCallbackService.sendResult(host, taskEventChangeCommand.convert2Command(taskType)); } @Override public ProcessInstance loadNextProcess4Serial(long code, int state, int id) { return this.processInstanceMapper.loadNextProcess4Serial(code, state, id); } protected void deleteCommandWithCheck(int commandId) { int delete = this.commandMapper.deleteById(commandId); if (delete != 1) { throw new ServiceException("delete command fail, id:" + commandId); } } /** * find k8s config yaml by clusterName * * @param clusterName clusterName * @return datasource */ @Override public String findConfigYamlByName(String clusterName) { if (Strings.isNullOrEmpty(clusterName)) { return null; } QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>(); nodeWrapper.eq("k8s_name", clusterName); K8s k8s = k8sMapper.selectOne(nodeWrapper); return k8s.getK8sConfig(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowConstants.java
/* * 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.dolphinscheduler.plugin.task.mlflow; public class MlflowConstants { private MlflowConstants() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowConstants.java
throw new IllegalStateException("Utility class"); } public static final String JOB_TYPE_AUTOML = "AutoML"; public static final String JOB_TYPE_BASIC_ALGORITHM = "BasicAlgorithm"; public static final String JOB_TYPE_CUSTOM_PROJECT = "CustomProject"; public static final String PRESET_REPOSITORY = "https://github.com/apache/dolphinscheduler-mlflow"; public static final String PRESET_REPOSITORY_VERSION = "main"; public static final String PRESET_AUTOML_PROJECT = PRESET_REPOSITORY + "#Project-AutoML"; public static final String PRESET_BASIC_ALGORITHM_PROJECT = PRESET_REPOSITORY + "#Project-BasicAlgorithm"; public static final String MLFLOW_TASK_TYPE_PROJECTS = "MLflow Projects"; public static final String MLFLOW_TASK_TYPE_MODELS = "MLflow Models"; public static final String MLFLOW_MODELS_DEPLOY_TYPE_MLFLOW = "MLFLOW"; public static final String MLFLOW_MODELS_DEPLOY_TYPE_DOCKER = "DOCKER"; public static final String MLFLOW_MODELS_DEPLOY_TYPE_DOCKER_COMPOSE = "DOCKER COMPOSE"; /** * template file */ public static final String TEMPLATE_DOCKER_COMPOSE = "docker-compose.yml"; /** * mlflow command */ public static final String EXPORT_MLFLOW_TRACKING_URI_ENV = "export MLFLOW_TRACKING_URI=%s"; public static final String SET_DATA_PATH = "data_path=%s"; public static final String SET_REPOSITORY = "repo=%s"; public static final String MLFLOW_RUN_BASIC_ALGORITHM = "mlflow run $repo " + "-P algorithm=%s " + "-P data_path=$data_path " + "-P params=\"%s\" " + "-P search_params=\"%s\" " + "-P model_name=\"%s\" " +
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowConstants.java
"--experiment-name=\"%s\" " + "--version=main "; public static final String MLFLOW_RUN_AUTOML_PROJECT = "mlflow run $repo " + "-P tool=%s " + "-P data_path=$data_path " + "-P params=\"%s\" " + "-P model_name=\"%s\" " + "--experiment-name=\"%s\" " + "--version=main "; public static final String MLFLOW_RUN_CUSTOM_PROJECT = "mlflow run $repo " + "%s " + "--experiment-name=\"%s\" " + "--version=\"%s\" "; public static final String MLFLOW_MODELS_SERVE = "mlflow models serve -m %s --port %s -h 0.0.0.0"; public static final String MLFLOW_BUILD_DOCKER = "mlflow models build-docker -m %s -n %s --enable-mlserver"; public static final String DOCKER_RREMOVE_CONTAINER = "docker rm -f %s"; public static final String DOCKER_RUN = "docker run --name=%s -p=%s:8080 %s"; public static final String DOCKER_COMPOSE_RUN = "docker-compose up -d"; public static final String SET_DOCKER_COMPOSE_ENV = "export DS_TASK_MLFLOW_IMAGE_NAME=%s\n" + "export DS_TASK_MLFLOW_CONTAINER_NAME=%s\n" + "export DS_TASK_MLFLOW_DEPLOY_PORT=%s\n" + "export DS_TASK_MLFLOW_CPU_LIMIT=%s\n" + "export DS_TASK_MLFLOW_MEMORY_LIMIT=%s"; public static final String DOCKER_HEALTH_CHECK_COMMAND = "for i in $(seq 1 300); " + "do " + "[ $(docker inspect --format \"{{json .State.Health.Status }}\" %s) = '\"healthy\"' ] " + "&& exit 0 && break;sleep 1; " + "done; docker-compose down; exit 1"; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
/* * 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.dolphinscheduler.plugin.task.mlflow; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import java.util.HashMap; public class MlflowParameters extends AbstractParameters {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
/** * common parameters */ private String params = ""; private String mlflowJobType = ""; /** * CustomProject parameters */ private String mlflowProjectRepository; private String mlflowProjectVersion = "master"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
* AutoML parameters */ private String automlTool = "FLAML"; /** * basic algorithm parameters */ private String algorithm = "lightgbm"; private String searchParams = ""; private String dataPath; /** * mlflow parameters */ private String mlflowTaskType = ""; private String experimentName = "Default"; private String modelName = ""; private String mlflowTrackingUri = "http://127.0.0.1:5000"; /** * mlflow models deploy parameters */ private String deployType; private String deployModelKey; private String deployPort; private String cpuLimit; private String memoryLimit; public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } public String getAlgorithm() { return algorithm; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
public void setParams(String params) { this.params = params; } public String getParams() { return params; } public void setSearchParams(String searchParams) { this.searchParams = searchParams; } public String getSearchParams() { return searchParams; } public void setDataPaths(String dataPath) { this.dataPath = dataPath; } public String getDataPath() { return dataPath; } public void setMlflowTaskType(String mlflowTaskType) { this.mlflowTaskType = mlflowTaskType; } public String getMlflowTaskType() { return mlflowTaskType; } public void setExperimentNames(String experimentName) { this.experimentName = experimentName; } public String getExperimentName() { return experimentName; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
public void setModelNames(String modelName) { this.modelName = modelName; } public String getModelName() { return modelName; } public void setMlflowTrackingUris(String mlflowTrackingUri) { this.mlflowTrackingUri = mlflowTrackingUri; } public String getMlflowTrackingUri() { return mlflowTrackingUri; } public void setMlflowJobType(String mlflowJobType) { this.mlflowJobType = mlflowJobType; } public String getMlflowJobType() { return mlflowJobType; } public void setAutomlTool(String automlTool) { this.automlTool = automlTool; } public String getMlflowProjectRepository() { return mlflowProjectRepository; } public void setMlflowProjectRepository(String mlflowProjectRepository) { this.mlflowProjectRepository = mlflowProjectRepository; } public String getMlflowProjectVersion() { return mlflowProjectVersion; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
public void setMlflowProjectVersion(String mlflowProjectVersion) { this.mlflowProjectVersion = mlflowProjectVersion; } public String getAutomlTool() { return automlTool; } public void setDeployType(String deployType) { this.deployType = deployType; } public String getDeployType() { return deployType; } public void setDeployModelKey(String deployModelKey) { this.deployModelKey = deployModelKey; } public String getDeployModelKey() { return deployModelKey; } public void setDeployPort(String deployPort) { this.deployPort = deployPort; } public String getDeployPort() { return deployPort; } public void setCpuLimit(String cpuLimit) { this.cpuLimit = cpuLimit; } public String getCpuLimit() { return cpuLimit; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
public void setMemoryLimit(String memoryLimit) { this.memoryLimit = memoryLimit; } public String getMemoryLimit() { return memoryLimit; } @Override public boolean checkParameters() { Boolean checkResult = true; return checkResult; } public HashMap<String, String> getParamsMap() { HashMap<String, String> paramsMap = new HashMap<String, String>(); paramsMap.put("params", params); paramsMap.put("data_path", dataPath); paramsMap.put("experiment_name", experimentName); paramsMap.put("model_name", modelName); paramsMap.put("MLFLOW_TRACKING_URI", mlflowTrackingUri); if (mlflowJobType.equals(MlflowConstants.JOB_TYPE_BASIC_ALGORITHM)) { addParamsMapForBasicAlgorithm(paramsMap); } else if (mlflowJobType.equals(MlflowConstants.JOB_TYPE_AUTOML)) { getParamsMapForAutoML(paramsMap); } else { } return paramsMap; } private void addParamsMapForBasicAlgorithm(HashMap<String, String> paramsMap) { paramsMap.put("algorithm", algorithm); paramsMap.put("search_params", searchParams); paramsMap.put("repo", MlflowConstants.PRESET_BASIC_ALGORITHM_PROJECT);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowParameters.java
paramsMap.put("repo_version", MlflowConstants.PRESET_REPOSITORY_VERSION); } private void getParamsMapForAutoML(HashMap<String, String> paramsMap) { paramsMap.put("automl_tool", automlTool); paramsMap.put("repo", MlflowConstants.PRESET_AUTOML_PROJECT); paramsMap.put("repo_version", MlflowConstants.PRESET_REPOSITORY_VERSION); } public String getModelKeyName(String tag) throws IllegalArgumentException { String imageName; if (deployModelKey.startsWith("runs:")) { imageName = deployModelKey.replace("runs:/", ""); } else if (deployModelKey.startsWith("models:")) { imageName = deployModelKey.replace("models:/", ""); } else { throw new IllegalArgumentException("model key must start with runs:/ or models:/ "); } imageName = imageName.replace("/", tag); return imageName; } public String getDockerComposeEnvCommand() { String imageName = "mlflow/" + getModelKeyName(":"); String env = String.format(MlflowConstants.SET_DOCKER_COMPOSE_ENV, imageName, getContainerName(), deployPort, cpuLimit, memoryLimit); return env; } public String getContainerName(){ String containerName = "ds-mlflow-" + getModelKeyName("-"); return containerName; } };
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
/* * 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.dolphinscheduler.plugin.task.mlflow; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils; import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils; import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * shell task */ public class MlflowTask extends AbstractTaskExecutor { /** * shell parameters */ private MlflowParameters mlflowParameters; /** * shell command executor */ private ShellCommandExecutor shellCommandExecutor; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * constructor
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
* * @param taskExecutionContext taskExecutionContext */ public MlflowTask(TaskExecutionContext taskExecutionContext) { super(taskExecutionContext); this.taskExecutionContext = taskExecutionContext; this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, taskExecutionContext, logger); } @Override public void init() { logger.info("shell task params {}", taskExecutionContext.getTaskParams()); mlflowParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), MlflowParameters.class); if (!mlflowParameters.checkParameters()) { throw new RuntimeException("shell task params is not valid"); } } @Override public void handle() throws Exception { try { String command = buildCommand(); TaskResponse commandExecuteResult = shellCommandExecutor.run(command); setExitStatusCode(commandExecuteResult.getExitStatusCode()); setAppIds(commandExecuteResult.getAppIds()); setProcessId(commandExecuteResult.getProcessId()); mlflowParameters.dealOutParam(shellCommandExecutor.getVarPool()); } catch (Exception e) { logger.error("shell task error", e); setExitStatusCode(EXIT_CODE_FAILURE); throw e;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
} } @Override public void cancelApplication(boolean cancelApplication) throws Exception { shellCommandExecutor.cancelApplication(); } public String buildCommand() { String command = ""; if (mlflowParameters.getMlflowTaskType().equals(MlflowConstants.MLFLOW_TASK_TYPE_PROJECTS)) { command = buildCommandForMlflowProjects(); } else if (mlflowParameters.getMlflowTaskType().equals(MlflowConstants.MLFLOW_TASK_TYPE_MODELS)) { command = buildCommandForMlflowModels(); } logger.info("mlflow task command: \n{}", command); return command; } /** * create command * * @return file name */ private String buildCommandForMlflowProjects() { Map<String, Property> paramsMap = getParamsMap(); List<String> args = new ArrayList<>(); args.add(String.format(MlflowConstants.EXPORT_MLFLOW_TRACKING_URI_ENV, mlflowParameters.getMlflowTrackingUri())); String runCommand; if (mlflowParameters.getMlflowJobType().equals(MlflowConstants.JOB_TYPE_BASIC_ALGORITHM)) { args.add(String.format(MlflowConstants.SET_DATA_PATH, mlflowParameters.getDataPath())); args.add(String.format(MlflowConstants.SET_REPOSITORY, MlflowConstants.PRESET_BASIC_ALGORITHM_PROJECT));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
runCommand = MlflowConstants.MLFLOW_RUN_BASIC_ALGORITHM; runCommand = String.format(runCommand, mlflowParameters.getAlgorithm(), mlflowParameters.getParams(), mlflowParameters.getSearchParams(), mlflowParameters.getModelName(), mlflowParameters.getExperimentName()); } else if (mlflowParameters.getMlflowJobType().equals(MlflowConstants.JOB_TYPE_AUTOML)) { args.add(String.format(MlflowConstants.SET_DATA_PATH, mlflowParameters.getDataPath())); args.add(String.format(MlflowConstants.SET_REPOSITORY, MlflowConstants.PRESET_AUTOML_PROJECT)); runCommand = MlflowConstants.MLFLOW_RUN_AUTOML_PROJECT; runCommand = String.format(runCommand, mlflowParameters.getAutomlTool(), mlflowParameters.getParams(), mlflowParameters.getModelName(), mlflowParameters.getExperimentName()); } else if (mlflowParameters.getMlflowJobType().equals(MlflowConstants.JOB_TYPE_CUSTOM_PROJECT)) { args.add(String.format(MlflowConstants.SET_REPOSITORY, mlflowParameters.getMlflowProjectRepository())); runCommand = MlflowConstants.MLFLOW_RUN_CUSTOM_PROJECT; runCommand = String.format(runCommand, mlflowParameters.getParams(), mlflowParameters.getExperimentName(), mlflowParameters.getMlflowProjectVersion()); } else { runCommand = String.format("Cant not Support %s", mlflowParameters.getMlflowJobType()); } args.add(runCommand); String command = ParameterUtils.convertParameterPlaceholders(String.join("\n", args), ParamUtils.convert(paramsMap)); return command; } protected String buildCommandForMlflowModels() { /** * papermill [OPTIONS] NOTEBOOK_PATH [OUTPUT_PATH] */ Map<String, Property> paramsMap = getParamsMap(); List<String> args = new ArrayList<>(); args.add(String.format(MlflowConstants.EXPORT_MLFLOW_TRACKING_URI_ENV, mlflowParameters.getMlflowTrackingUri())); String deployModelKey = mlflowParameters.getDeployModelKey(); if (mlflowParameters.getDeployType().equals(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_MLFLOW)) { args.add(String.format(MlflowConstants.MLFLOW_MODELS_SERVE, deployModelKey, mlflowParameters.getDeployPort())); } else if (mlflowParameters.getDeployType().equals(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_DOCKER)) { String imageName = "mlflow/" + mlflowParameters.getModelKeyName(":");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/main/java/org/apache/dolphinscheduler/plugin/task/mlflow/MlflowTask.java
String containerName = mlflowParameters.getContainerName(); args.add(String.format(MlflowConstants.MLFLOW_BUILD_DOCKER, deployModelKey, imageName)); args.add(String.format(MlflowConstants.DOCKER_RREMOVE_CONTAINER, containerName)); args.add(String.format(MlflowConstants.DOCKER_RUN, containerName, mlflowParameters.getDeployPort(), imageName)); } else if (mlflowParameters.getDeployType().equals(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_DOCKER_COMPOSE)) { String templatePath = getTemplatePath(MlflowConstants.TEMPLATE_DOCKER_COMPOSE); args.add(String.format("cp %s %s", templatePath, taskExecutionContext.getExecutePath())); String imageName = "mlflow/" + mlflowParameters.getModelKeyName(":"); args.add(String.format(MlflowConstants.MLFLOW_BUILD_DOCKER, deployModelKey, imageName)); args.add(mlflowParameters.getDockerComposeEnvCommand()); args.add(MlflowConstants.DOCKER_COMPOSE_RUN); args.add(String.format(MlflowConstants.DOCKER_HEALTH_CHECK_COMMAND, mlflowParameters.getContainerName())); } String command = ParameterUtils.convertParameterPlaceholders(String.join("\n", args), ParamUtils.convert(paramsMap)); return command; } private Map<String, Property> getParamsMap() { return taskExecutionContext.getPrepareParamsMap(); } @Override public AbstractParameters getParameters() { return mlflowParameters; } public String getTemplatePath(String template) { String templatePath = MlflowTask.class.getClassLoader().getResource(template).getPath(); return templatePath; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
/* * 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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
* See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinler.plugin.task.mlflow; import java.util.Date; import java.util.UUID; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.plugin.task.mlflow.MlflowConstants; import org.apache.dolphinscheduler.plugin.task.mlflow.MlflowParameters; import org.apache.dolphinscheduler.plugin.task.mlflow.MlflowTask; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.junit.runner.RunWith; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; import org.apache.dolphinscheduler.spi.utils.JSONUtils; @RunWith(PowerMockRunner.class) @PrepareForTest({ JSONUtils.class, PropertyUtils.class, })
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
@PowerMockIgnore({"javax.*"}) @SuppressStaticInitializationFor("org.apache.dolphinscheduler.spi.utils.PropertyUtils") public class MlflowTaskTest { private static final Logger logger = LoggerFactory.getLogger(MlflowTask.class); @Before public void before() throws Exception { PowerMockito.mockStatic(PropertyUtils.class); } public TaskExecutionContext createContext(MlflowParameters mlflowParameters) { String parameters = JSONUtils.toJsonString(mlflowParameters); TaskExecutionContext taskExecutionContext = Mockito.mock(TaskExecutionContext.class); Mockito.when(taskExecutionContext.getTaskParams()).thenReturn(parameters); Mockito.when(taskExecutionContext.getTaskLogName()).thenReturn("MLflowTest"); Mockito.when(taskExecutionContext.getExecutePath()).thenReturn("/tmp/dolphinscheduler_test"); Mockito.when(taskExecutionContext.getTaskAppId()).thenReturn(UUID.randomUUID().toString()); Mockito.when(taskExecutionContext.getTenantCode()).thenReturn("root"); Mockito.when(taskExecutionContext.getStartTime()).thenReturn(new Date()); Mockito.when(taskExecutionContext.getTaskTimeout()).thenReturn(10000); Mockito.when(taskExecutionContext.getLogPath()).thenReturn("/tmp/dolphinscheduler_test/log"); Mockito.when(taskExecutionContext.getEnvironmentConfig()).thenReturn("export PATH=$HOME/anaconda3/bin:$PATH"); String userName = System.getenv().get("USER"); Mockito.when(taskExecutionContext.getTenantCode()).thenReturn(userName); TaskExecutionContextCacheManager.cacheTaskExecutionContext(taskExecutionContext); return taskExecutionContext; } @Test public void testInitBasicAlgorithmTask() { MlflowTask mlflowTask = initTask(createBasicAlgorithmParameters()); Assert.assertEquals(mlflowTask.buildCommand(), "export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" +
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
"data_path=/data/iris.csv\n" + "repo=https://github.com/apache/dolphinscheduler-mlflow#Project-BasicAlgorithm\n" + "mlflow run $repo " + "-P algorithm=xgboost " + "-P data_path=$data_path " + "-P params=\"n_estimators=100\" " + "-P search_params=\"\" " + "-P model_name=\"BasicAlgorithm\" " + "--experiment-name=\"BasicAlgorithm\" " + "--version=main "); } @Test public void testInitAutoMLTask() { MlflowTask mlflowTask = initTask(createAutoMLParameters()); Assert.assertEquals(mlflowTask.buildCommand(), "export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" + "data_path=/data/iris.csv\n" + "repo=https://github.com/apache/dolphinscheduler-mlflow#Project-AutoML\n" + "mlflow run $repo " + "-P tool=autosklearn " + "-P data_path=$data_path " + "-P params=\"time_left_for_this_task=30\" " + "-P model_name=\"AutoML\" " + "--experiment-name=\"AutoML\" " + "--version=main "); } @Test public void testInitCustomProjectTask() { MlflowTask mlflowTask = initTask(createCustomProjectParameters()); Assert.assertEquals(mlflowTask.buildCommand(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
"export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" + "repo=https://github.com/mlflow/mlflow#examples/xgboost/xgboost_native\n" + "mlflow run $repo " + "-P learning_rate=0.2 " + "-P colsample_bytree=0.8 " + "-P subsample=0.9 " + "--experiment-name=\"custom_project\" " + "--version=\"master\" "); } @Test public void testModelsDeployMlflow() { MlflowTask mlflowTask = initTask(createModelDeplyMlflowParameters()); Assert.assertEquals(mlflowTask.buildCommand(), "export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" + "mlflow models serve -m runs:/a272ec279fc34a8995121ae04281585f/model " + "--port 7000 " + "-h 0.0.0.0"); } @Test public void testModelsDeployDocker() { MlflowTask mlflowTask = initTask(createModelDeplyDockerParameters()); Assert.assertEquals(mlflowTask.buildCommand(), "export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" + "mlflow models build-docker -m runs:/a272ec279fc34a8995121ae04281585f/model " + "-n mlflow/a272ec279fc34a8995121ae04281585f:model " + "--enable-mlserver\n" + "docker rm -f ds-mlflow-a272ec279fc34a8995121ae04281585f-model\n" + "docker run --name=ds-mlflow-a272ec279fc34a8995121ae04281585f-model " + "-p=7000:8080 mlflow/a272ec279fc34a8995121ae04281585f:model"); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
@Test public void testModelsDeployDockerCompose() throws Exception{ MlflowTask mlflowTask = initTask(createModelDeplyDockerComposeParameters()); Assert.assertEquals(mlflowTask.buildCommand(), "export MLFLOW_TRACKING_URI=http://127.0.0.1:5000\n" + "cp " + mlflowTask.getTemplatePath(MlflowConstants.TEMPLATE_DOCKER_COMPOSE) + " /tmp/dolphinscheduler_test\n" + "mlflow models build-docker -m models:/22222/1 -n mlflow/22222:1 --enable-mlserver\n" + "export DS_TASK_MLFLOW_IMAGE_NAME=mlflow/22222:1\n" + "export DS_TASK_MLFLOW_CONTAINER_NAME=ds-mlflow-22222-1\n" + "export DS_TASK_MLFLOW_DEPLOY_PORT=7000\n" + "export DS_TASK_MLFLOW_CPU_LIMIT=0.5\n" + "export DS_TASK_MLFLOW_MEMORY_LIMIT=200m\n" + "docker-compose up -d\n" + "for i in $(seq 1 300); do " + "[ $(docker inspect --format \"{{json .State.Health.Status }}\" ds-mlflow-22222-1) = '\"healthy\"' ] && exit 0 && break;sleep 1; " + "done; docker-compose down; exit 1"); } private MlflowTask initTask(MlflowParameters mlflowParameters) { TaskExecutionContext taskExecutionContext = createContext(mlflowParameters); MlflowTask mlflowTask = new MlflowTask(taskExecutionContext); mlflowTask.init(); mlflowTask.getParameters().setVarPool(taskExecutionContext.getVarPool()); return mlflowTask; } private MlflowParameters createBasicAlgorithmParameters() { MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_PROJECTS); mlflowParameters.setMlflowJobType(MlflowConstants.JOB_TYPE_BASIC_ALGORITHM); mlflowParameters.setAlgorithm("xgboost");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
mlflowParameters.setDataPaths("/data/iris.csv"); mlflowParameters.setParams("n_estimators=100"); mlflowParameters.setExperimentNames("BasicAlgorithm"); mlflowParameters.setModelNames("BasicAlgorithm"); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); return mlflowParameters; } private MlflowParameters createAutoMLParameters() { MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_PROJECTS); mlflowParameters.setMlflowJobType(MlflowConstants.JOB_TYPE_AUTOML); mlflowParameters.setAutomlTool("autosklearn"); mlflowParameters.setParams("time_left_for_this_task=30"); mlflowParameters.setDataPaths("/data/iris.csv"); mlflowParameters.setExperimentNames("AutoML"); mlflowParameters.setModelNames("AutoML"); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); return mlflowParameters; } private MlflowParameters createCustomProjectParameters() { MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_PROJECTS); mlflowParameters.setMlflowJobType(MlflowConstants.JOB_TYPE_CUSTOM_PROJECT); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); mlflowParameters.setExperimentNames("custom_project"); mlflowParameters.setParams("-P learning_rate=0.2 -P colsample_bytree=0.8 -P subsample=0.9"); mlflowParameters.setMlflowProjectRepository("https://github.com/mlflow/mlflow#examples/xgboost/xgboost_native"); return mlflowParameters; } private MlflowParameters createModelDeplyMlflowParameters() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,740
[Optimization]Optimize some details of MLFlow task plugin
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description - [x] Add a health check for deploying the model with docker - [x] Change to health Check implemented in Java instead of shell command - [x] Modify the test case to improve reading ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10740
https://github.com/apache/dolphinscheduler/pull/10739
5b0347e8daa997da7d0214c81b385828bcb1de0c
7d79a2165ee5f0bf1aa7c949c852da179d6c0cc9
2022-07-02T13:42:23Z
java
2022-07-05T03:05:20Z
dolphinscheduler-task-plugin/dolphinscheduler-task-mlflow/src/test/java/org/apache/dolphinler/plugin/task/mlflow/MlflowTaskTest.java
MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_MODELS); mlflowParameters.setDeployType(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_MLFLOW); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); mlflowParameters.setDeployModelKey("runs:/a272ec279fc34a8995121ae04281585f/model"); mlflowParameters.setDeployPort("7000"); return mlflowParameters; } private MlflowParameters createModelDeplyDockerParameters() { MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_MODELS); mlflowParameters.setDeployType(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_DOCKER); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); mlflowParameters.setDeployModelKey("runs:/a272ec279fc34a8995121ae04281585f/model"); mlflowParameters.setDeployPort("7000"); return mlflowParameters; } private MlflowParameters createModelDeplyDockerComposeParameters() { MlflowParameters mlflowParameters = new MlflowParameters(); mlflowParameters.setMlflowTaskType(MlflowConstants.MLFLOW_TASK_TYPE_MODELS); mlflowParameters.setDeployType(MlflowConstants.MLFLOW_MODELS_DEPLOY_TYPE_DOCKER_COMPOSE); mlflowParameters.setMlflowTrackingUris("http://127.0.0.1:5000"); mlflowParameters.setDeployModelKey("models:/22222/1"); mlflowParameters.setDeployPort("7000"); mlflowParameters.setCpuLimit("0.5"); mlflowParameters.setMemoryLimit("200m"); return mlflowParameters; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
/* * 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.dolphinscheduler.spi.utils; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Calendar;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
import java.util.Date; import java.util.Objects; import java.util.TimeZone; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * date utils */ public class DateUtils { static final long C0 = 1L; static final long C1 = C0 * 1000L; static final long C2 = C1 * 1000L; static final long C3 = C2 * 1000L; static final long C4 = C3 * 60L; static final long C5 = C4 * 60L; /** * a default datetime formatter for the timestamp */ private static final DateTimeFormatter DEFAULT_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); private DateUtils() { throw new UnsupportedOperationException("Construct DateUtils"); } /** * @param timeMillis timeMillis like System.currentTimeMillis() * @return string formatted as yyyy-MM-dd HH:mm:ss */ public static String formatTimeStamp(long timeMillis) { return formatTimeStamp(timeMillis, DEFAULT_DATETIME_FORMATTER); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
/** * @param timeMillis timeMillis like System.currentTimeMillis() * @param dateTimeFormatter expect formatter, like yyyy-MM-dd HH:mm:ss * @return formatted string */ public static String formatTimeStamp(long timeMillis, DateTimeFormatter dateTimeFormatter) { Objects.requireNonNull(dateTimeFormatter); return dateTimeFormatter.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), ZoneId.systemDefault())); } /** * date to local datetime * * @param date date * @return local datetime */ private static LocalDateTime date2LocalDateTime(Date date) { return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); } /** * local datetime to date * * @param localDateTime local datetime * @return date */ private static Date localDateTime2Date(LocalDateTime localDateTime) { Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); return Date.from(instant); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
* get the formatted date string * * @param date date * @param format e.g. yyyy-MM-dd HH:mm:ss * @return date string */ public static String format(Date date, String format) { return format(date2LocalDateTime(date), format); } /** * get the formatted date string * * @param localDateTime local data time * @param format yyyy-MM-dd HH:mm:ss * @return date string */ public static String format(LocalDateTime localDateTime, String format) { return localDateTime.format(DateTimeFormatter.ofPattern(format)); } /** * convert string to date and time * * @param date date * @param format format * @return date */ public static Date parse(String date, String format) { try { LocalDateTime ldt = LocalDateTime.parse(date, DateTimeFormatter.ofPattern(format)); return localDateTime2Date(ldt);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
} catch (Exception e) { logger.error("error while parse date:" + date, e); } return null; } /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param str date string * @return yyyy-MM-dd HH:mm:ss format */ public static Date stringToDate(String str) { return parse(str, Constants.YYYY_MM_DD_HH_MM_SS); } /** * get seconds between two dates * * @param d1 date1 * @param d2 date2 * @return differ seconds */ public static long differSec(Date d1, Date d2) { if (d1 == null || d2 == null) { return 0; } return (long) Math.ceil(differMs(d1, d2) / 1000.0); } /** * get ms between two dates *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
* @param d1 date1 * @param d2 date2 * @return differ ms */ public static long differMs(Date d1, Date d2) { return Math.abs(d1.getTime() - d2.getTime()); } /** * get the date of the specified date in the days before and after * * @param date date * @param day day * @return the date of the specified date in the days before and after */ public static Date getSomeDay(Date date, int day) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, day); return calendar.getTime(); } /** * get the hour of day. * * @param date date * @return hour of day */ public static int getHourIndex(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.HOUR_OF_DAY);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
} /** * compare two dates * * @param future future date * @param old old date * @return true if future time greater than old time */ public static boolean compare(Date future, Date old) { return future.getTime() > old.getTime(); } /** * convert schedule string to date * * @param schedule schedule * @return convert schedule string to date */ public static Date getScheduleDate(String schedule) { return stringToDate(schedule); } /** * get monday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date * @return get monday */ public static Date getMonday(Date date) { Calendar cal = Calendar.getInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return cal.getTime(); } /** * get sunday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date * @return get sunday */ public static Date getSunday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); return cal.getTime(); } /** * get first day of month * * @param date date * @return first day of month */ public static Date getFirstDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, 1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
return cal.getTime(); } /** * get some hour of day * * @param date date * @param offsetHour hours * @return some hour of day */ public static Date getSomeHourOfDay(Date date, int offsetHour) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + offsetHour); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * get last day of month * * @param date date * @return get last day of month */ public static Date getLastDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MONTH, 1); cal.set(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.DAY_OF_MONTH, -1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay date * @return start day */ public static Date getStartOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of day */ public static Date getEndOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay day * @return start of hour */ public static Date getStartOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of hour */ public static Date getEndOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
/** * get current date * * @return current date */ public static Date getCurrentDate() { return new Date(); } public static Date addMonths(Date date, int amount) { return add(date, 2, amount); } public static Date addDays(Date date, int amount) { return add(date, 5, amount); } public static Date addMinutes(Date date, int amount) { return add(date, 12, amount); } /** * get date * * @param date date * @param calendarField calendarField * @param amount amount * @return date */ public static Date add(final Date date, final int calendarField, final int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar c = Calendar.getInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/utils/DateUtils.java
c.setTime(date); c.add(calendarField, amount); return c.getTime(); } /** * starting from the current time, get how many seconds are left before the target time. * targetTime = baseTime + intervalSeconds * * @param baseTime base time * @param intervalSeconds a period of time * @return the number of seconds */ public static long getRemainTime(Date baseTime, long intervalSeconds) { if (baseTime == null) { return 0; } long usedTime = (System.currentTimeMillis() - baseTime.getTime()) / 1000; return intervalSeconds - usedTime; } /** * get timezone by timezoneId */ public static TimeZone getTimezone(String timezoneId) { if (StringUtils.isEmpty(timezoneId)) { return null; } return TimeZone.getTimeZone(timezoneId); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterConstants.java
/* * 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.dolphinscheduler.plugin.task.jupyter; public class JupyterConstants {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterConstants.java
private JupyterConstants() { throw new IllegalStateException("Utility class"); } /** * conda init */ public static final String CONDA_INIT = "source"; /** * conda activate */ public static final String CONDA_ACTIVATE = "conda activate"; /** * create and activate conda env from tar */ public static final String CREATE_ENV_FROM_TAR = "mkdir jupyter_env && " + "tar -xzf %s -C jupyter_env && " + "source jupyter_env/bin/activate"; /** * file suffix tar.gz */ public static final String TAR_SUFFIX = ".tar.gz"; /** * jointer to combine two command */ public static final String JOINTER = "&&"; /** * papermill */ public static final String PAPERMILL = "papermill";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterConstants.java
/** * Parameters to pass to the parameters cell. */ public static final String PARAMETERS = "--parameters"; /** * Name of kernel to run. */ public static final String KERNEL = "--kernel"; /** * The execution engine name to use in evaluating the notebook. */ public static final String ENGINE = "--engine"; /** * Time in seconds to wait for each cell before failing execution (default: forever) */ public static final String EXECUTION_TIMEOUT = "--execution-timeout"; /** * Time in seconds to wait for kernel to start. */ public static final String START_TIMEOUT = "--start-timeout"; /** * Insert the paths of input/output notebooks as PAPERMILL_INPUT_PATH/PAPERMILL_OUTPUT_PATH as notebook parameters. */ public static final String INJECT_PATHS = "--inject-paths"; /** * Flag for turning on the progress bar. */ public static final String PROGRESS_BAR = "--progress-bar"; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
* * 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.dolphinscheduler.plugin.task.jupyter; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils; import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils; import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.databind.ObjectMapper; public class JupyterTask extends AbstractTaskExecutor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
/** * jupyter parameters */ private JupyterParameters jupyterParameters; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; private ShellCommandExecutor shellCommandExecutor; public JupyterTask(TaskExecutionContext taskExecutionContext) { super(taskExecutionContext); this.taskExecutionContext = taskExecutionContext; this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, taskExecutionContext, logger); } @Override public void init() { logger.info("jupyter task params {}", taskExecutionContext.getTaskParams()); jupyterParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), JupyterParameters.class); if (null == jupyterParameters) { logger.error("jupyter params is null"); return; } if (!jupyterParameters.checkParameters()) { throw new RuntimeException("jupyter task params is not valid"); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
@Override public void handle() throws Exception { try { TaskResponse response = shellCommandExecutor.run(buildCommand()); setExitStatusCode(response.getExitStatusCode()); setAppIds(response.getAppIds()); setProcessId(response.getProcessId()); } catch (Exception e) { logger.error("jupyter task execution failure", e); exitStatusCode = -1; throw e; } } /** * create command * * @return command */ protected String buildCommand() throws IOException { /** * papermill [OPTIONS] NOTEBOOK_PATH [OUTPUT_PATH] */ List<String> args = new ArrayList<>(); final String condaPath = PropertyUtils.getString(TaskConstants.CONDA_PATH); args.add(JupyterConstants.CONDA_INIT); args.add(condaPath); args.add(JupyterConstants.JOINTER); String condaEnvName = jupyterParameters.getCondaEnvName(); if (condaEnvName.endsWith(JupyterConstants.TAR_SUFFIX)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
args.add(String.format(JupyterConstants.CREATE_ENV_FROM_TAR, condaEnvName)); } else { args.add(JupyterConstants.CONDA_ACTIVATE); args.add(jupyterParameters.getCondaEnvName()); } args.add(JupyterConstants.JOINTER); args.add(JupyterConstants.PAPERMILL); args.add(jupyterParameters.getInputNotePath()); args.add(jupyterParameters.getOutputNotePath()); args.addAll(populateJupyterParameterization()); args.addAll(populateJupyterOptions()); Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap(); String command = ParameterUtils.convertParameterPlaceholders(String.join(" ", args), ParamUtils.convert(paramsMap)); logger.info("jupyter task command: {}", command); return command; } /** * build jupyter parameterization * * @return argument list */ private List<String> populateJupyterParameterization() throws IOException { List<String> args = new ArrayList<>(); String parameters = jupyterParameters.getParameters(); if (StringUtils.isNotEmpty(parameters)) { ObjectMapper mapper = new ObjectMapper(); try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
Map<String, String> jupyterParamsMap = mapper.readValue(parameters, Map.class); for (String key : jupyterParamsMap.keySet()) { args.add(JupyterConstants.PARAMETERS); args.add(key); args.add(jupyterParamsMap.get(key)); } } catch (IOException e) { logger.error("fail to parse jupyter parameterization", e); throw e; } } return args; } /** * build jupyter options * * @return argument list */ private List<String> populateJupyterOptions() { List<String> args = new ArrayList<>(); String kernel = jupyterParameters.getKernel(); if (StringUtils.isNotEmpty(kernel)) { args.add(JupyterConstants.KERNEL); args.add(kernel); } String engine = jupyterParameters.getEngine(); if (StringUtils.isNotEmpty(engine)) { args.add(JupyterConstants.ENGINE); args.add(engine);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/main/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTask.java
} String executionTimeout = jupyterParameters.getExecutionTimeout(); if (StringUtils.isNotEmpty(executionTimeout)) { args.add(JupyterConstants.EXECUTION_TIMEOUT); args.add(executionTimeout); } String startTimeout = jupyterParameters.getStartTimeout(); if (StringUtils.isNotEmpty(startTimeout)) { args.add(JupyterConstants.START_TIMEOUT); args.add(startTimeout); } String others = jupyterParameters.getOthers(); if (StringUtils.isNotEmpty(others)) { args.add(others); } args.add(JupyterConstants.INJECT_PATHS); args.add(JupyterConstants.PROGRESS_BAR); return args; } @Override public void cancelApplication(boolean cancelApplication) throws Exception { shellCommandExecutor.cancelApplication(); } @Override public AbstractParameters getParameters() { return jupyterParameters; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/test/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTaskTest.java
/* * 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.dolphinscheduler.plugin.task.jupyter; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; import org.powermock.modules.junit4.PowerMockRunner; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import static org.mockito.ArgumentMatchers.any;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/test/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTaskTest.java
import static org.powermock.api.mockito.PowerMockito.spy; import static org.powermock.api.mockito.PowerMockito.when; @RunWith(PowerMockRunner.class) @PrepareForTest({ JSONUtils.class, PropertyUtils.class, }) @PowerMockIgnore({"javax.*"}) @SuppressStaticInitializationFor("org.apache.dolphinscheduler.spi.utils.PropertyUtils") public class JupyterTaskTest { @Test public void testBuildJupyterCommandWithLocalEnv() throws Exception { String parameters = buildJupyterCommandWithLocalEnv(); TaskExecutionContext taskExecutionContext = PowerMockito.mock(TaskExecutionContext.class); when(taskExecutionContext.getTaskParams()).thenReturn(parameters); PowerMockito.mockStatic(PropertyUtils.class); when(PropertyUtils.getString(any())).thenReturn("/opt/anaconda3/etc/profile.d/conda.sh"); JupyterTask jupyterTask = spy(new JupyterTask(taskExecutionContext)); jupyterTask.init(); Assert.assertEquals(jupyterTask.buildCommand(), "source /opt/anaconda3/etc/profile.d/conda.sh && " + "conda activate jupyter-lab && " + "papermill " + "/test/input_note.ipynb " + "/test/output_note.ipynb " + "--parameters city Shanghai " + "--parameters factor 0.01 " + "--kernel python3 " + "--engine default_engine " + "--execution-timeout 10 " +
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/test/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTaskTest.java
"--start-timeout 3 " + "--version " + "--inject-paths " + "--progress-bar"); } @Test public void testBuildJupyterCommandWithPackedEnv() throws Exception { String parameters = buildJupyterCommandWithPackedEnv(); TaskExecutionContext taskExecutionContext = PowerMockito.mock(TaskExecutionContext.class); when(taskExecutionContext.getTaskParams()).thenReturn(parameters); PowerMockito.mockStatic(PropertyUtils.class); when(PropertyUtils.getString(any())).thenReturn("/opt/anaconda3/etc/profile.d/conda.sh"); JupyterTask jupyterTask = spy(new JupyterTask(taskExecutionContext)); jupyterTask.init(); Assert.assertEquals(jupyterTask.buildCommand(), "source /opt/anaconda3/etc/profile.d/conda.sh && " + "mkdir jupyter_env && " + "tar -xzf jupyter.tar.gz -C jupyter_env && " + "source jupyter_env/bin/activate && " + "papermill " + "/test/input_note.ipynb " + "/test/output_note.ipynb " + "--parameters city Shanghai " + "--parameters factor 0.01 " + "--kernel python3 " + "--engine default_engine " + "--execution-timeout 10 " + "--start-timeout 3 " + "--version " + "--inject-paths " +
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,648
[Feature][Task Plugin] Enable users to create python env from requirements.txt
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description * We have already provided users with ability to create / switch python envs by names or packed conda envs. The last approach we could offer is to create envs from `requirements.txt` as discussed in comment: https://github.com/apache/dolphinscheduler/issues/10302#issuecomment-1149527875 ### Use case * See #10302 ### Related issues related: #10302 ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10648
https://github.com/apache/dolphinscheduler/pull/10658
426567348ec3dee46171c2cee4b44dd01c0a97a3
71f016851093c18376e3bb301bf6e41dee215706
2022-06-28T03:09:51Z
java
2022-07-06T07:56:39Z
dolphinscheduler-task-plugin/dolphinscheduler-task-jupyter/src/test/java/org/apache/dolphinscheduler/plugin/task/jupyter/JupyterTaskTest.java
"--progress-bar"); } private String buildJupyterCommandWithLocalEnv() { JupyterParameters jupyterParameters = new JupyterParameters(); jupyterParameters.setCondaEnvName("jupyter-lab"); jupyterParameters.setInputNotePath("/test/input_note.ipynb"); jupyterParameters.setOutputNotePath("/test/output_note.ipynb"); jupyterParameters.setParameters("{\"city\": \"Shanghai\", \"factor\": \"0.01\"}"); jupyterParameters.setKernel("python3"); jupyterParameters.setEngine("default_engine"); jupyterParameters.setExecutionTimeout("10"); jupyterParameters.setStartTimeout("3"); jupyterParameters.setOthers("--version"); return JSONUtils.toJsonString(jupyterParameters); } private String buildJupyterCommandWithPackedEnv() { JupyterParameters jupyterParameters = new JupyterParameters(); jupyterParameters.setCondaEnvName("jupyter.tar.gz"); jupyterParameters.setInputNotePath("/test/input_note.ipynb"); jupyterParameters.setOutputNotePath("/test/output_note.ipynb"); jupyterParameters.setParameters("{\"city\": \"Shanghai\", \"factor\": \"0.01\"}"); jupyterParameters.setKernel("python3"); jupyterParameters.setEngine("default_engine"); jupyterParameters.setExecutionTimeout("10"); jupyterParameters.setStartTimeout("3"); jupyterParameters.setOthers("--version"); return JSONUtils.toJsonString(jupyterParameters); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
* (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.dolphinscheduler.dao.mapper; import static java.util.stream.Collectors.toList; import org.apache.dolphinscheduler.common.enums.UdfType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.UDFUser; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; public class UdfFuncMapperTest extends BaseDaoTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
@Autowired private UserMapper userMapper; @Autowired private UdfFuncMapper udfFuncMapper; @Autowired private UDFUserMapper udfUserMapper; /** * insert one udf * * @return UdfFunc */ private UdfFunc insertOne() { UdfFunc udfFunc = new UdfFunc(); udfFunc.setUserId(1); udfFunc.setFuncName("dolphin_udf_func"); udfFunc.setClassName("org.apache.dolphinscheduler.test.mr"); udfFunc.setType(UdfType.HIVE); udfFunc.setResourceId(1); udfFunc.setResourceName("dolphin_resource"); udfFunc.setCreateTime(new Date()); udfFunc.setUpdateTime(new Date()); udfFuncMapper.insert(udfFunc); return udfFunc; } /** * insert one udf
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
* * @return */ private UdfFunc insertOne(User user) { UdfFunc udfFunc = new UdfFunc(); udfFunc.setUserId(user.getId()); udfFunc.setFuncName("dolphin_udf_func"); udfFunc.setClassName("org.apache.dolphinscheduler.test.mr"); udfFunc.setType(UdfType.HIVE); udfFunc.setResourceId(1); udfFunc.setResourceName("dolphin_resource"); udfFunc.setCreateTime(new Date()); udfFunc.setUpdateTime(new Date()); udfFuncMapper.insert(udfFunc); return udfFunc; } /** * insert one user * * @return User */ private User insertOneUser() { User user = new User(); user.setUserName("user1"); user.setUserPassword("1"); user.setEmail("[email protected]"); user.setUserType(UserType.GENERAL_USER); user.setCreateTime(new Date()); user.setTenantId(1); user.setUpdateTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
userMapper.insert(user); return user; } /** * insert one user * * @return User */ private User insertOneUser(String userName) { User user = new User(); user.setUserName(userName); user.setUserPassword("1"); user.setEmail("[email protected]"); user.setUserType(UserType.GENERAL_USER); user.setCreateTime(new Date()); user.setTenantId(1); user.setUpdateTime(new Date()); userMapper.insert(user); return user; } /** * insert UDFUser * * @param user user * @param udfFunc udf func * @return UDFUser */ private UDFUser insertOneUDFUser(User user, UdfFunc udfFunc) { UDFUser udfUser = new UDFUser(); udfUser.setUdfId(udfFunc.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
udfUser.setUserId(user.getId()); udfUser.setCreateTime(new Date()); udfUser.setUpdateTime(new Date()); udfUserMapper.insert(udfUser); return udfUser; } /** * create general user * * @return User */ private User createGeneralUser(String userName) { User user = new User(); user.setUserName(userName); user.setUserPassword("1"); user.setEmail("[email protected]"); user.setUserType(UserType.GENERAL_USER); user.setCreateTime(new Date()); user.setTenantId(1); user.setUpdateTime(new Date()); userMapper.insert(user); return user; } /** * test update */ @Test public void testUpdate() { UdfFunc udfFunc = insertOne();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
udfFunc.setResourceName("dolphin_resource_update"); udfFunc.setResourceId(2); udfFunc.setClassName("org.apache.dolphinscheduler.test.mrUpdate"); udfFunc.setUpdateTime(new Date()); int update = udfFuncMapper.updateById(udfFunc); Assert.assertEquals(update, 1); } /** * test delete */ @Test public void testDelete() { UdfFunc udfFunc = insertOne(); int delete = udfFuncMapper.deleteById(udfFunc.getId()); Assert.assertEquals(delete, 1); } /** * test query udf by ids */ @Test public void testQueryUdfByIdStr() { UdfFunc udfFunc = insertOne(); UdfFunc udfFunc1 = insertOne(); Integer[] idArray = new Integer[]{udfFunc.getId(), udfFunc1.getId()};
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfByIdStr(idArray, ""); Assert.assertNotEquals(udfFuncList.size(), 0); } /** * test page */ @Test public void testQueryUdfFuncPaging() { User user = insertOneUser(); UdfFunc udfFunc = insertOne(user); Page<UdfFunc> page = new Page(1, 3); IPage<UdfFunc> udfFuncIPage = udfFuncMapper.queryUdfFuncPaging(page, Collections.singletonList(udfFunc.getId()), ""); Assert.assertNotEquals(udfFuncIPage.getTotal(), 0); } /** * test get udffunc by type */ @Test public void testGetUdfFuncByType() { User user = insertOneUser(); UdfFunc udfFunc = insertOne(user); List<UdfFunc> udfFuncList = udfFuncMapper.getUdfFuncByType(Collections.singletonList(udfFunc.getId()), udfFunc.getType().ordinal()); Assert.assertNotEquals(udfFuncList.size(), 0); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
/** * test query udffunc expect userId */ @Test public void testQueryUdfFuncExceptUserId() { User user1 = insertOneUser(); User user2 = insertOneUser("user2"); UdfFunc udfFunc1 = insertOne(user1); UdfFunc udfFunc2 = insertOne(user2); List<UdfFunc> udfFuncList = udfFuncMapper.queryUdfFuncExceptUserId(user1.getId()); Assert.assertNotEquals(udfFuncList.size(), 0); } /** * test query authed udffunc */ @Test public void testQueryAuthedUdfFunc() { User user = insertOneUser(); UdfFunc udfFunc = insertOne(user); UDFUser udfUser = insertOneUDFUser(user, udfFunc); List<UdfFunc> udfFuncList = udfFuncMapper.queryAuthedUdfFunc(user.getId()); Assert.assertNotEquals(udfFuncList.size(), 0); } @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,806
[Improvement] Project, Queue, UDF, Tenant module database tables are missing unique indexes.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Project, Queue, UDF, Tenant module database tables are missing unique indexes. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10806
https://github.com/apache/dolphinscheduler/pull/10807
5083e0be6a12e85f000d12c05dcdf0021f42c741
b8a90d801e2c38c59dd2d250ff5c8a5505cceeed
2022-07-06T07:53:23Z
java
2022-07-07T06:35:50Z
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/UdfFuncMapperTest.java
public void testListAuthorizedUdfFunc() { User generalUser1 = createGeneralUser("user1"); User generalUser2 = createGeneralUser("user2"); UdfFunc udfFunc = insertOne(generalUser1); UdfFunc unauthorizdUdfFunc = insertOne(generalUser2); Integer[] udfFuncIds = new Integer[]{udfFunc.getId(), unauthorizdUdfFunc.getId()}; List<UdfFunc> authorizedUdfFunc = udfFuncMapper.listAuthorizedUdfFunc(generalUser1.getId(), udfFuncIds); Assert.assertEquals(generalUser1.getId(), udfFunc.getUserId()); Assert.assertNotEquals(generalUser1.getId(), unauthorizdUdfFunc.getUserId()); Assert.assertFalse(authorizedUdfFunc.stream().map(t -> t.getId()).collect(toList()).containsAll(Arrays.asList(udfFuncIds))); insertOneUDFUser(generalUser1, unauthorizdUdfFunc); authorizedUdfFunc = udfFuncMapper.listAuthorizedUdfFunc(generalUser1.getId(), udfFuncIds); Assert.assertTrue(authorizedUdfFunc.stream().map(t -> t.getId()).collect(toList()).containsAll(Arrays.asList(udfFuncIds))); } @Test public void batchUpdateUdfFuncTest() { User generalUser1 = createGeneralUser("user1"); UdfFunc udfFunc = insertOne(generalUser1); udfFunc.setResourceName("/updateTest"); List<UdfFunc> udfFuncList = new ArrayList<>(); udfFuncList.add(udfFunc); Assert.assertTrue(udfFuncMapper.batchUpdateUdfFunc(udfFuncList) > 0); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,861
[BUG-BE][Complete Date] Complement numbers will run in a loop under the serial strategy
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Complement numbers will run in a loop under the serial strategy ### What you expected to happen Complement numbers will run in a loop under the serial strategy ### How to reproduce After creating the workflow, select the complement mode and execute it. ### Anything else No ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10861
https://github.com/apache/dolphinscheduler/pull/10862
057a9f6b241bae28ea5ec6d8e1e082b64f6410f3
b5653ea7f2d4d14ba92c45e429c2191099450b0f
2022-07-09T06:50:39Z
java
2022-07-09T08:41:51Z
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java
/* * Lcensed to the Apache Software Foundaton (ASF) under one or more * contrbutor lcense agreements. See the NOTICE fle dstrbuted wth * ths work for addtonal nformaton regardng copyrght ownershp.