status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
369
body
stringlengths
0
254k
issue_url
stringlengths
37
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
4
188
file_content
stringlengths
0
5.12M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,310
[Bug] [Master] TaskResponseProcessor process NullPointerException
### 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 ``` [ERROR] 2021-12-10 13:01:03.481 org.apache.dolphinscheduler.remote.handler.NettyClientHandler:[156] - process command Command [type=TASK_EXECUTE_RESPONSE, opaque=15, bodyLen=130] exception java.lang.NullPointerException: null at org.apache.dolphinscheduler.server.master.processor.TaskResponseProcessor.process(TaskResponseProcessor.java:72) at org.apache.dolphinscheduler.remote.handler.NettyClientHandler.lambda$processByCommandType$0(NettyClientHandler.java:154) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` ### What you expected to happen Workflow execution ### How to reproduce Manually execute a workflow ### Anything else _No response_ ### 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/7310
https://github.com/apache/dolphinscheduler/pull/7318
f03b0e8c7b562b77715185cbaeacc598cba87e12
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
"2021-12-10T05:25:06Z"
java
"2021-12-10T08:55:56Z"
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/processor/TaskResponseProcessor.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.server.master.processor; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.server.master.processor.queue.TaskResponseEvent; import org.apache.dolphinscheduler.server.master.processor.queue.TaskResponseService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import io.netty.channel.Channel; import org.springframework.beans.factory.annotation.Autowired; /** * task response processor */ public class TaskResponseProcessor implements NettyRequestProcessor { private final Logger logger = LoggerFactory.getLogger(TaskResponseProcessor.class); @Autowired private TaskResponseService taskResponseService; /** * task final result response * need master process , state persistence * * @param channel channel * @param command command */ @Override public void process(Channel channel, Command command) { Preconditions.checkArgument(CommandType.TASK_EXECUTE_RESPONSE == command.getType(), String.format("invalid command type : %s", command.getType())); TaskExecuteResponseCommand responseCommand = JSONUtils.parseObject(command.getBody(), TaskExecuteResponseCommand.class); logger.info("received command : {}", responseCommand); // TaskResponseEvent TaskResponseEvent taskResponseEvent = TaskResponseEvent.newResult(ExecutionStatus.of(responseCommand.getStatus()), responseCommand.getEndTime(), responseCommand.getProcessId(), responseCommand.getAppIds(), responseCommand.getTaskInstanceId(), responseCommand.getVarPool(), channel, responseCommand.getProcessInstanceId() ); taskResponseService.addResponse(taskResponseEvent); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,310
[Bug] [Master] TaskResponseProcessor process NullPointerException
### 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 ``` [ERROR] 2021-12-10 13:01:03.481 org.apache.dolphinscheduler.remote.handler.NettyClientHandler:[156] - process command Command [type=TASK_EXECUTE_RESPONSE, opaque=15, bodyLen=130] exception java.lang.NullPointerException: null at org.apache.dolphinscheduler.server.master.processor.TaskResponseProcessor.process(TaskResponseProcessor.java:72) at org.apache.dolphinscheduler.remote.handler.NettyClientHandler.lambda$processByCommandType$0(NettyClientHandler.java:154) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` ### What you expected to happen Workflow execution ### How to reproduce Manually execute a workflow ### Anything else _No response_ ### 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/7310
https://github.com/apache/dolphinscheduler/pull/7318
f03b0e8c7b562b77715185cbaeacc598cba87e12
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
"2021-12-10T05:25:06Z"
java
"2021-12-10T08:55:56Z"
dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/processor/CacheProcessorTest.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.server.master.processor; import org.apache.dolphinscheduler.common.enums.CacheType; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.remote.command.CacheExpireCommand; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import io.netty.channel.Channel; /** * task ack processor test */ @RunWith(PowerMockRunner.class) @PrepareForTest({SpringApplicationContext.class}) public class CacheProcessorTest { private CacheProcessor cacheProcessor; @Mock private Channel channel; @Mock private CacheManager cacheManager; @Mock private Cache cache; @Before public void before() { PowerMockito.mockStatic(SpringApplicationContext.class); PowerMockito.when(SpringApplicationContext.getBean(CacheManager.class)).thenReturn(cacheManager); Mockito.when(cacheManager.getCache(CacheType.TENANT.getCacheName())).thenReturn(cache); cacheProcessor = new CacheProcessor(); } @Test public void testProcess() { Tenant tenant = new Tenant(); tenant.setId(1); CacheExpireCommand cacheExpireCommand = new CacheExpireCommand(CacheType.TENANT, "1"); Command command = cacheExpireCommand.convert2Command(); cacheProcessor.process(channel, command); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/aspect/CacheEvictAspect.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.api.aspect; import org.apache.dolphinscheduler.common.enums.CacheType; import org.apache.dolphinscheduler.remote.command.CacheExpireCommand; import org.apache.dolphinscheduler.service.cache.CacheNotifyService; import org.apache.dolphinscheduler.service.cache.impl.CacheKeyGenerator; import org.apache.commons.lang3.StringUtils; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.expression.EvaluationContext; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.stereotype.Component; /** * aspect for cache evict */ @Aspect @Component public class CacheEvictAspect { private static final Logger logger = LoggerFactory.getLogger(CacheEvictAspect.class); /** * symbol of spring el */ private static final String EL_SYMBOL = "#"; @Autowired private CacheKeyGenerator cacheKeyGenerator; @Autowired private CacheNotifyService cacheNotifyService; @Pointcut("@annotation(org.springframework.cache.annotation.CacheEvict)") public void cacheEvictPointCut() { // Do nothing because of it's a pointcut } @Around("cacheEvictPointCut()") public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { MethodSignature sign = (MethodSignature) proceedingJoinPoint.getSignature(); Method method = sign.getMethod(); Object target = proceedingJoinPoint.getTarget(); Object[] args = proceedingJoinPoint.getArgs(); Object result = proceedingJoinPoint.proceed(); CacheConfig cacheConfig = method.getDeclaringClass().getAnnotation(CacheConfig.class); CacheEvict cacheEvict = method.getAnnotation(CacheEvict.class); CacheType cacheType = getCacheType(cacheConfig, cacheEvict); if (cacheType != null) { String cacheKey; if (cacheEvict.key().isEmpty()) { cacheKey = (String) cacheKeyGenerator.generate(target, method, args); } else { cacheKey = cacheEvict.key(); List<Name> paramsList = getParamAnnotationsByType(method, Name.class); if (cacheEvict.key().contains(EL_SYMBOL)) { cacheKey = parseKey(cacheEvict.key(), paramsList.stream().map(o -> o.value()).collect(Collectors.toList()), Arrays.asList(args)); } } if (StringUtils.isNotEmpty(cacheKey)) { cacheNotifyService.notifyMaster(new CacheExpireCommand(cacheType, cacheKey).convert2Command()); } } return result; } private CacheType getCacheType(CacheConfig cacheConfig, CacheEvict cacheEvict) { String cacheName = null; if (cacheEvict.cacheNames().length > 0) { cacheName = cacheEvict.cacheNames()[0]; } if (cacheConfig.cacheNames().length > 0) { cacheName = cacheConfig.cacheNames()[0]; } if (cacheName == null) { return null; } for (CacheType cacheType : CacheType.values()) { if (cacheType.getCacheName().equals(cacheName)) { return cacheType; } } return null; } private String parseKey(String key, List<String> paramNameList, List<Object> paramList) { SpelExpressionParser spelParser = new SpelExpressionParser(); EvaluationContext ctx = new StandardEvaluationContext(); for (int i = 0; i < paramNameList.size(); i++) { ctx.setVariable("p" + i, paramList.get(i)); } Object obj = spelParser.parseExpression(key).getValue(ctx); if (null == obj) { throw new RuntimeException("parseKey error"); } return obj.toString(); } private <T extends Annotation> List<T> getParamAnnotationsByType(Method method, Class<T> annotationClass) { List<T> annotationsList = new ArrayList<>(); Annotation[][] annotations = method.getParameterAnnotations(); for (int i = 0; i < annotations.length; i++) { Annotation[] annotationsI = annotations[i]; for (Annotation annotation : annotationsI) { if (annotation.annotationType().equals(annotationClass)) { annotationsList.add((T) annotation); } } } return annotationsList; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.ibatis.annotations.Param; import java.util.List; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * process definition log mapper interface */ @CacheConfig(cacheNames = "processDefinition") public interface ProcessDefinitionLogMapper extends BaseMapper<ProcessDefinitionLog> { /** * query process definition log by name * * @param projectCode projectCode * @param name process definition name * @return process definition log list */ List<ProcessDefinitionLog> queryByDefinitionName(@Param("projectCode") long projectCode, @Param("name") String name); /** * query process definition log list * * @param code process definition code * @return process definition log list */ List<ProcessDefinitionLog> queryByDefinitionCode(@Param("code") long code); /** * query max version for definition */ Integer queryMaxVersionForDefinition(@Param("code") long code); /** * query max version definition log */ ProcessDefinitionLog queryMaxVersionDefinitionLog(@Param("code") long code); /** * query the certain process definition version info by process definition code and version number * * @param code process definition code * @param version version number * @return the process definition version info */ @Cacheable(sync = true, key = "#processDefinitionCode + '_' + #version") ProcessDefinitionLog queryByDefinitionCodeAndVersion(@Param("code") long code, @Param("version") int version); /** * query the paging process definition version list by pagination info * * @param page pagination info * @param code process definition code * @param projectCode project code * @return the paging process definition version list */ IPage<ProcessDefinitionLog> queryProcessDefinitionVersionsPaging(Page<ProcessDefinitionLog> page, @Param("code") long code, @Param("projectCode") long projectCode); /** * delete the certain process definition version by process definition id and version number * * @param code process definition code * @param version version number * @return delete result */ int deleteByProcessDefinitionCodeAndVersion(@Param("code") long code, @Param("version") int version); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * process definition mapper interface */ @CacheConfig(cacheNames = "processDefinition", keyGenerator = "cacheKeyGenerator") public interface ProcessDefinitionMapper extends BaseMapper<ProcessDefinition> { /** * query process definition by code * * @param code code * @return process definition */ @Cacheable(sync = true) ProcessDefinition queryByCode(@Param("code") long code); /** * update */ @CacheEvict(key = "#p0.code") int updateById(@Name("processDefinition") @Param("et") ProcessDefinition processDefinition); /** * query process definition by code list * * @param codes codes * @return process definition list */ List<ProcessDefinition> queryByCodes(@Param("codes") Collection<Long> codes); /** * delete process definition by code * * @param code code * @return delete result */ @CacheEvict(key = "#code") int deleteByCode(@Name("code") @Param("code") long code); /** * verify process definition by name * * @param projectCode projectCode * @param name name * @return process definition */ ProcessDefinition verifyByDefineName(@Param("projectCode") long projectCode, @Param("processDefinitionName") String name); /** * query process definition by name * * @param projectCode projectCode * @param name name * @return process definition */ ProcessDefinition queryByDefineName(@Param("projectCode") long projectCode, @Param("processDefinitionName") String name); /** * query process definition by id * * @param processDefineId processDefineId * @return process definition */ ProcessDefinition queryByDefineId(@Param("processDefineId") int processDefineId); /** * process definition page * * @param page page * @param searchVal searchVal * @param userId userId * @param projectCode projectCode * @param isAdmin isAdmin * @return process definition IPage */ IPage<ProcessDefinition> queryDefineListPaging(IPage<ProcessDefinition> page, @Param("searchVal") String searchVal, @Param("userId") int userId, @Param("projectCode") long projectCode, @Param("isAdmin") boolean isAdmin); /** * query all process definition list * * @param projectCode projectCode * @return process definition list */ List<ProcessDefinition> queryAllDefinitionList(@Param("projectCode") long projectCode); /** * query process definition by ids * * @param ids ids * @return process definition list */ List<ProcessDefinition> queryDefinitionListByIdList(@Param("ids") Integer[] ids); /** * query process definition by tenant * * @param tenantId tenantId * @return process definition list */ List<ProcessDefinition> queryDefinitionListByTenant(@Param("tenantId") int tenantId); /** * Statistics process definition group by project codes list * <p> * We only need project codes to determine whether the definition belongs to the user or not. * * @param projectCodes projectCodes * @return definition group by user */ List<DefinitionGroupByUser> countDefinitionByProjectCodes(@Param("projectCodes") Long[] projectCodes); /** * list all resource ids * * @return resource ids list */ @MapKey("id") List<Map<String, Object>> listResources(); /** * list all resource ids by user id * * @return resource ids list */ @MapKey("id") List<Map<String, Object>> listResourcesByUser(@Param("userId") Integer userId); /** * list all project ids * * @return project ids list */ List<Integer> listProjectIds(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * process task relation mapper interface */ @CacheConfig(cacheNames = "processTaskRelation", keyGenerator = "cacheKeyGenerator") public interface ProcessTaskRelationMapper extends BaseMapper<ProcessTaskRelation> { /** * process task relation by projectCode and processCode * * @param projectCode projectCode * @param processCode processCode * @return ProcessTaskRelation list */ @Cacheable(sync = true) List<ProcessTaskRelation> queryByProcessCode(@Param("projectCode") long projectCode, @Param("processCode") long processCode); /** * update */ @CacheEvict(key = "#processTaskRelation.projectCode + '_' + #processTaskRelation.processDefinitionCode") int updateById(@Name("processTaskRelation") @Param("et") ProcessTaskRelation processTaskRelation); /** * process task relation by taskCode * * @param taskCodes taskCode list * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryByTaskCodes(@Param("taskCodes") Long[] taskCodes); /** * process task relation by taskCode * * @param taskCode taskCode * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryByTaskCode(@Param("taskCode") long taskCode); /** * delete process task relation by processCode * * @param projectCode projectCode * @param processCode processCode * @return int */ @CacheEvict(key = "#projectCode + '_' + #processCode") int deleteByCode(@Name("projectCode") @Param("projectCode") long projectCode, @Name("processCode") @Param("processCode") long processCode); /** * batch insert process task relation * * @param taskRelationList taskRelationList * @return int */ int batchInsert(@Param("taskRelationList") List<ProcessTaskRelationLog> taskRelationList); /** * query downstream process task relation by taskCode * * @param taskCode taskCode * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryDownstreamByTaskCode(@Param("taskCode") long taskCode); /** * query upstream process task relation by taskCode * * @param projectCode projectCode * @param taskCode taskCode * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryUpstreamByCode(@Param("projectCode") long projectCode, @Param("taskCode") long taskCode); /** * query downstream process task relation by taskCode * * @param projectCode projectCode * @param taskCode taskCode * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryDownstreamByCode(@Param("projectCode") long projectCode, @Param("taskCode") long taskCode); /** * query task relation by codes * * @param projectCode projectCode * @param taskCode taskCode * @param preTaskCodes preTaskCode list * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryUpstreamByCodes(@Param("projectCode") long projectCode, @Param("taskCode") long taskCode, @Param("preTaskCodes") Long[] preTaskCodes); /** * count upstream by codes * * @param projectCode projectCode * @param taskCode taskCode * @param processDefinitionCodes processDefinitionCodes * @return upstream count list group by process definition code */ List<Map<String, Long>> countUpstreamByCodeGroupByProcessDefinitionCode(@Param("projectCode") long projectCode, @Param("processDefinitionCodes") Long[] processDefinitionCodes, @Param("taskCode") long taskCode); /** * batch update process task relation pre task * * @param processTaskRelationList process task relation list * @return update num */ int batchUpdateProcessTaskRelationPreTask(@Param("processTaskRelationList") List<ProcessTaskRelation> processTaskRelationList); /** * query by code * * @param projectCode projectCode * @param processDefinitionCode processDefinitionCode * @param preTaskCode preTaskCode * @param postTaskCode postTaskCode * @return ProcessTaskRelation */ List<ProcessTaskRelation> queryByCode(@Param("projectCode") long projectCode, @Param("processDefinitionCode") long processDefinitionCode, @Param("preTaskCode") long preTaskCode, @Param("postTaskCode") long postTaskCode); /** * delete process task relation * * @param processTaskRelationLog processTaskRelationLog * @return int */ int deleteRelation(@Param("processTaskRelationLog") ProcessTaskRelationLog processTaskRelationLog); /** * count by code * * @param projectCode projectCode * @param processDefinitionCode processDefinitionCode * @param preTaskCode preTaskCode * @param postTaskCode postTaskCode * @return ProcessTaskRelation */ int countByCode(@Param("projectCode") long projectCode, @Param("processDefinitionCode") long processDefinitionCode, @Param("preTaskCode") long preTaskCode, @Param("postTaskCode") long postTaskCode); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.ibatis.annotations.Param; import java.util.List; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * scheduler mapper interface */ @CacheConfig(cacheNames = "schedule", keyGenerator = "cacheKeyGenerator") public interface ScheduleMapper extends BaseMapper<Schedule> { /** * scheduler page * @param page page * @param processDefinitionCode processDefinitionCode * @param searchVal searchVal * @return scheduler IPage */ IPage<Schedule> queryByProcessDefineCodePaging(IPage<Schedule> page, @Param("processDefinitionCode") long processDefinitionCode, @Param("searchVal") String searchVal); /** * query schedule list by project name * @param projectName projectName * @return schedule list */ List<Schedule> querySchedulerListByProjectName(@Param("projectName") String projectName); /** * query schedule list by process definition codes * @param processDefineCodes processDefineCodes * @return schedule list */ List<Schedule> selectAllByProcessDefineArray(@Param("processDefineCodes") long[] processDefineCodes); /** * query schedule list by process definition code * @param processDefinitionCode processDefinitionCode * @return schedule */ Schedule queryByProcessDefinitionCode(@Param("processDefinitionCode") long processDefinitionCode); /** * query schedule list by process definition code * @param processDefinitionCode processDefinitionCode * @return schedule list */ @Cacheable(sync = true) List<Schedule> queryReleaseSchedulerListByProcessDefinitionCode(@Param("processDefinitionCode") long processDefinitionCode); @CacheEvict(key = "#entity.processDefinitionCode") int insert(@Name("entity") Schedule entity); @CacheEvict(key = "#entity.processDefinitionCode") int updateById(@Name("entity") @Param("et")Schedule entity); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * task definition log mapper interface */ @CacheConfig(cacheNames = "taskDefinition", keyGenerator = "cacheKeyGenerator") public interface TaskDefinitionLogMapper extends BaseMapper<TaskDefinitionLog> { /** * query max version for definition * * @param code taskDefinitionCode */ Integer queryMaxVersionForDefinition(@Param("code") long code); /** * query task definition log * * @param code taskDefinitionCode * @param version version * @return task definition log */ @Cacheable(sync = true, key = "#code + '_' + #version") TaskDefinitionLog queryByDefinitionCodeAndVersion(@Param("code") long code, @Param("version") int version); /** * update */ @CacheEvict(key = "#taskDefinitionLog.code + '_' + #taskDefinitionLog.version") int updateById(@Name("taskDefinitionLog") @Param("et") TaskDefinitionLog taskDefinitionLog); /** * @param taskDefinitions taskDefinition list * @return list */ List<TaskDefinitionLog> queryByTaskDefinitions(@Param("taskDefinitions") Collection<TaskDefinition> taskDefinitions); /** * batch insert task definition logs * * @param taskDefinitionLogs taskDefinitionLogs * @return int */ int batchInsert(@Param("taskDefinitionLogs") List<TaskDefinitionLog> taskDefinitionLogs); /** * delete the certain task definition version by task definition code and version * * @param code task definition code * @param version task definition version * @return delete result */ @CacheEvict(key = "#code + '_' #version") int deleteByCodeAndVersion(@Name("code") @Param("code") long code, @Name("version") @Param("version") int version); /** * query the paging task definition version list by pagination info * * @param page pagination info * @param projectCode project code * @param code process definition code * @return the paging task definition version list */ IPage<TaskDefinitionLog> queryTaskDefinitionVersionsPaging(Page<TaskDefinitionLog> page, @Param("code") long code, @Param("projectCode") long projectCode); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TenantMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.ibatis.annotations.Param; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * tenant mapper interface */ @CacheConfig(cacheNames = "tenant", keyGenerator = "cacheKeyGenerator") public interface TenantMapper extends BaseMapper<Tenant> { /** * query tenant by id * * @param tenantId tenantId * @return tenant */ @Cacheable(sync = true) Tenant queryById(@Param("tenantId") int tenantId); /** * delete by id */ @CacheEvict int deleteById(int id); /** * update */ @CacheEvict(key = "#tenant.id") int updateById(@Name("tenant") @Param("et") Tenant tenant); /** * query tenant by code * * @param tenantCode tenantCode * @return tenant */ Tenant queryByTenantCode(@Param("tenantCode") String tenantCode); /** * tenant page * * @param page page * @param searchVal searchVal * @return tenant IPage */ IPage<Tenant> queryTenantPaging(IPage<Tenant> page, @Param("searchVal") String searchVal); /** * check tenant exist * * @param tenantCode tenantCode * @return true if exist else return null */ Boolean existTenant(@Param("tenantCode") String tenantCode); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,292
[Bug] [ApiServer] process definition online error when standalone
### 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 when use standalone mode, process definition online error. ![bd099b5b40e3cbf7b03cdbae10f4357](https://user-images.githubusercontent.com/11962619/145408679-57277ffa-b7d2-4879-90ac-692ba2c2ab33.jpg) ### What you expected to happen process definition online successfully. ### How to reproduce run standalone, create a new process definition, online. ### Anything else _No response_ ### 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/7292
https://github.com/apache/dolphinscheduler/pull/7293
939fa0c3bac50b43a519dfd3f4a6b8db1be92e92
0f7e38ed3c3acb9603e81479cc887e8e6133588e
"2021-12-09T13:52:45Z"
java
"2021-12-10T10:46:41Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/UserMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.ibatis.annotations.Param; import java.util.List; import org.springframework.boot.context.properties.bind.Name; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * user mapper interface */ @CacheConfig(cacheNames = "user", keyGenerator = "cacheKeyGenerator") public interface UserMapper extends BaseMapper<User> { /** * select by user id */ @Cacheable(sync = true) User selectById(int id); /** * delete by id */ @CacheEvict int deleteById(int id); /** * update */ @CacheEvict(key = "#user.id") int updateById(@Name("user") @Param("et") User user); /** * query all general user * * @return user list */ List<User> queryAllGeneralUser(); /** * query user by name * * @param userName userName * @return user */ User queryByUserNameAccurately(@Param("userName") String userName); /** * query user by userName and password * * @param userName userName * @param password password * @return user */ User queryUserByNamePassword(@Param("userName") String userName, @Param("password") String password); /** * user page * * @param page page * @param userName userName * @return user IPage */ IPage<User> queryUserPaging(Page page, @Param("userName") String userName); /** * query user detail by id * * @param userId userId * @return user */ User queryDetailsById(@Param("userId") int userId); /** * query user list by alertgroupId * * @param alertgroupId alertgroupId * @return user list */ List<User> queryUserListByAlertGroupId(@Param("alertgroupId") int alertgroupId); /** * query user list by tenantId * * @param tenantId tenantId * @return user list */ List<User> queryUserListByTenant(@Param("tenantId") int tenantId); /** * query user by userId * * @param userId userId * @return user */ User queryTenantCodeByUserId(@Param("userId") int userId); /** * query user by token * * @param token token * @return user */ User queryUserByToken(@Param("token") String token); /** * query user by queue name * * @param queueName queue name * @return user list */ List<User> queryUserListByQueue(@Param("queue") String queueName); /** * check the user exist * * @param queue queue name * @return true if exist else return null */ Boolean existUser(@Param("queue") String queue); /** * update user with old queue * * @param oldQueue old queue name * @param newQueue new queue name * @return update rows */ Integer updateUserQueue(@Param("oldQueue") String oldQueue, @Param("newQueue") String newQueue); /** * query user by ids * * @param ids id list * @return user list */ List<User> selectByIds(@Param("ids") List<Integer> ids); /** * query authed user list by projectId * @param projectId projectId * @return user list */ List<User> queryAuthedUserListByProjectId(@Param("projectId") int projectId); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,326
[Bug] [DAO] There are a few missing fields in the file of 2.0.0_schema/postgresql/dolphinscheduler_ddl.sql.
### 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 I upgraded the database through these files upgrade/xxxx_schema/postgresql/dolphinscheduler_ddl.sql. But there are a few table structure that aren't same as the table structure defined in the file sql/dolphinscheduler_postgre.sql. ### What you expected to happen I expect that the process of upgrading dolphinscheduler can be executed correctly. ### How to reproduce You can try the process of upgrading dolphinscheduler. ### Anything else _No response_ ### 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/7326
https://github.com/apache/dolphinscheduler/pull/7327
f1b85cf8920ea3dfd7899bf1102bb64798b8186e
ac67a11d44e7dd0feff47d2f7f0bd8b5a0b8f024
"2021-12-10T10:54:06Z"
java
"2021-12-10T11:50:55Z"
dolphinscheduler-dao/src/main/resources/sql/upgrade/2.0.0_schema/postgresql/dolphinscheduler_ddl.sql
/* * 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. */ delimiter d// CREATE OR REPLACE FUNCTION public.dolphin_update_metadata( ) RETURNS character varying LANGUAGE 'plpgsql' COST 100 VOLATILE PARALLEL UNSAFE AS $BODY$ DECLARE v_schema varchar; BEGIN ---get schema name v_schema =current_schema(); --- rename columns EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_command RENAME COLUMN process_definition_id to process_definition_code'; EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_error_command RENAME COLUMN process_definition_id to process_definition_code'; EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_process_instance RENAME COLUMN process_definition_id to process_definition_code'; EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_task_instance RENAME COLUMN process_definition_id to task_code'; EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_schedules RENAME COLUMN process_definition_id to process_definition_code'; EXECUTE 'ALTER TABLE IF EXISTS ' || quote_ident(v_schema) ||'.t_ds_process_definition RENAME COLUMN project_id to project_code'; --- alter column type EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ALTER COLUMN process_definition_code TYPE bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ALTER COLUMN process_definition_code TYPE bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ALTER COLUMN process_definition_code TYPE bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ALTER COLUMN task_code TYPE bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ALTER COLUMN process_definition_code TYPE bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ALTER COLUMN project_code TYPE bigint'; --- add columns EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_user ADD COLUMN IF NOT EXISTS "state" int DEFAULT 1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alertgroup ADD COLUMN IF NOT EXISTS "alert_instance_ids" varchar(255) DEFAULT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_alertgroup ADD COLUMN IF NOT EXISTS "create_user_id" int4 DEFAULT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_project ADD COLUMN IF NOT EXISTS "code" bigint NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_command ADD COLUMN IF NOT EXISTS "process_instance_id" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_error_command ADD COLUMN IF NOT EXISTS "process_instance_id" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "process_definition_version" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "var_pool" text'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_definition_version" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "task_params" text'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_code" bigint DEFAULT -1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "environment_config" text'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "first_submit_time" timestamp DEFAULT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "delay_time" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "var_pool" text'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance ADD COLUMN IF NOT EXISTS "dry_run" int DEFAULT 0'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ADD COLUMN IF NOT EXISTS "timezone_id" varchar(40) DEFAULT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_schedules ADD COLUMN IF NOT EXISTS "environment_code" int DEFAULT -1'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "code" bigint'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_definition ADD COLUMN IF NOT EXISTS "warning_group_id" int'; ---drop columns EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_tenant DROP COLUMN IF EXISTS "tenant_name"'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "process_instance_json"'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "locations"'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "connects"'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_process_instance DROP COLUMN IF EXISTS "dependence_schedule_times"'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'.t_ds_task_instance DROP COLUMN IF EXISTS "task_json"'; -- add CONSTRAINT EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_alertgroup" ADD CONSTRAINT "t_ds_alertgroup_name_un" UNIQUE ("group_name")'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_datasource" ADD CONSTRAINT "t_ds_datasource_name_un" UNIQUE ("name","type")'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_command" ALTER COLUMN "process_definition_code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_instance" ALTER COLUMN "process_definition_code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_task_instance" ALTER COLUMN "task_code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_schedules" ALTER COLUMN "process_definition_code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ALTER COLUMN "code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ALTER COLUMN "project_code" SET NOT NULL'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ADD CONSTRAINT "process_unique" UNIQUE ("name","project_code")'; EXECUTE 'ALTER TABLE ' || quote_ident(v_schema) ||'."t_ds_process_definition" ALTER COLUMN "description" SET NOT NULL'; --- drop index EXECUTE 'DROP INDEX IF EXISTS "process_instance_index"'; EXECUTE 'DROP INDEX IF EXISTS "task_instance_index"'; --- create index EXECUTE 'CREATE INDEX IF NOT EXISTS priority_id_index ON ' || quote_ident(v_schema) ||'.t_ds_command USING Btree("process_instance_priority","id")'; EXECUTE 'CREATE INDEX IF NOT EXISTS process_instance_index ON ' || quote_ident(v_schema) ||'.t_ds_process_instance USING Btree("process_definition_code","id")'; ---add comment EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_user.state is ''state 0:disable 1:enable'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_alertgroup.alert_instance_ids is ''alert instance ids'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_alertgroup.create_user_id is ''create user id'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_project.code is ''coding'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_definition_code is ''process definition code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.environment_code is ''environment code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.dry_run is ''dry run flag:0 normal, 1 dry run'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_definition_version is ''process definition version'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_command.process_instance_id is ''process instance id'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_definition_code is ''process definition code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.environment_code is ''environment code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.dry_run is ''dry run flag:0 normal, 1 dry run'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_definition_version is ''process definition version'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_error_command.process_instance_id is ''process instance id'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.process_definition_code is ''process instance code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.process_definition_version is ''process instance version'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.environment_code is ''environment code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.var_pool is ''var pool'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_instance.dry_run is ''dry run flag:0 normal, 1 dry run'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_code is ''task definition code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_definition_version is ''task definition version'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.task_params is ''task params'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.environment_code is ''environment code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.environment_config is ''this config contains many environment variables config'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.first_submit_time is ''task first submit time'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.delay_time is ''task delay execution time'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.var_pool is ''var pool'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_task_instance.dry_run is ''dry run flag:0 normal, 1 dry run'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.process_definition_code is ''process definition code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.timezone_id is ''timezone id'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_schedules.environment_code is ''environment code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.code is ''encoding'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.project_code is ''project code'''; EXECUTE 'comment on column ' || quote_ident(v_schema) ||'.t_ds_process_definition.warning_group_id is ''alert group id'''; --create table EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_plugin_define" ( id serial NOT NULL, plugin_name varchar(100) NOT NULL, plugin_type varchar(100) NOT NULL, plugin_params text NULL, create_time timestamp NULL, update_time timestamp NULL, CONSTRAINT t_ds_plugin_define_pk PRIMARY KEY (id), CONSTRAINT t_ds_plugin_define_un UNIQUE (plugin_name, plugin_type) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_alert_plugin_instance" ( id serial NOT NULL, plugin_define_id int4 NOT NULL, plugin_instance_params text NULL, create_time timestamp NULL, update_time timestamp NULL, instance_name varchar(200) NULL, CONSTRAINT t_ds_alert_plugin_instance_pk PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_environment" ( id serial NOT NULL, code bigint NOT NULL, name varchar(100) DEFAULT NULL, config text DEFAULT NULL, description text, operator int DEFAULT NULL, create_time timestamp DEFAULT NULL, update_time timestamp DEFAULT NULL, PRIMARY KEY (id), CONSTRAINT environment_name_unique UNIQUE (name), CONSTRAINT environment_code_unique UNIQUE (code) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_environment_worker_group_relation" ( id serial NOT NULL, environment_code bigint NOT NULL, worker_group varchar(255) NOT NULL, operator int DEFAULT NULL, create_time timestamp DEFAULT NULL, update_time timestamp DEFAULT NULL, PRIMARY KEY (id) , CONSTRAINT environment_worker_group_unique UNIQUE (environment_code,worker_group) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_definition_log" ( id int NOT NULL , code bigint NOT NULL, name varchar(255) DEFAULT NULL , version int NOT NULL , description text , project_code bigint DEFAULT NULL , release_state int DEFAULT NULL , user_id int DEFAULT NULL , global_params text , locations text , warning_group_id int DEFAULT NULL , flag int DEFAULT NULL , timeout int DEFAULT 0 , tenant_id int DEFAULT -1 , execution_type int DEFAULT 0, operator int DEFAULT NULL , operate_time timestamp DEFAULT NULL , create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_task_definition" ( id serial NOT NULL , code bigint NOT NULL, name varchar(255) DEFAULT NULL , version int NOT NULL , description text , project_code bigint DEFAULT NULL , user_id int DEFAULT NULL , task_type varchar(50) DEFAULT NULL , task_params text , flag int DEFAULT NULL , task_priority int DEFAULT NULL , worker_group varchar(255) DEFAULT NULL , environment_code bigint DEFAULT -1, fail_retry_times int DEFAULT NULL , fail_retry_interval int DEFAULT NULL , timeout_flag int DEFAULT NULL , timeout_notify_strategy int DEFAULT NULL , timeout int DEFAULT 0 , delay_time int DEFAULT 0 , resource_ids text , create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_task_definition_log" ( id int NOT NULL , code bigint NOT NULL, name varchar(255) DEFAULT NULL , version int NOT NULL , description text , project_code bigint DEFAULT NULL , user_id int DEFAULT NULL , task_type varchar(50) DEFAULT NULL , task_params text , flag int DEFAULT NULL , task_priority int DEFAULT NULL , worker_group varchar(255) DEFAULT NULL , environment_code bigint DEFAULT -1, fail_retry_times int DEFAULT NULL , fail_retry_interval int DEFAULT NULL , timeout_flag int DEFAULT NULL , timeout_notify_strategy int DEFAULT NULL , timeout int DEFAULT 0 , delay_time int DEFAULT 0 , resource_ids text , operator int DEFAULT NULL , operate_time timestamp DEFAULT NULL , create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_task_relation" ( id serial NOT NULL , name varchar(255) DEFAULT NULL , project_code bigint DEFAULT NULL , process_definition_code bigint DEFAULT NULL , process_definition_version int DEFAULT NULL , pre_task_code bigint DEFAULT NULL , pre_task_version int DEFAULT 0 , post_task_code bigint DEFAULT NULL , post_task_version int DEFAULT 0 , condition_type int DEFAULT NULL , condition_params text , create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_process_task_relation_log" ( id int NOT NULL , name varchar(255) DEFAULT NULL , project_code bigint DEFAULT NULL , process_definition_code bigint DEFAULT NULL , process_definition_version int DEFAULT NULL , pre_task_code bigint DEFAULT NULL , pre_task_version int DEFAULT 0 , post_task_code bigint DEFAULT NULL , post_task_version int DEFAULT 0 , condition_type int DEFAULT NULL , condition_params text , operator int DEFAULT NULL , operate_time timestamp DEFAULT NULL , create_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL , PRIMARY KEY (id) )'; EXECUTE 'CREATE TABLE IF NOT EXISTS '|| quote_ident(v_schema) ||'."t_ds_worker_group" ( id serial NOT NULL, name varchar(255) NOT NULL, addr_list text DEFAULT NULL, create_time timestamp DEFAULT NULL, update_time timestamp DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY name_unique (name) )'; return 'Success!'; exception when others then ---Raise EXCEPTION '(%)',SQLERRM; return SQLERRM; END; $BODY$; select dolphin_update_metadata(); d//
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/constants.py
# 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. """Constants for pydolphinscheduler.""" class ProcessDefinitionReleaseState: """Constants for :class:`pydolphinscheduler.core.process_definition.ProcessDefinition` release state.""" ONLINE: str = "ONLINE" OFFLINE: str = "OFFLINE" class ProcessDefinitionDefault: """Constants default value for :class:`pydolphinscheduler.core.process_definition.ProcessDefinition`.""" PROJECT: str = "project-pydolphin" TENANT: str = "tenant_pydolphin" USER: str = "userPythonGateway" # TODO simple set password same as username USER_PWD: str = "userPythonGateway" USER_EMAIL: str = "userPythonGateway@dolphinscheduler.com" USER_PHONE: str = "11111111111" USER_STATE: int = 1 QUEUE: str = "queuePythonGateway" WORKER_GROUP: str = "default" TIME_ZONE: str = "Asia/Shanghai" class TaskPriority(str): """Constants for task priority.""" HIGHEST = "HIGHEST" HIGH = "HIGH" MEDIUM = "MEDIUM" LOW = "LOW" LOWEST = "LOWEST" class TaskFlag(str): """Constants for task flag.""" YES = "YES" NO = "NO" class TaskTimeoutFlag(str): """Constants for task timeout flag.""" CLOSE = "CLOSE" class TaskType(str): """Constants for task type, it will also show you which kind we support up to now.""" SHELL = "SHELL" HTTP = "HTTP" PYTHON = "PYTHON" SQL = "SQL" SUB_PROCESS = "SUB_PROCESS" class DefaultTaskCodeNum(str): """Constants and default value for default task code number.""" DEFAULT = 1 class JavaGatewayDefault(str): """Constants and default value for java gateway.""" RESULT_MESSAGE_KEYWORD = "msg" RESULT_MESSAGE_SUCCESS = "success" RESULT_STATUS_KEYWORD = "status" RESULT_STATUS_SUCCESS = "SUCCESS" RESULT_DATA = "data" class Delimiter(str): """Constants for delimiter.""" BAR = "-" DASH = "/" COLON = ":" UNDERSCORE = "_" class Time(str): """Constants for date.""" FMT_STD_DATE = "%Y-%m-%d" LEN_STD_DATE = 10 FMT_DASH_DATE = "%Y/%m/%d" FMT_SHORT_DATE = "%Y%m%d" LEN_SHORT_DATE = 8 FMT_STD_TIME = "%H:%M:%S" FMT_NO_COLON_TIME = "%H%M%S"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/database.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/procedure.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py
# 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. """Task sql.""" import re from typing import Dict, Optional from pydolphinscheduler.constants import TaskType from pydolphinscheduler.core.task import Task from pydolphinscheduler.java_gateway import launch_gateway class SqlType: """SQL type, for now it just contain `SELECT` and `NO_SELECT`.""" SELECT = 0 NOT_SELECT = 1 class Sql(Task): """Task SQL object, declare behavior for SQL task to dolphinscheduler. It should run sql job in multiply sql lik engine, such as: - ClickHouse - DB2 - HIVE - MySQL - Oracle - Postgresql - Presto - SQLServer You provider datasource_name contain connection information, it decisions which database type and database instance would run this sql. """ _task_custom_attr = { "sql", "sql_type", "pre_statements", "post_statements", "display_rows", } def __init__( self, name: str, datasource_name: str, sql: str, pre_statements: Optional[str] = None, post_statements: Optional[str] = None, display_rows: Optional[int] = 10, *args, **kwargs ): super().__init__(name, TaskType.SQL, *args, **kwargs) self.datasource_name = datasource_name self.sql = sql self.pre_statements = pre_statements or [] self.post_statements = post_statements or [] self.display_rows = display_rows self._datasource = {} def get_datasource_type(self) -> str: """Get datasource type from java gateway, a wrapper for :func:`get_datasource_info`.""" return self.get_datasource_info(self.datasource_name).get("type") def get_datasource_id(self) -> str: """Get datasource id from java gateway, a wrapper for :func:`get_datasource_info`.""" return self.get_datasource_info(self.datasource_name).get("id") def get_datasource_info(self, name) -> Dict: """Get datasource info from java gateway, contains datasource id, type, name.""" if self._datasource: return self._datasource else: gateway = launch_gateway() self._datasource = gateway.entry_point.getDatasourceInfo(name) return self._datasource @property def sql_type(self) -> int: """Judgement sql type, use regexp to check which type of the sql is.""" pattern_select_str = ( "^(?!(.* |)insert |(.* |)delete |(.* |)drop |(.* |)update |(.* |)alter ).*" ) pattern_select = re.compile(pattern_select_str, re.IGNORECASE) if pattern_select.match(self.sql) is None: return SqlType.NOT_SELECT else: return SqlType.SELECT @property def task_params(self, camel_attr: bool = True, custom_attr: set = None) -> Dict: """Override Task.task_params for sql task. Sql task have some specials attribute for task_params, and is odd if we directly set as python property, so we Override Task.task_params here. """ params = super().task_params custom_params = { "type": self.get_datasource_type(), "datasource": self.get_datasource_id(), } params.update(custom_params) return params
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_database.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_procedure.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,929
[Feature][Python] Add workflow as code task type procedure
### 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 Add python api task type procedure. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6929
https://github.com/apache/dolphinscheduler/pull/7279
12b46dfaa62f8f6c51ea739e0d31ca934c811994
1948030151173c72c81c45346e37bba6dc35d44b
"2021-11-19T07:08:12Z"
java
"2021-12-13T11:54:24Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_sql.py
# 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. """Test Task Sql.""" from unittest.mock import patch import pytest from pydolphinscheduler.tasks.sql import Sql, SqlType @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.sql.Sql.get_datasource_info", return_value=({"id": 1, "type": "mock_type"}), ) def test_get_datasource_detail(mock_datasource, mock_code_version): """Test :func:`get_datasource_type` and :func:`get_datasource_id` can return expect value.""" name = "test_get_sql_type" datasource_name = "test_datasource" sql = "select 1" task = Sql(name, datasource_name, sql) assert 1 == task.get_datasource_id() assert "mock_type" == task.get_datasource_type() @pytest.mark.parametrize( "sql, sql_type", [ ("select 1", SqlType.SELECT), (" select 1", SqlType.SELECT), (" select 1 ", SqlType.SELECT), (" select 'insert' ", SqlType.SELECT), (" select 'insert ' ", SqlType.SELECT), ("with tmp as (select 1) select * from tmp ", SqlType.SELECT), ("insert into table_name(col1, col2) value (val1, val2)", SqlType.NOT_SELECT), ( "insert into table_name(select, col2) value ('select', val2)", SqlType.NOT_SELECT, ), ("update table_name SET col1=val1 where col1=val2", SqlType.NOT_SELECT), ("update table_name SET col1='select' where col1=val2", SqlType.NOT_SELECT), ("delete from table_name where id < 10", SqlType.NOT_SELECT), ("delete from table_name where id < 10", SqlType.NOT_SELECT), ("alter table table_name add column col1 int", SqlType.NOT_SELECT), ], ) @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.sql.Sql.get_datasource_info", return_value=({"id": 1, "type": "mock_type"}), ) def test_get_sql_type(mock_datasource, mock_code_version, sql, sql_type): """Test property sql_type could return correct type.""" name = "test_get_sql_type" datasource_name = "test_datasource" task = Sql(name, datasource_name, sql) assert ( sql_type == task.sql_type ), f"Sql {sql} expect sql type is {sql_type} but got {task.sql_type}" @pytest.mark.parametrize( "attr, expect", [ ( {"datasource_name": "datasource_name", "sql": "select 1"}, { "sql": "select 1", "type": "MYSQL", "datasource": 1, "sqlType": SqlType.SELECT, "preStatements": [], "postStatements": [], "displayRows": 10, "localParams": [], "resourceList": [], "dependence": {}, "waitStartTimeout": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, }, ) ], ) @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.sql.Sql.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_property_task_params(mock_datasource, mock_code_version, attr, expect): """Test task sql task property.""" task = Sql("test-sql-task-params", **attr) assert expect == task.task_params @patch( "pydolphinscheduler.tasks.sql.Sql.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_sql_get_define(mock_datasource): """Test task sql function get_define.""" code = 123 version = 1 name = "test_sql_dict" command = "select 1" datasource_name = "test_datasource" expect = { "code": code, "name": name, "version": 1, "description": None, "delayTime": 0, "taskType": "SQL", "taskParams": { "type": "MYSQL", "datasource": 1, "sql": command, "sqlType": SqlType.SELECT, "displayRows": 10, "preStatements": [], "postStatements": [], "localParams": [], "resourceList": [], "dependence": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, "waitStartTimeout": {}, }, "flag": "YES", "taskPriority": "MEDIUM", "workerGroup": "default", "failRetryTimes": 0, "failRetryInterval": 1, "timeoutFlag": "CLOSE", "timeoutNotifyStrategy": None, "timeout": 0, } with patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(code, version), ): task = Sql(name, datasource_name, command) assert task.get_define() == expect
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,319
[Bug] [MasterServer] NPE when switch else branch is empty
### 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 ``` java.lang.NullPointerException: null at org.apache.dolphinscheduler.dao.utils.DagHelper.isTaskNodeNeedSkip(DagHelper.java:335) ~[classes/:na] at org.apache.dolphinscheduler.dao.utils.DagHelper.parsePostNodes(DagHelper.java:313) ~[classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.submitPostNode(WorkflowExecuteThread.java:860) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.taskFinished(WorkflowExecuteThread.java:395) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.taskStateChangeHandler(WorkflowExecuteThread.java:350) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.stateEventHandler(WorkflowExecuteThread.java:300) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.handleEvents(WorkflowExecuteThread.java:248) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.run(WorkflowExecuteThread.java:229) [classes/:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_212] at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125) [guava-24.1-jre.jar:na] at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57) [guava-24.1-jre.jar:na] at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78) [guava-24.1-jre.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_212] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] ``` ### What you expected to happen no error happen. ### How to reproduce ![656a63e9ab9aad3975069b6a59e2f90](https://user-images.githubusercontent.com/11962619/145537311-15f41afd-1181-4159-87a5-795591ee5831.png) ### Anything else _No response_ ### Version 2.0.0 ### 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/7319
https://github.com/apache/dolphinscheduler/pull/7320
8c3fa4790346204647ad2737239e87c34669b021
99b8ec649213270df91b5a2808a26868c675a0d3
"2021-12-10T07:52:22Z"
java
"2021-12-13T14:46:48Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.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.dao.utils; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.task.conditions.ConditionsParameters; import org.apache.dolphinscheduler.common.task.switchtask.SwitchParameters; import org.apache.dolphinscheduler.common.task.switchtask.SwitchResultVo; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * dag tools */ public class DagHelper { private static final Logger logger = LoggerFactory.getLogger(DagHelper.class); /** * generate flow node relation list by task node list; * Edges that are not in the task Node List will not be added to the result * * @param taskNodeList taskNodeList * @return task node relation list */ public static List<TaskNodeRelation> generateRelationListByFlowNodes(List<TaskNode> taskNodeList) { List<TaskNodeRelation> nodeRelationList = new ArrayList<>(); for (TaskNode taskNode : taskNodeList) { String preTasks = taskNode.getPreTasks(); List<String> preTaskList = JSONUtils.toList(preTasks, String.class); if (preTaskList != null) { for (String depNodeCode : preTaskList) { if (null != findNodeByCode(taskNodeList, depNodeCode)) { nodeRelationList.add(new TaskNodeRelation(depNodeCode, Long.toString(taskNode.getCode()))); } } } } return nodeRelationList; } /** * generate task nodes needed by dag * * @param taskNodeList taskNodeList * @param startNodeNameList startNodeNameList * @param recoveryNodeCodeList recoveryNodeCodeList * @param taskDependType taskDependType * @return task node list */ public static List<TaskNode> generateFlowNodeListByStartNode(List<TaskNode> taskNodeList, List<String> startNodeNameList, List<String> recoveryNodeCodeList, TaskDependType taskDependType) { List<TaskNode> destFlowNodeList = new ArrayList<>(); List<String> startNodeList = startNodeNameList; if (taskDependType != TaskDependType.TASK_POST && CollectionUtils.isEmpty(startNodeList)) { logger.error("start node list is empty! cannot continue run the process "); return destFlowNodeList; } List<TaskNode> destTaskNodeList = new ArrayList<>(); List<TaskNode> tmpTaskNodeList = new ArrayList<>(); if (taskDependType == TaskDependType.TASK_POST && CollectionUtils.isNotEmpty(recoveryNodeCodeList)) { startNodeList = recoveryNodeCodeList; } if (CollectionUtils.isEmpty(startNodeList)) { // no special designation start nodes tmpTaskNodeList = taskNodeList; } else { // specified start nodes or resume execution for (String startNodeCode : startNodeList) { TaskNode startNode = findNodeByCode(taskNodeList, startNodeCode); List<TaskNode> childNodeList = new ArrayList<>(); if (startNode == null) { logger.error("start node name [{}] is not in task node list [{}] ", startNodeCode, taskNodeList ); continue; } else if (TaskDependType.TASK_POST == taskDependType) { List<String> visitedNodeCodeList = new ArrayList<>(); childNodeList = getFlowNodeListPost(startNode, taskNodeList, visitedNodeCodeList); } else if (TaskDependType.TASK_PRE == taskDependType) { List<String> visitedNodeCodeList = new ArrayList<>(); childNodeList = getFlowNodeListPre(startNode, recoveryNodeCodeList, taskNodeList, visitedNodeCodeList); } else { childNodeList.add(startNode); } tmpTaskNodeList.addAll(childNodeList); } } for (TaskNode taskNode : tmpTaskNodeList) { if (null == findNodeByCode(destTaskNodeList, Long.toString(taskNode.getCode()))) { destTaskNodeList.add(taskNode); } } return destTaskNodeList; } /** * find all the nodes that depended on the start node * * @param startNode startNode * @param taskNodeList taskNodeList * @return task node list */ private static List<TaskNode> getFlowNodeListPost(TaskNode startNode, List<TaskNode> taskNodeList, List<String> visitedNodeCodeList) { List<TaskNode> resultList = new ArrayList<>(); for (TaskNode taskNode : taskNodeList) { List<String> depList = taskNode.getDepList(); if (null != depList && null != startNode && depList.contains(Long.toString(startNode.getCode())) && !visitedNodeCodeList.contains(Long.toString(taskNode.getCode()))) { resultList.addAll(getFlowNodeListPost(taskNode, taskNodeList, visitedNodeCodeList)); } } // why add (startNode != null) condition? for SonarCloud Quality Gate passed if (null != startNode) { visitedNodeCodeList.add(Long.toString(startNode.getCode())); } resultList.add(startNode); return resultList; } /** * find all nodes that start nodes depend on. * * @param startNode startNode * @param recoveryNodeCodeList recoveryNodeCodeList * @param taskNodeList taskNodeList * @return task node list */ private static List<TaskNode> getFlowNodeListPre(TaskNode startNode, List<String> recoveryNodeCodeList, List<TaskNode> taskNodeList, List<String> visitedNodeCodeList) { List<TaskNode> resultList = new ArrayList<>(); List<String> depList = new ArrayList<>(); if (null != startNode) { depList = startNode.getDepList(); resultList.add(startNode); } if (CollectionUtils.isEmpty(depList)) { return resultList; } for (String depNodeCode : depList) { TaskNode start = findNodeByCode(taskNodeList, depNodeCode); if (recoveryNodeCodeList.contains(depNodeCode)) { resultList.add(start); } else if (!visitedNodeCodeList.contains(depNodeCode)) { resultList.addAll(getFlowNodeListPre(start, recoveryNodeCodeList, taskNodeList, visitedNodeCodeList)); } } // why add (startNode != null) condition? for SonarCloud Quality Gate passed if (null != startNode) { visitedNodeCodeList.add(Long.toString(startNode.getCode())); } return resultList; } /** * generate dag by start nodes and recovery nodes * * @param totalTaskNodeList totalTaskNodeList * @param startNodeNameList startNodeNameList * @param recoveryNodeCodeList recoveryNodeCodeList * @param depNodeType depNodeType * @return process dag * @throws Exception if error throws Exception */ public static ProcessDag generateFlowDag(List<TaskNode> totalTaskNodeList, List<String> startNodeNameList, List<String> recoveryNodeCodeList, TaskDependType depNodeType) throws Exception { List<TaskNode> destTaskNodeList = generateFlowNodeListByStartNode(totalTaskNodeList, startNodeNameList, recoveryNodeCodeList, depNodeType); if (destTaskNodeList.isEmpty()) { return null; } List<TaskNodeRelation> taskNodeRelations = generateRelationListByFlowNodes(destTaskNodeList); ProcessDag processDag = new ProcessDag(); processDag.setEdges(taskNodeRelations); processDag.setNodes(destTaskNodeList); return processDag; } /** * find node by node name * * @param nodeDetails nodeDetails * @param nodeName nodeName * @return task node */ public static TaskNode findNodeByName(List<TaskNode> nodeDetails, String nodeName) { for (TaskNode taskNode : nodeDetails) { if (taskNode.getName().equals(nodeName)) { return taskNode; } } return null; } /** * find node by node code * * @param nodeDetails nodeDetails * @param nodeCode nodeCode * @return task node */ public static TaskNode findNodeByCode(List<TaskNode> nodeDetails, String nodeCode) { for (TaskNode taskNode : nodeDetails) { if (Long.toString(taskNode.getCode()).equals(nodeCode)) { return taskNode; } } return null; } /** * the task can be submit when all the depends nodes are forbidden or complete * * @param taskNode taskNode * @param dag dag * @param completeTaskList completeTaskList * @return can submit */ public static boolean allDependsForbiddenOrEnd(TaskNode taskNode, DAG<String, TaskNode, TaskNodeRelation> dag, Map<String, TaskNode> skipTaskNodeList, Map<String, TaskInstance> completeTaskList) { List<String> dependList = taskNode.getDepList(); if (dependList == null) { return true; } for (String dependNodeCode : dependList) { TaskNode dependNode = dag.getNode(dependNodeCode); if (dependNode == null || completeTaskList.containsKey(dependNodeCode) || dependNode.isForbidden() || skipTaskNodeList.containsKey(dependNodeCode)) { continue; } else { return false; } } return true; } /** * parse the successor nodes of previous node. * this function parse the condition node to find the right branch. * also check all the depends nodes forbidden or complete * * @return successor nodes */ public static Set<String> parsePostNodes(String preNodeCode, Map<String, TaskNode> skipTaskNodeList, DAG<String, TaskNode, TaskNodeRelation> dag, Map<String, TaskInstance> completeTaskList) { Set<String> postNodeList = new HashSet<>(); Collection<String> startVertexes = new ArrayList<>(); if (preNodeCode == null) { startVertexes = dag.getBeginNode(); } else if (dag.getNode(preNodeCode).isConditionsTask()) { List<String> conditionTaskList = parseConditionTask(preNodeCode, skipTaskNodeList, dag, completeTaskList); startVertexes.addAll(conditionTaskList); } else if (dag.getNode(preNodeCode).isSwitchTask()) { List<String> conditionTaskList = parseSwitchTask(preNodeCode, skipTaskNodeList, dag, completeTaskList); startVertexes.addAll(conditionTaskList); } else { startVertexes = dag.getSubsequentNodes(preNodeCode); } for (String subsequent : startVertexes) { TaskNode taskNode = dag.getNode(subsequent); if (isTaskNodeNeedSkip(taskNode, skipTaskNodeList)) { setTaskNodeSkip(subsequent, dag, completeTaskList, skipTaskNodeList); continue; } if (!DagHelper.allDependsForbiddenOrEnd(taskNode, dag, skipTaskNodeList, completeTaskList)) { continue; } if (taskNode.isForbidden() || completeTaskList.containsKey(subsequent)) { postNodeList.addAll(parsePostNodes(subsequent, skipTaskNodeList, dag, completeTaskList)); continue; } postNodeList.add(subsequent); } return postNodeList; } /** * if all of the task dependence are skipped, skip it too. */ private static boolean isTaskNodeNeedSkip(TaskNode taskNode, Map<String, TaskNode> skipTaskNodeList ) { if (CollectionUtils.isEmpty(taskNode.getDepList())) { return false; } for (String depNode : taskNode.getDepList()) { if (!skipTaskNodeList.containsKey(depNode)) { return false; } } return true; } /** * parse condition task find the branch process * set skip flag for another one. */ public static List<String> parseConditionTask(String nodeCode, Map<String, TaskNode> skipTaskNodeList, DAG<String, TaskNode, TaskNodeRelation> dag, Map<String, TaskInstance> completeTaskList) { List<String> conditionTaskList = new ArrayList<>(); TaskNode taskNode = dag.getNode(nodeCode); if (!taskNode.isConditionsTask()) { return conditionTaskList; } if (!completeTaskList.containsKey(nodeCode)) { return conditionTaskList; } TaskInstance taskInstance = completeTaskList.get(nodeCode); ConditionsParameters conditionsParameters = JSONUtils.parseObject(taskNode.getConditionResult(), ConditionsParameters.class); List<String> skipNodeList = new ArrayList<>(); if (taskInstance.getState().typeIsSuccess()) { conditionTaskList = conditionsParameters.getSuccessNode(); skipNodeList = conditionsParameters.getFailedNode(); } else if (taskInstance.getState().typeIsFailure()) { conditionTaskList = conditionsParameters.getFailedNode(); skipNodeList = conditionsParameters.getSuccessNode(); } else { conditionTaskList.add(nodeCode); } for (String failedNode : skipNodeList) { setTaskNodeSkip(failedNode, dag, completeTaskList, skipTaskNodeList); } return conditionTaskList; } /** * parse condition task find the branch process * set skip flag for another one. * * @param nodeCode * @return */ public static List<String> parseSwitchTask(String nodeCode, Map<String, TaskNode> skipTaskNodeList, DAG<String, TaskNode, TaskNodeRelation> dag, Map<String, TaskInstance> completeTaskList) { List<String> conditionTaskList = new ArrayList<>(); TaskNode taskNode = dag.getNode(nodeCode); if (!taskNode.isSwitchTask()) { return conditionTaskList; } if (!completeTaskList.containsKey(nodeCode)) { return conditionTaskList; } conditionTaskList = skipTaskNode4Switch(taskNode, skipTaskNodeList, completeTaskList, dag); return conditionTaskList; } private static List<String> skipTaskNode4Switch(TaskNode taskNode, Map<String, TaskNode> skipTaskNodeList, Map<String, TaskInstance> completeTaskList, DAG<String, TaskNode, TaskNodeRelation> dag) { SwitchParameters switchParameters = completeTaskList.get(Long.toString(taskNode.getCode())).getSwitchDependency(); int resultConditionLocation = switchParameters.getResultConditionLocation(); List<SwitchResultVo> conditionResultVoList = switchParameters.getDependTaskList(); List<String> switchTaskList = conditionResultVoList.get(resultConditionLocation).getNextNode(); if (CollectionUtils.isEmpty(switchTaskList)) { switchTaskList = new ArrayList<>(); } conditionResultVoList.remove(resultConditionLocation); for (SwitchResultVo info : conditionResultVoList) { if (CollectionUtils.isEmpty(info.getNextNode())) { continue; } setTaskNodeSkip(info.getNextNode().get(0), dag, completeTaskList, skipTaskNodeList); } return switchTaskList; } /** * set task node and the post nodes skip flag */ private static void setTaskNodeSkip(String skipNodeCode, DAG<String, TaskNode, TaskNodeRelation> dag, Map<String, TaskInstance> completeTaskList, Map<String, TaskNode> skipTaskNodeList) { if (!dag.containsNode(skipNodeCode)) { return; } skipTaskNodeList.putIfAbsent(skipNodeCode, dag.getNode(skipNodeCode)); Collection<String> postNodeList = dag.getSubsequentNodes(skipNodeCode); for (String post : postNodeList) { TaskNode postNode = dag.getNode(post); if (isTaskNodeNeedSkip(postNode, skipTaskNodeList)) { setTaskNodeSkip(post, dag, completeTaskList, skipTaskNodeList); } } } /*** * build dag graph * @param processDag processDag * @return dag */ public static DAG<String, TaskNode, TaskNodeRelation> buildDagGraph(ProcessDag processDag) { DAG<String, TaskNode, TaskNodeRelation> dag = new DAG<>(); //add vertex if (CollectionUtils.isNotEmpty(processDag.getNodes())) { for (TaskNode node : processDag.getNodes()) { dag.addNode(Long.toString(node.getCode()), node); } } //add edge if (CollectionUtils.isNotEmpty(processDag.getEdges())) { for (TaskNodeRelation edge : processDag.getEdges()) { dag.addEdge(edge.getStartNode(), edge.getEndNode()); } } return dag; } /** * get process dag * * @param taskNodeList task node list * @return Process dag */ public static ProcessDag getProcessDag(List<TaskNode> taskNodeList) { List<TaskNodeRelation> taskNodeRelations = new ArrayList<>(); // Traverse node information and build relationships for (TaskNode taskNode : taskNodeList) { String preTasks = taskNode.getPreTasks(); List<String> preTasksList = JSONUtils.toList(preTasks, String.class); // If the dependency is not empty if (preTasksList != null) { for (String depNode : preTasksList) { taskNodeRelations.add(new TaskNodeRelation(depNode, Long.toString(taskNode.getCode()))); } } } ProcessDag processDag = new ProcessDag(); processDag.setEdges(taskNodeRelations); processDag.setNodes(taskNodeList); return processDag; } /** * get process dag * * @param taskNodeList task node list * @return Process dag */ public static ProcessDag getProcessDag(List<TaskNode> taskNodeList, List<ProcessTaskRelation> processTaskRelations) { Map<Long, TaskNode> taskNodeMap = new HashMap<>(); taskNodeList.forEach(taskNode -> { taskNodeMap.putIfAbsent(taskNode.getCode(), taskNode); }); List<TaskNodeRelation> taskNodeRelations = new ArrayList<>(); for (ProcessTaskRelation processTaskRelation : processTaskRelations) { long preTaskCode = processTaskRelation.getPreTaskCode(); long postTaskCode = processTaskRelation.getPostTaskCode(); if (processTaskRelation.getPreTaskCode() != 0 && taskNodeMap.containsKey(preTaskCode) && taskNodeMap.containsKey(postTaskCode)) { TaskNode preNode = taskNodeMap.get(preTaskCode); TaskNode postNode = taskNodeMap.get(postTaskCode); taskNodeRelations.add(new TaskNodeRelation(Long.toString(preNode.getCode()), Long.toString(postNode.getCode()))); } } ProcessDag processDag = new ProcessDag(); processDag.setEdges(taskNodeRelations); processDag.setNodes(taskNodeList); return processDag; } /** * is there have conditions after the parent node */ public static boolean haveConditionsAfterNode(String parentNodeCode, DAG<String, TaskNode, TaskNodeRelation> dag ) { boolean result = false; Set<String> subsequentNodes = dag.getSubsequentNodes(parentNodeCode); if (CollectionUtils.isEmpty(subsequentNodes)) { return result; } for (String nodeCode : subsequentNodes) { TaskNode taskNode = dag.getNode(nodeCode); List<String> preTasksList = JSONUtils.toList(taskNode.getPreTasks(), String.class); if (preTasksList.contains(parentNodeCode) && taskNode.isConditionsTask()) { return true; } } return result; } /** * is there have conditions after the parent node */ public static boolean haveConditionsAfterNode(String parentNodeCode, List<TaskNode> taskNodes) { if (CollectionUtils.isEmpty(taskNodes)) { return false; } for (TaskNode taskNode : taskNodes) { List<String> preTasksList = JSONUtils.toList(taskNode.getPreTasks(), String.class); if (preTasksList.contains(parentNodeCode) && taskNode.isConditionsTask()) { return true; } } return false; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,319
[Bug] [MasterServer] NPE when switch else branch is empty
### 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 ``` java.lang.NullPointerException: null at org.apache.dolphinscheduler.dao.utils.DagHelper.isTaskNodeNeedSkip(DagHelper.java:335) ~[classes/:na] at org.apache.dolphinscheduler.dao.utils.DagHelper.parsePostNodes(DagHelper.java:313) ~[classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.submitPostNode(WorkflowExecuteThread.java:860) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.taskFinished(WorkflowExecuteThread.java:395) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.taskStateChangeHandler(WorkflowExecuteThread.java:350) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.stateEventHandler(WorkflowExecuteThread.java:300) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.handleEvents(WorkflowExecuteThread.java:248) [classes/:na] at org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThread.run(WorkflowExecuteThread.java:229) [classes/:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_212] at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125) [guava-24.1-jre.jar:na] at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57) [guava-24.1-jre.jar:na] at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78) [guava-24.1-jre.jar:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_212] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_212] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] ``` ### What you expected to happen no error happen. ### How to reproduce ![656a63e9ab9aad3975069b6a59e2f90](https://user-images.githubusercontent.com/11962619/145537311-15f41afd-1181-4159-87a5-795591ee5831.png) ### Anything else _No response_ ### Version 2.0.0 ### 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/7319
https://github.com/apache/dolphinscheduler/pull/7320
8c3fa4790346204647ad2737239e87c34669b021
99b8ec649213270df91b5a2808a26868c675a0d3
"2021-12-10T07:52:22Z"
java
"2021-12-13T14:46:48Z"
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/SwitchTaskProcessor.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.server.master.runner.task; import org.apache.dolphinscheduler.common.enums.DependResult; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.task.switchtask.SwitchParameters; import org.apache.dolphinscheduler.common.task.switchtask.SwitchResultVo; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.utils.LogUtils; import org.apache.dolphinscheduler.server.utils.SwitchTaskUtils; import org.apache.commons.lang.StringUtils; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class SwitchTaskProcessor extends BaseTaskProcessor { protected final String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*"; private TaskInstance taskInstance; private ProcessInstance processInstance; TaskDefinition taskDefinition; @Autowired private MasterConfig masterConfig; /** * switch result */ private DependResult conditionResult; @Override public boolean submit(TaskInstance taskInstance, ProcessInstance processInstance, int masterTaskCommitRetryTimes, int masterTaskCommitInterval) { this.processInstance = processInstance; this.taskInstance = processService.submitTaskWithRetry(processInstance, taskInstance, masterTaskCommitRetryTimes, masterTaskCommitInterval); if (this.taskInstance == null) { return false; } taskDefinition = processService.findTaskDefinition( taskInstance.getTaskCode(), taskInstance.getTaskDefinitionVersion() ); taskInstance.setLogPath(LogUtils.getTaskLogPath(taskInstance.getFirstSubmitTime(),processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion(), taskInstance.getProcessInstanceId(), taskInstance.getId())); setTaskExecutionLogger(); taskInstance.setHost(NetUtils.getAddr(masterConfig.getListenPort())); taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION); taskInstance.setStartTime(new Date()); processService.updateTaskInstance(taskInstance); return true; } @Override public void run() { try { if (!this.taskState().typeIsFinished() && setSwitchResult()) { endTaskState(); } } catch (Exception e) { logger.error("update work flow {} switch task {} state error:", this.processInstance.getId(), this.taskInstance.getId(), e); } } @Override protected boolean pauseTask() { this.taskInstance.setState(ExecutionStatus.PAUSE); this.taskInstance.setEndTime(new Date()); processService.saveTaskInstance(taskInstance); return true; } @Override protected boolean killTask() { this.taskInstance.setState(ExecutionStatus.KILL); this.taskInstance.setEndTime(new Date()); processService.saveTaskInstance(taskInstance); return true; } @Override protected boolean taskTimeout() { return true; } @Override public String getType() { return TaskType.SWITCH.getDesc(); } @Override public ExecutionStatus taskState() { return this.taskInstance.getState(); } private boolean setSwitchResult() { List<TaskInstance> taskInstances = processService.findValidTaskListByProcessId( taskInstance.getProcessInstanceId() ); Map<String, ExecutionStatus> completeTaskList = new HashMap<>(); for (TaskInstance task : taskInstances) { completeTaskList.putIfAbsent(task.getName(), task.getState()); } SwitchParameters switchParameters = taskInstance.getSwitchDependency(); List<SwitchResultVo> switchResultVos = switchParameters.getDependTaskList(); SwitchResultVo switchResultVo = new SwitchResultVo(); switchResultVo.setNextNode(switchParameters.getNextNode()); switchResultVos.add(switchResultVo); int finalConditionLocation = switchResultVos.size() - 1; int i = 0; conditionResult = DependResult.SUCCESS; for (SwitchResultVo info : switchResultVos) { logger.info("the {} execution ", (i + 1)); logger.info("original condition sentence:{}", info.getCondition()); if (StringUtils.isEmpty(info.getCondition())) { finalConditionLocation = i; break; } String content = setTaskParams(info.getCondition().replaceAll("'", "\""), rgex); logger.info("format condition sentence::{}", content); Boolean result = null; try { result = SwitchTaskUtils.evaluate(content); } catch (Exception e) { logger.info("error sentence : {}", content); conditionResult = DependResult.FAILED; break; } logger.info("condition result : {}", result); if (result) { finalConditionLocation = i; break; } i++; } switchParameters.setDependTaskList(switchResultVos); switchParameters.setResultConditionLocation(finalConditionLocation); taskInstance.setSwitchDependency(switchParameters); logger.info("the switch task depend result : {}", conditionResult); return true; } /** * update task state */ private void endTaskState() { ExecutionStatus status = (conditionResult == DependResult.SUCCESS) ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE; taskInstance.setEndTime(new Date()); taskInstance.setState(status); processService.updateTaskInstance(taskInstance); } public String setTaskParams(String content, String rgex) { Pattern pattern = Pattern.compile(rgex); Matcher m = pattern.matcher(content); Map<String, Property> globalParams = JSONUtils .toList(processInstance.getGlobalParams(), Property.class) .stream() .collect(Collectors.toMap(Property::getProp, Property -> Property)); Map<String, Property> varParams = JSONUtils .toList(taskInstance.getVarPool(), Property.class) .stream() .collect(Collectors.toMap(Property::getProp, Property -> Property)); if (varParams.size() > 0) { varParams.putAll(globalParams); globalParams = varParams; } while (m.find()) { String paramName = m.group(1); Property property = globalParams.get(paramName); if (property == null) { return ""; } String value = property.getValue(); if (!org.apache.commons.lang.math.NumberUtils.isNumber(value)) { value = "\"" + value + "\""; } logger.info("paramName:{},paramValue:{}", paramName, value); content = content.replace("${" + paramName + "}", value); } return content; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.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.api.controller; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ALERT_PLUGIN_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ALERT_PLUGIN_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.GET_ALERT_PLUGIN_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ALERT_PLUGIN_INSTANCE_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.AlertPluginInstanceService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; /** * alert plugin instance controller */ @Api(tags = "ALERT_PLUGIN_INSTANCE_TAG") @RestController @RequestMapping("alert-plugin-instances") public class AlertPluginInstanceController extends BaseController { private static final Logger logger = LoggerFactory.getLogger(AlertPluginInstanceController.class); @Autowired private AlertPluginInstanceService alertPluginInstanceService; /** * create alert plugin instance * * @param loginUser login user * @param pluginDefineId alert plugin define id * @param instanceName instance name * @param pluginInstanceParams instance params * @return result */ @ApiOperation(value = "createAlertPluginInstance", notes = "CREATE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "pluginDefineId", value = "ALERT_PLUGIN_DEFINE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result createAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "pluginDefineId") int pluginDefineId, @RequestParam(value = "instanceName") String instanceName, @RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) { Map<String, Object> result = alertPluginInstanceService.create(loginUser, pluginDefineId, instanceName, pluginInstanceParams); return returnDataList(result); } /** * updateAlertPluginInstance * * @param loginUser login user * @param id alert plugin instance id * @param instanceName instance name * @param pluginInstanceParams instance params * @return result */ @ApiOperation(value = "updateAlertPluginInstance", notes = "UPDATE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "alertPluginInstanceId", value = "ALERT_PLUGIN_INSTANCE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id, @RequestParam(value = "instanceName") String instanceName, @RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) { Map<String, Object> result = alertPluginInstanceService.update(loginUser, id, instanceName, pluginInstanceParams); return returnDataList(result); } /** * deleteAlertPluginInstance * * @param loginUser login user * @param id id * @return result */ @ApiOperation(value = "deleteAlertPluginInstance", notes = "DELETE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") }) @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id) { Map<String, Object> result = alertPluginInstanceService.delete(loginUser, id); return returnDataList(result); } /** * getAlertPluginInstance * * @param loginUser login user * @param id alert plugin instance id * @return result */ @ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES") @GetMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id) { Map<String, Object> result = alertPluginInstanceService.get(loginUser, id); return returnDataList(result); } /** * getAlertPluginInstance * * @param loginUser login user * @return result */ @ApiOperation(value = "queryAlertPluginInstanceList", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES") @GetMapping(value = "/list") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { Map<String, Object> result = alertPluginInstanceService.queryAll(); return returnDataList(result); } /** * check alert group exist * * @param loginUser login user * @param alertInstanceName alert instance name * @return check result code */ @ApiOperation(value = "verifyAlertInstanceName", notes = "VERIFY_ALERT_INSTANCE_NAME_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), }) @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "alertInstanceName") String alertInstanceName) { boolean exist = alertPluginInstanceService.checkExistPluginInstanceName(alertInstanceName); Result result = new Result(); if (exist) { logger.error("alert plugin instance {} has exist, can't create again.", alertInstanceName); result.setCode(Status.PLUGIN_INSTANCE_ALREADY_EXIT.getCode()); result.setMsg(Status.PLUGIN_INSTANCE_ALREADY_EXIT.getMsg()); } else { result.setCode(Status.SUCCESS.getCode()); result.setMsg(Status.SUCCESS.getMsg()); } return result; } /** * paging query alert plugin instance group list * * @param loginUser login user * @param pageNo page number * @param pageSize page size * @return alert plugin instance list page */ @ApiOperation(value = "queryAlertPluginInstanceListPaging", notes = "QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result listPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) { Result result = checkPageParams(pageNo, pageSize); if (!result.checkResult()) { return result; } return alertPluginInstanceService.queryPluginPage(pageNo, pageSize); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AlertPluginInstanceService.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.api.service; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * alert plugin instance service */ public interface AlertPluginInstanceService { /** * creat alert plugin instance * * @param loginUser login user * @param pluginDefineId plugin define id * @param instanceName instance name * @param pluginInstanceParams plugin instance params * @return result */ Map<String, Object> create(User loginUser,int pluginDefineId,String instanceName,String pluginInstanceParams); /** * update * @param loginUser login user * @param alertPluginInstanceId plugin instance id * @param instanceName instance name * @param pluginInstanceParams plugin instance params * @return result */ Map<String, Object> update(User loginUser, int alertPluginInstanceId,String instanceName,String pluginInstanceParams); /** * delete alert plugin instance * * @param loginUser login user * @param id id * @return result */ Map<String, Object> delete(User loginUser, int id); /** * get alert plugin instance * * @param loginUser login user * @param id get id * @return alert plugin */ Map<String, Object> get(User loginUser, int id); /** * queryAll * * @return alert plugins */ Map<String, Object> queryAll(); /** * checkExistPluginInstanceName * @param pluginName plugin name * @return isExist */ boolean checkExistPluginInstanceName(String pluginName); /** * queryPluginPage * @param pageIndex page index * @param pageSize page size * @return plugins */ Result queryPluginPage(int pageIndex, int pageSize); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.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.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.AlertPluginInstanceService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.api.vo.AlertPluginInstanceVO; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.dao.entity.PluginDefine; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper; import org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.PluginDefineMapper; import org.apache.dolphinscheduler.spi.params.PluginParamsTransfer; import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * alert plugin instance service impl */ @Service @Lazy public class AlertPluginInstanceServiceImpl extends BaseServiceImpl implements AlertPluginInstanceService { @Autowired private AlertPluginInstanceMapper alertPluginInstanceMapper; @Autowired private PluginDefineMapper pluginDefineMapper; @Autowired private AlertGroupMapper alertGroupMapper; /** * creat alert plugin instance * * @param loginUser login user * @param pluginDefineId plugin define id * @param instanceName instance name * @param pluginInstanceParams plugin instance params */ @Override public Map<String, Object> create(User loginUser, int pluginDefineId, String instanceName, String pluginInstanceParams) { AlertPluginInstance alertPluginInstance = new AlertPluginInstance(); String paramsMapJson = parsePluginParamsMap(pluginInstanceParams); alertPluginInstance.setPluginInstanceParams(paramsMapJson); alertPluginInstance.setInstanceName(instanceName); alertPluginInstance.setPluginDefineId(pluginDefineId); Map<String, Object> result = new HashMap<>(); if (alertPluginInstanceMapper.existInstanceName(alertPluginInstance.getInstanceName()) == Boolean.TRUE) { putMsg(result, Status.PLUGIN_INSTANCE_ALREADY_EXIT); return result; } int i = alertPluginInstanceMapper.insert(alertPluginInstance); if (i > 0) { putMsg(result, Status.SUCCESS); return result; } putMsg(result, Status.SAVE_ERROR); return result; } /** * update alert plugin instance * * @param loginUser login user * @param pluginInstanceId plugin instance id * @param instanceName instance name * @param pluginInstanceParams plugin instance params */ @Override public Map<String, Object> update(User loginUser, int pluginInstanceId, String instanceName, String pluginInstanceParams) { String paramsMapJson = parsePluginParamsMap(pluginInstanceParams); AlertPluginInstance alertPluginInstance = new AlertPluginInstance(pluginInstanceId, paramsMapJson, instanceName, new Date()); Map<String, Object> result = new HashMap<>(); int i = alertPluginInstanceMapper.updateById(alertPluginInstance); if (i > 0) { putMsg(result, Status.SUCCESS); return result; } putMsg(result, Status.SAVE_ERROR); return result; } /** * delete alert plugin instance * * @param loginUser login user * @param id id * @return result */ @Override public Map<String, Object> delete(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); //check if there is an associated alert group boolean hasAssociatedAlertGroup = checkHasAssociatedAlertGroup(String.valueOf(id)); if (hasAssociatedAlertGroup) { putMsg(result, Status.DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED); return result; } int i = alertPluginInstanceMapper.deleteById(id); if (i > 0) { putMsg(result, Status.SUCCESS); } return result; } /** * get alert plugin instance * * @param loginUser login user * @param id get id * @return alert plugin */ @Override public Map<String, Object> get(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); AlertPluginInstance alertPluginInstance = alertPluginInstanceMapper.selectById(id); if (null != alertPluginInstance) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, alertPluginInstance); } return result; } @Override public Map<String, Object> queryAll() { Map<String, Object> result = new HashMap<>(); List<AlertPluginInstance> alertPluginInstances = alertPluginInstanceMapper.queryAllAlertPluginInstanceList(); List<AlertPluginInstanceVO> alertPluginInstanceVOS = buildPluginInstanceVOList(alertPluginInstances); if (null != alertPluginInstances) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, alertPluginInstanceVOS); } return result; } @Override public boolean checkExistPluginInstanceName(String pluginInstanceName) { return alertPluginInstanceMapper.existInstanceName(pluginInstanceName) == Boolean.TRUE; } @Override public Result queryPluginPage(int pageIndex, int pageSize) { IPage<AlertPluginInstance> pluginInstanceIPage = new Page<>(pageIndex, pageSize); pluginInstanceIPage = alertPluginInstanceMapper.selectPage(pluginInstanceIPage, null); PageInfo<AlertPluginInstanceVO> pageInfo = new PageInfo<>(pageIndex, pageSize); pageInfo.setTotal((int) pluginInstanceIPage.getTotal()); pageInfo.setTotalList(buildPluginInstanceVOList(pluginInstanceIPage.getRecords())); Result result = new Result(); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } private List<AlertPluginInstanceVO> buildPluginInstanceVOList(List<AlertPluginInstance> alertPluginInstances) { if (CollectionUtils.isEmpty(alertPluginInstances)) { return null; } List<PluginDefine> pluginDefineList = pluginDefineMapper.queryAllPluginDefineList(); if (CollectionUtils.isEmpty(pluginDefineList)) { return null; } Map<Integer, PluginDefine> pluginDefineMap = pluginDefineList.stream().collect(Collectors.toMap(PluginDefine::getId, Function.identity())); List<AlertPluginInstanceVO> alertPluginInstanceVOS = new ArrayList<>(); alertPluginInstances.forEach(alertPluginInstance -> { AlertPluginInstanceVO alertPluginInstanceVO = new AlertPluginInstanceVO(); alertPluginInstanceVO.setCreateTime(alertPluginInstance.getCreateTime()); alertPluginInstanceVO.setUpdateTime(alertPluginInstance.getUpdateTime()); alertPluginInstanceVO.setPluginDefineId(alertPluginInstance.getPluginDefineId()); alertPluginInstanceVO.setInstanceName(alertPluginInstance.getInstanceName()); alertPluginInstanceVO.setId(alertPluginInstance.getId()); PluginDefine pluginDefine = pluginDefineMap.get(alertPluginInstance.getPluginDefineId()); //FIXME When the user removes the plug-in, this will happen. At this time, maybe we should add a new field to indicate that the plug-in has expired? if (null == pluginDefine) { return; } alertPluginInstanceVO.setAlertPluginName(pluginDefine.getPluginName()); //todo List pages do not recommend returning this parameter String pluginParamsMapString = alertPluginInstance.getPluginInstanceParams(); String uiPluginParams = parseToPluginUiParams(pluginParamsMapString, pluginDefine.getPluginParams()); alertPluginInstanceVO.setPluginInstanceParams(uiPluginParams); alertPluginInstanceVOS.add(alertPluginInstanceVO); }); return alertPluginInstanceVOS; } /** * Get the parameters actually needed by the plugin * * @param pluginParams Complete parameters(include ui) * @return k, v(json string) */ private String parsePluginParamsMap(String pluginParams) { Map<String, String> paramsMap = PluginParamsTransfer.getPluginParamsMap(pluginParams); return JSONUtils.toJsonString(paramsMap); } /** * parse To Plugin Ui Params * * @param pluginParamsMapString k-v data * @param pluginUiParams Complete parameters(include ui) * @return Complete parameters list(include ui) */ private String parseToPluginUiParams(String pluginParamsMapString, String pluginUiParams) { List<Map<String, Object>> pluginParamsList = PluginParamsTransfer.generatePluginParams(pluginParamsMapString, pluginUiParams); return JSONUtils.toJsonString(pluginParamsList); } private boolean checkHasAssociatedAlertGroup(String id) { List<String> idsList = alertGroupMapper.queryInstanceIdsList(); if (CollectionUtils.isEmpty(idsList)) { return false; } Optional<String> first = idsList.stream().filter(k -> null != k && Arrays.asList(k.split(",")).contains(id)).findFirst(); return first.isPresent(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AlertPluginInstanceMapper.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.dao.mapper; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.ibatis.annotations.Param; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; public interface AlertPluginInstanceMapper extends BaseMapper<AlertPluginInstance> { /** * query all alert plugin instance * * @return AlertPluginInstance list */ List<AlertPluginInstance> queryAllAlertPluginInstanceList(); /** * query by alert group id * * @param ids * @return AlertPluginInstance list */ List<AlertPluginInstance> queryByIds(@Param("ids") List<Integer> ids); List<AlertPluginInstance> queryByInstanceName(@Param("instanceName")String instanceName); /** * * @param instanceName instanceName * @return if exist return true else return null */ Boolean existInstanceName(@Param("instanceName") String instanceName); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AlertPluginInstanceMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.AlertPluginInstanceMapper"> <select id="queryAllAlertPluginInstanceList" resultType="org.apache.dolphinscheduler.dao.entity.AlertPluginInstance"> select * from t_ds_alert_plugin_instance where 1 = 1 </select> <select id="queryByIds" resultType="org.apache.dolphinscheduler.dao.entity.AlertPluginInstance"> select * from t_ds_alert_plugin_instance where id in <foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> #{item} </foreach> </select> <select id="queryByInstanceName" resultType="org.apache.dolphinscheduler.dao.entity.AlertPluginInstance"> select * from t_ds_alert_plugin_instance where instance_name = #{instanceName} </select> <select id="existInstanceName" resultType="java.lang.Boolean"> select 1 from t_ds_alert_plugin_instance where instance_name = #{instanceName} limit 1 </select> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,209
[Bug] [api-service] Filter Security: warning-instance failed
### 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 When I filter `warning-instance` object, I found the result is not expect, and the result not filter ![image](https://user-images.githubusercontent.com/15820530/144805823-4d7cdc1d-bdc6-4d4b-990d-ff6c73deb5d8.png) ### What you expected to happen Filter base on I enter ### How to reproduce Go to `http://<IP>:<PORT>/dolphinscheduler/ui/#/security/warning-instance` and see whether it could filter or not. ### Anything else _No response_ ### 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/7209
https://github.com/apache/dolphinscheduler/pull/7210
e4955934fd7223caf5ec9b0a7d6173a190ef1958
04805818c21c14e2fa147ed5018e7f6045642ff8
"2021-12-06T07:41:09Z"
java
"2021-12-14T04:08:22Z"
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AlertPluginInstanceMapperTest.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.dao.mapper; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.BaseDaoTest; import org.apache.dolphinscheduler.dao.entity.AlertGroup; import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance; import org.apache.dolphinscheduler.dao.entity.PluginDefine; import java.util.List; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; /** * AlertPluginInstanceMapper mapper test */ public class AlertPluginInstanceMapperTest extends BaseDaoTest { @Autowired private AlertPluginInstanceMapper alertPluginInstanceMapper; @Autowired private PluginDefineMapper pluginDefineMapper; @Autowired private AlertGroupMapper alertGroupMapper; @Test public void testQueryAllAlertPluginInstanceList() { createAlertPluginInstance(); List<AlertPluginInstance> alertPluginInstanceList = alertPluginInstanceMapper.queryAllAlertPluginInstanceList(); Assert.assertTrue(alertPluginInstanceList.size() > 0); } @Test public void testQueryByAlertGroupId() { createAlertPluginInstance(); List<AlertGroup> testAlertGroupList = alertGroupMapper.queryByGroupName("test_group_01"); Assert.assertNotNull(testAlertGroupList); Assert.assertTrue(testAlertGroupList.size() > 0); AlertGroup alertGroup = testAlertGroupList.get(0); } @Test public void testExistInstanceName() { String instanceName = "test_instance"; Assert.assertNull(alertPluginInstanceMapper.existInstanceName(instanceName)); createAlertPluginInstance(); Assert.assertTrue(alertPluginInstanceMapper.existInstanceName(instanceName)); } /** * insert * * @return AlertPluginInstance */ private AlertPluginInstance createAlertPluginInstance() { PluginDefine pluginDefine = createPluginDefine(); AlertGroup alertGroup = createAlertGroup("test_group_01"); AlertPluginInstance alertPluginInstance = new AlertPluginInstance(pluginDefine.getId(), "", "test_instance"); alertPluginInstanceMapper.insert(alertPluginInstance); return alertPluginInstance; } /** * insert * * @return PluginDefine */ private PluginDefine createPluginDefine() { PluginDefine pluginDefine = new PluginDefine("test plugin", "alert", ""); pluginDefineMapper.insert(pluginDefine); return pluginDefine; } /** * insert * * @return AlertGroup */ private AlertGroup createAlertGroup(String groupName) { AlertGroup alertGroup = new AlertGroup(); alertGroup.setGroupName(groupName); alertGroup.setDescription("alert group 1"); alertGroup.setCreateTime(DateUtils.getCurrentDate()); alertGroup.setUpdateTime(DateUtils.getCurrentDate()); alertGroupMapper.insert(alertGroup); return alertGroup; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,341
[Bug] [dolphinscheduler-ui] If the parameters of the query page are modified, requests are sent to the backend all time until whe number of page limit
### 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 1. admin login 2. search project name in project page 3. modify the pageNo parameter to any value (Is greater than 10) eg http://ip:12345/dolphinscheduler/ui/#/projects/list?pageSize=10&pageNo=70&searchVal= 4. View page requests and log requests ![image](https://user-images.githubusercontent.com/55787491/145710663-6f891792-398e-42f9-8e31-7eaeb312993d.png) ### What you expected to happen When the user first requests it,response contains the params totalPage: 7 When the user requests it a second time, the parameter pageNo should be changed to totalPage: 7 ![image](https://user-images.githubusercontent.com/55787491/145710681-6f8a4bbd-3232-42da-8c50-8360ff39a136.png) ### How to reproduce 1. admin login 2. send a request to this url http://ip:12345/dolphinscheduler/ui/#/projects/list?pageSize=10&pageNo=70&searchVal= ### Anything else 2.0.1-prepare ### Version 2.0.1-prepare ### Are you willing to submit PR? - [ ] 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/7341
https://github.com/apache/dolphinscheduler/pull/7399
57697602c53d4db54f70abad1d37d41926f87bb7
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
"2021-12-12T08:45:52Z"
java
"2021-12-14T08:31:08Z"
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/list/index.vue
/* * 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. */ <template> <m-list-construction :title="$t('Project')"> <template slot="conditions"> <m-conditions @on-conditions="_onConditions"> <template slot="button-group"> <el-button size="mini" @click="_create('')" id="button-create-project">{{ $t('Create Project') }}</el-button> <el-dialog :title="item ? $t('Edit') : $t('Create Project')" v-if="createProjectDialog" :visible.sync="createProjectDialog" width="auto"> <m-create-project :item="item" @_onUpdate="_onUpdate" @close="_close"></m-create-project> </el-dialog> </template> </m-conditions> </template> <template slot="content"> <template v-if="projectsList.length || total>0"> <m-list :projects-list="projectsList" @on-update="_onUpdate" :page-no="searchParams.pageNo" :page-size="searchParams.pageSize"></m-list> <div class="page-box"> <el-pagination background @current-change="_page" @size-change="_pageSize" :page-size="searchParams.pageSize" :current-page.sync="searchParams.pageNo" :page-sizes="[10, 30, 50]" layout="sizes, prev, pager, next, jumper" :total="total"> </el-pagination> </div> </template> <template v-if="!projectsList.length && total<=0"> <m-no-data></m-no-data> </template> <m-spin :is-spin="isLoading" :is-left="false"></m-spin> </template> </m-list-construction> </template> <script> import _ from 'lodash' import { mapActions } from 'vuex' import mList from './_source/list' import mSpin from '@/module/components/spin/spin' import mCreateProject from './_source/createProject' import mNoData from '@/module/components/noData/noData' import listUrlParamHandle from '@/module/mixin/listUrlParamHandle' import mConditions from '@/module/components/conditions/conditions' import mListConstruction from '@/module/components/listConstruction/listConstruction' export default { name: 'projects-list', data () { return { total: null, projectsList: [], isLoading: true, searchParams: { pageSize: 10, pageNo: 1, searchVal: '' }, createProjectDialog: false, item: {} } }, mixins: [listUrlParamHandle], props: {}, methods: { ...mapActions('projects', ['getProjectsList']), /** * Inquire */ _onConditions (o) { this.searchParams = _.assign(this.searchParams, o) this.searchParams.pageNo = 1 }, _page (val) { this.searchParams.pageNo = val }, _pageSize (val) { this.searchParams.pageSize = val }, _create (item) { this.createProjectDialog = true this.item = item }, _onUpdate () { this.createProjectDialog = false this._debounceGET() }, _close () { this.createProjectDialog = false }, _getList (flag) { this.isLoading = !flag this.getProjectsList(this.searchParams).then(res => { if (this.searchParams.pageNo > 1 && res.totalList.length === 0) { this.searchParams.pageNo = this.searchParams.pageNo - 1 } else { this.projectsList = [] this.projectsList = res.totalList this.total = res.total this.isLoading = false } }).catch(e => { this.isLoading = false }) } }, watch: { // router '$route' (a) { // url no params get instance list this.searchParams.pageNo = _.isEmpty(a.query) ? 1 : a.query.pageNo } }, created () { }, mounted () { }, components: { mListConstruction, mSpin, mConditions, mList, mCreateProject, mNoData } } </script>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.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.api.controller; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_BY_USER_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.GENERATE_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ACCESS_TOKEN_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; /** * access token controller */ @Api(tags = "ACCESS_TOKEN_TAG") @RestController @RequestMapping("/access-tokens") public class AccessTokenController extends BaseController { @Autowired private AccessTokenService accessTokenService; /** * create token * * @param loginUser login user * @param userId token for user id * @param expireTime expire time for the token * @param token token * @return create result state code */ @ApiIgnore @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result createToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token") String token) { Map<String, Object> result = accessTokenService.createToken(loginUser, userId, expireTime, token); return returnDataList(result); } /** * generate token string * * @param loginUser login user * @param userId token for user * @param expireTime expire time * @return token string */ @ApiIgnore @PostMapping(value = "/generate") @ResponseStatus(HttpStatus.CREATED) @ApiException(GENERATE_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result generateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime) { Map<String, Object> result = accessTokenService.generateToken(loginUser, userId, expireTime); return returnDataList(result); } /** * query access token list paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return token list of page number and page size */ @ApiOperation(value = "queryAccessTokenList", notes = "QUERY_ACCESS_TOKEN_LIST_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("pageNo") Integer pageNo, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageSize") Integer pageSize) { Result result = checkPageParams(pageNo, pageSize); if (!result.checkResult()) { return result; } searchVal = ParameterUtils.handleEscapes(searchVal); result = accessTokenService.queryAccessTokenList(loginUser, searchVal, pageNo, pageSize); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @ApiOperation(value = "queryAccessTokenByUser", notes = "QUERY_ACCESS_TOKEN_BY_USER_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int") }) @GetMapping(value = "/user/{userId}") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_BY_USER_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("userId") Integer userId) { Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(loginUser, userId); return this.returnDataList(result); } /** * delete access token by id * * @param loginUser login user * @param id token id * @return delete result code */ @ApiIgnore @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result delAccessTokenById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id) { Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); return returnDataList(result); } /** * update token * * @param loginUser login user * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ @ApiIgnore @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token") String token) { Map<String, Object> result = accessTokenService.updateToken(loginUser, id, userId, expireTime, token); return returnDataList(result); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.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.api.service; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * access token service */ public interface AccessTokenService { /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize); /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId); /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string * @return create result code */ Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token); /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ Map<String, Object> generateToken(User loginUser, int userId, String expireTime); /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ Map<String, Object> delAccessTokenById(User loginUser, int id); /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.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.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.EncryptionUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service impl */ @Service public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTokenService { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceImpl.class); @Autowired private AccessTokenMapper accessTokenMapper; /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ @Override public Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize); Page<AccessToken> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (loginUser.getUserType() == UserType.ADMIN_USER) { userId = 0; } IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, searchVal, userId); pageInfo.setTotal((int) accessTokenList.getTotal()); pageInfo.setTotalList(accessTokenList.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @Override public Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); // only admin can operate if (isNotAdmin(loginUser, result)) { return result; } // query access token for specified user List<AccessToken> accessTokenList = this.accessTokenMapper.queryAccessTokenByUser(userId); result.put(Constants.DATA_LIST, accessTokenList); this.putMsg(result, Status.SUCCESS); return result; } /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string * @return create result code */ @SuppressWarnings("checkstyle:WhitespaceAround") @Override public Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (userId <= 0) { throw new IllegalArgumentException("User id should not less than or equals to 0."); } AccessToken accessToken = new AccessToken(); accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setCreateTime(new Date()); accessToken.setUpdateTime(new Date()); // insert int insert = accessTokenMapper.insert(accessToken); if (insert > 0) { result.put(Constants.DATA_LIST, accessToken); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR); } return result; } /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ @Override public Map<String, Object> generateToken(User loginUser, int userId, String expireTime) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } String token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); result.put(Constants.DATA_LIST, token); putMsg(result, Status.SUCCESS); return result; } /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ @Override public Map<String, Object> delAccessTokenById(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } if (!hasPerm(loginUser,accessToken.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } accessTokenMapper.deleteById(id); putMsg(result, Status.SUCCESS); return result; } /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ @Override public Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setUpdateTime(new Date()); accessTokenMapper.updateById(accessToken); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/resources/i18n/messages.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=query schedule list EXECUTE_PROCESS_TAG=execute process related operation PROCESS_INSTANCE_EXECUTOR_TAG=process instance executor related operation RUN_PROCESS_INSTANCE_NOTES=run process instance START_NODE_LIST=start node list(node name) TASK_DEPEND_TYPE=task depend type COMMAND_TYPE=command type RUN_MODE=run mode TIMEOUT=timeout EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=execute action to process instance EXECUTE_TYPE=execute type START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition GET_RECEIVER_CC_NOTES=query receiver cc DESC=description GROUP_NAME=group name GROUP_TYPE=group type QUERY_ALERT_GROUP_LIST_NOTES=query alert group list UPDATE_ALERT_GROUP_NOTES=update alert group DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not GRANT_ALERT_GROUP_NOTES=grant alert group USER_IDS=user id list ALERT_GROUP_TAG=alert group related operation ALERT_PLUGIN_INSTANCE_TAG=alert plugin instance related operation UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=update alert plugin instance operation CREATE_ALERT_PLUGIN_INSTANCE_NOTES=create alert plugin instance operation DELETE_ALERT_PLUGIN_INSTANCE_NOTES=delete alert plugin instance operation GET_ALERT_PLUGIN_INSTANCE_NOTES=get alert plugin instance operation CREATE_ALERT_GROUP_NOTES=create alert group WORKER_GROUP_TAG=worker group related operation SAVE_WORKER_GROUP_NOTES=create worker group WORKER_GROUP_NAME=worker group name WORKER_IP_LIST=worker ip list, eg. 192.168.1.1,192.168.1.2 QUERY_WORKER_GROUP_PAGING_NOTES=query worker group paging QUERY_WORKER_GROUP_LIST_NOTES=query worker group list DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id DATA_ANALYSIS_TAG=analysis related operation of task state COUNT_TASK_STATE_NOTES=count task state COUNT_PROCESS_INSTANCE_NOTES=count process instance state COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user COUNT_COMMAND_STATE_NOTES=count command state COUNT_QUEUE_STATE_NOTES=count the running status of the task in the queue\ ACCESS_TOKEN_TAG=access token related operation MONITOR_TAG=monitor related operation MASTER_LIST_NOTES=master server list WORKER_LIST_NOTES=worker server list QUERY_DATABASE_STATE_NOTES=query database state QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE TASK_STATE=task instance state SOURCE_TABLE=SOURCE TABLE DEST_TABLE=dest table TASK_DATE=task date QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging DATA_SOURCE_TAG=data source related operation CREATE_DATA_SOURCE_NOTES=create data source DATA_SOURCE_NAME=data source name DATA_SOURCE_NOTE=data source desc DB_TYPE=database type DATA_SOURCE_HOST=DATA SOURCE HOST DATA_SOURCE_PORT=data source port DATABASE_NAME=database name QUEUE_TAG=queue related operation QUERY_QUEUE_LIST_NOTES=query queue list QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging CREATE_QUEUE_NOTES=create queue YARN_QUEUE_NAME=yarn(hadoop) queue name QUEUE_ID=queue id TENANT_DESC=tenant desc QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging QUERY_TENANT_LIST_NOTES=query tenant list UPDATE_TENANT_NOTES=update tenant DELETE_TENANT_NOTES=delete tenant RESOURCES_TAG=resource center related operation CREATE_RESOURCE_NOTES=create resource RESOURCE_TYPE=resource file type RESOURCE_NAME=resource name RESOURCE_DESC=resource file desc RESOURCE_FILE=resource file RESOURCE_ID=resource id QUERY_RESOURCE_LIST_NOTES=query resource list DELETE_RESOURCE_BY_ID_NOTES=delete resource by id VIEW_RESOURCE_BY_ID_NOTES=view resource by id ONLINE_CREATE_RESOURCE_NOTES=online create resource SUFFIX=resource file suffix CONTENT=resource file content UPDATE_RESOURCE_NOTES=edit resource file online DOWNLOAD_RESOURCE_NOTES=download resource file CREATE_UDF_FUNCTION_NOTES=create udf function UDF_TYPE=UDF type FUNC_NAME=function name CLASS_NAME=package and class name ARG_TYPES=arguments UDF_DESC=udf desc VIEW_UDF_FUNCTION_NOTES=view udf function UPDATE_UDF_FUNCTION_NOTES=update udf function QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name DELETE_UDF_FUNCTION_NOTES=delete udf function AUTHORIZED_FILE_NOTES=authorized file UNAUTHORIZED_FILE_NOTES=unauthorized file AUTHORIZED_UDF_FUNC_NOTES=authorized udf func UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=the kerberos authentication parameter java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=the kerberos authentication parameter login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=the kerberos authentication parameter login.user.keytab.path PROJECT_TAG=project related operation CREATE_PROJECT_NOTES=create project PROJECT_DESC=project description UPDATE_PROJECT_NOTES=update project PROJECT_ID=project id QUERY_PROJECT_BY_ID_NOTES=query project info by project id QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING DELETE_PROJECT_BY_ID_NOTES=delete project by id QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project QUERY_ALL_PROJECT_LIST_NOTES=query all project list QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project QUERY_AUTHORIZED_USER_NOTES=query authorized user TASK_RECORD_TAG=task record related operation QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging CREATE_TOKEN_NOTES=create token ,note: please login first QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging QUERY_ACCESS_TOKEN_BY_USER_NOTES=query access token for specified user SCHEDULE=schedule WARNING_TYPE=warning type(sending strategy) WARNING_GROUP_ID=warning group id FAILURE_STRATEGY=failure strategy RECEIVERS=receivers RECEIVERS_CC=receivers cc WORKER_GROUP_ID=worker server group id PROCESS_INSTANCE_PRIORITY=process instance priority UPDATE_SCHEDULE_NOTES=update schedule SCHEDULE_ID=schedule id ONLINE_SCHEDULE_NOTES=online schedule OFFLINE_SCHEDULE_NOTES=offline schedule QUERY_SCHEDULE_NOTES=query schedule QUERY_SCHEDULE_LIST_PAGING_NOTES=query schedule list paging LOGIN_TAG=User login related operations USER_NAME=user name PROJECT_NAME=project name CREATE_PROCESS_DEFINITION_NOTES=create process definition PROCESS_DEFINITION_NAME=process definition name PROCESS_DEFINITION_JSON=process definition detail info (json format) PROCESS_DEFINITION_LOCATIONS=process definition node locations info (json format) PROCESS_INSTANCE_LOCATIONS=process instance node locations info (json format) PROCESS_DEFINITION_CONNECTS=process definition node connects info (json format) PROCESS_INSTANCE_CONNECTS=process instance node connects info (json format) PROCESS_DEFINITION_DESC=process definition desc PROCESS_DEFINITION_TAG=process definition related opertation SIGNOUT_NOTES=logout USER_PASSWORD=user password UPDATE_PROCESS_INSTANCE_NOTES=update process instance QUERY_PROCESS_INSTANCE_LIST_NOTES=query process instance list VERIFY_PROCESS_DEFINITION_NAME_NOTES=verify process definition name LOGIN_NOTES=user login UPDATE_PROCESS_DEFINITION_NOTES=update process definition PROCESS_DEFINITION_ID=process definition id PROCESS_DEFINITION_IDS=process definition ids RELEASE_PROCESS_DEFINITION_NOTES=release process definition QUERY_PROCESS_DEFINITION_BY_ID_NOTES=query process definition by id QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=query process definition by name QUERY_PROCESS_DEFINITION_LIST_NOTES=query process definition list QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=query process definition list paging QUERY_ALL_DEFINITION_LIST_NOTES=query all definition list PAGE_NO=page no PROCESS_INSTANCE_ID=process instance id PROCESS_INSTANCE_JSON=process instance info(json format) SCHEDULE_TIME=schedule time SYNC_DEFINE=update the information of the process instance to the process definition\ RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance SEARCH_VAL=search val USER_ID=user id PAGE_SIZE=page size LIMIT=limit VIEW_TREE_NOTES=view tree GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id PROCESS_DEFINITION_ID_LIST=process definition id list QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=query process definition all by project id DELETE_PROCESS_DEFINITION_BY_ID_NOTES=delete process definition by process definition id BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=batch delete process definition by process definition ids QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id TASK_ID=task instance id SKIP_LINE_NUM=skip line num QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log USERS_TAG=users related operation SCHEDULER_TAG=scheduler related operation CREATE_SCHEDULE_NOTES=create schedule CREATE_USER_NOTES=create user TENANT_ID=tenant id QUEUE=queue EMAIL=email PHONE=phone QUERY_USER_LIST_NOTES=query user list UPDATE_USER_NOTES=update user DELETE_USER_BY_ID_NOTES=delete user by id GRANT_PROJECT_NOTES=GRANT PROJECT PROJECT_IDS=project ids(string format, multiple projects separated by ",") GRANT_PROJECT_BY_CODE_NOTES=GRANT PROJECT BY CODE REVOKE_PROJECT_NOTES=REVOKE PROJECT FOR USER PROJECT_CODE=project codes GRANT_RESOURCE_NOTES=grant resource file RESOURCE_IDS=resource ids(string format, multiple resources separated by ",") GET_USER_INFO_NOTES=get user info LIST_USER_NOTES=list user VERIFY_USER_NAME_NOTES=verify user name UNAUTHORIZED_USER_NOTES=cancel authorization ALERT_GROUP_ID=alert group id AUTHORIZED_USER_NOTES=authorized user GRANT_UDF_FUNC_NOTES=grant udf function UDF_IDS=udf ids(string format, multiple udf functions separated by ",") GRANT_DATASOURCE_NOTES=grant datasource DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",") QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=query process instance global variables and local variables VIEW_GANTT_NOTES=view gantt SUB_PROCESS_INSTANCE_ID=sub process instance id TASK_NAME=task instance name TASK_INSTANCE_TAG=task instance related operation LOGGER_TAG=log related operation PROCESS_INSTANCE_TAG=process instance related operation EXECUTION_STATUS=runing status for workflow and task nodes HOST=ip address of running task START_DATE=start date END_DATE=end date QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id UPDATE_DATA_SOURCE_NOTES=update data source DATA_SOURCE_ID=DATA SOURCE ID QUERY_DATA_SOURCE_NOTES=query data source by id QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test DELETE_DATA_SOURCE_NOTES=delete data source VERIFY_DATA_SOURCE_NOTES=verify data source UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source AUTHORIZED_DATA_SOURCE_NOTES=authorized data source DELETE_SCHEDULER_BY_ID_NOTES=delete scheduler by id QUERY_ALERT_GROUP_LIST_PAGING_NOTES=query alert group list paging EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=export process definition by id BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES= batch export process definition by ids QUERY_USER_CREATED_PROJECT_NOTES= query user created project QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES= query authorized and user created project COPY_PROCESS_DEFINITION_NOTES= copy process definition notes MOVE_PROCESS_DEFINITION_NOTES= move process definition notes TARGET_PROJECT_ID= target project id IS_COPY = is copy DELETE_PROCESS_DEFINITION_VERSION_NOTES=delete process definition version QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=query process definition versions SWITCH_PROCESS_DEFINITION_VERSION_NOTES=switch process definition version VERSION=version
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=query schedule list EXECUTE_PROCESS_TAG=execute process related operation PROCESS_INSTANCE_EXECUTOR_TAG=process instance executor related operation RUN_PROCESS_INSTANCE_NOTES=run process instance START_NODE_LIST=start node list(node name) TASK_DEPEND_TYPE=task depend type COMMAND_TYPE=command type RUN_MODE=run mode TIMEOUT=timeout EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=execute action to process instance EXECUTE_TYPE=execute type START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition GET_RECEIVER_CC_NOTES=query receiver cc DESC=description GROUP_NAME=group name GROUP_TYPE=group type QUERY_ALERT_GROUP_LIST_NOTES=query alert group list UPDATE_ALERT_GROUP_NOTES=update alert group DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not GRANT_ALERT_GROUP_NOTES=grant alert group USER_IDS=user id list EXECUTOR_TAG=executor operation EXECUTOR_NAME=executor name WORKER_GROUP=work group startParams=start parameters ALERT_GROUP_TAG=alert group related operation ALERT_PLUGIN_INSTANCE_TAG=alert plugin instance related operation WORK_FLOW_LINEAGE_TAG=work flow lineage related operation UI_PLUGINS_TAG=UI plugin related operation UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=update alert plugin instance operation CREATE_ALERT_PLUGIN_INSTANCE_NOTES=create alert plugin instance operation DELETE_ALERT_PLUGIN_INSTANCE_NOTES=delete alert plugin instance operation QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES=query alert plugin instance paging QUERY_TOPN_LONGEST_RUNNING_PROCESS_INSTANCE_NOTES=query topN longest running process instance ALERT_PLUGIN_INSTANCE_NAME=alert plugin instance name ALERT_PLUGIN_DEFINE_ID=alert plugin define id ALERT_PLUGIN_ID=alert plugin id ALERT_PLUGIN_INSTANCE_ID=alert plugin instance id ALERT_PLUGIN_INSTANCE_PARAMS=alert plugin instance parameters ALERT_INSTANCE_NAME=alert instance name VERIFY_ALERT_INSTANCE_NAME_NOTES=verify alert instance name DATA_SOURCE_PARAM=datasource parameter QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES=query all alert plugin instances GET_ALERT_PLUGIN_INSTANCE_NOTES=get alert plugin instance operation CREATE_ALERT_GROUP_NOTES=create alert group WORKER_GROUP_TAG=worker group related operation SAVE_WORKER_GROUP_NOTES=create worker group WORKER_GROUP_NAME=worker group name WORKER_IP_LIST=worker ip list, eg. 192.168.1.1,192.168.1.2 QUERY_WORKER_GROUP_PAGING_NOTES=query worker group paging QUERY_WORKER_GROUP_LIST_NOTES=query worker group list DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id DATA_ANALYSIS_TAG=analysis related operation of task state COUNT_TASK_STATE_NOTES=count task state COUNT_PROCESS_INSTANCE_NOTES=count process instance state COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user COUNT_COMMAND_STATE_NOTES=count command state COUNT_QUEUE_STATE_NOTES=count the running status of the task in the queue\ ACCESS_TOKEN_TAG=access token related operation MONITOR_TAG=monitor related operation MASTER_LIST_NOTES=master server list WORKER_LIST_NOTES=worker server list QUERY_DATABASE_STATE_NOTES=query database state QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE TASK_STATE=task instance state SOURCE_TABLE=SOURCE TABLE DEST_TABLE=dest table TASK_DATE=task date QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging DATA_SOURCE_TAG=data source related operation CREATE_DATA_SOURCE_NOTES=create data source DATA_SOURCE_NAME=data source name DATA_SOURCE_NOTE=data source desc DB_TYPE=database type DATA_SOURCE_HOST=DATA SOURCE HOST DATA_SOURCE_PORT=data source port DATABASE_NAME=database name QUEUE_TAG=queue related operation QUERY_QUEUE_LIST_NOTES=query queue list QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging CREATE_QUEUE_NOTES=create queue YARN_QUEUE_NAME=yarn(hadoop) queue name QUEUE_ID=queue id TENANT_DESC=tenant desc QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging QUERY_TENANT_LIST_NOTES=query tenant list UPDATE_TENANT_NOTES=update tenant DELETE_TENANT_NOTES=delete tenant RESOURCES_TAG=resource center related operation CREATE_RESOURCE_NOTES=create resource RESOURCE_TYPE=resource file type RESOURCE_NAME=resource name RESOURCE_DESC=resource file desc RESOURCE_FILE=resource file RESOURCE_ID=resource id QUERY_RESOURCE_LIST_NOTES=query resource list DELETE_RESOURCE_BY_ID_NOTES=delete resource by id VIEW_RESOURCE_BY_ID_NOTES=view resource by id ONLINE_CREATE_RESOURCE_NOTES=online create resource SUFFIX=resource file suffix CONTENT=resource file content UPDATE_RESOURCE_NOTES=edit resource file online DOWNLOAD_RESOURCE_NOTES=download resource file CREATE_UDF_FUNCTION_NOTES=create udf function UDF_TYPE=UDF type FUNC_NAME=function name CLASS_NAME=package and class name ARG_TYPES=arguments UDF_DESC=udf desc VIEW_UDF_FUNCTION_NOTES=view udf function UPDATE_UDF_FUNCTION_NOTES=update udf function QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name DELETE_UDF_FUNCTION_NOTES=delete udf function AUTHORIZED_FILE_NOTES=authorized file UNAUTHORIZED_FILE_NOTES=unauthorized file AUTHORIZED_UDF_FUNC_NOTES=authorized udf func UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=the kerberos authentication parameter java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=the kerberos authentication parameter login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=the kerberos authentication parameter login.user.keytab.path PROJECT_TAG=project related operation CREATE_PROJECT_NOTES=create project PROJECT_DESC=project description UPDATE_PROJECT_NOTES=update project PROJECT_ID=project id QUERY_PROJECT_BY_ID_NOTES=query project info by project id QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING QUERY_ALL_PROJECT_LIST_NOTES=query all project list DELETE_PROJECT_BY_ID_NOTES=delete project by id QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project QUERY_AUTHORIZED_USER_NOTES=query authorized user TASK_RECORD_TAG=task record related operation QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging CREATE_TOKEN_NOTES=create token ,note: please login first QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging QUERY_ACCESS_TOKEN_BY_USER_NOTES=query access token for specified user SCHEDULE=schedule WARNING_TYPE=warning type(sending strategy) WARNING_GROUP_ID=warning group id FAILURE_STRATEGY=failure strategy RECEIVERS=receivers RECEIVERS_CC=receivers cc WORKER_GROUP_ID=worker server group id PROCESS_INSTANCE_START_TIME=process instance start time PROCESS_INSTANCE_END_TIME=process instance end time PROCESS_INSTANCE_SIZE=process instance size PROCESS_INSTANCE_PRIORITY=process instance priority EXPECTED_PARALLELISM_NUMBER=custom parallelism to set the complement task threads UPDATE_SCHEDULE_NOTES=update schedule SCHEDULE_ID=schedule id ONLINE_SCHEDULE_NOTES=online schedule OFFLINE_SCHEDULE_NOTES=offline schedule QUERY_SCHEDULE_NOTES=query schedule QUERY_SCHEDULE_LIST_PAGING_NOTES=query schedule list paging LOGIN_TAG=User login related operations USER_NAME=user name PROJECT_NAME=project name CREATE_PROCESS_DEFINITION_NOTES=create process definition PROCESS_DEFINITION_NAME=process definition name PROCESS_DEFINITION_JSON=process definition detail info (json format) PROCESS_DEFINITION_LOCATIONS=process definition node locations info (json format) PROCESS_INSTANCE_LOCATIONS=process instance node locations info (json format) PROCESS_DEFINITION_CONNECTS=process definition node connects info (json format) PROCESS_INSTANCE_CONNECTS=process instance node connects info (json format) PROCESS_DEFINITION_DESC=process definition desc PROCESS_DEFINITION_TAG=process definition related operation SIGNOUT_NOTES=logout USER_PASSWORD=user password UPDATE_PROCESS_INSTANCE_NOTES=update process instance QUERY_PROCESS_INSTANCE_LIST_NOTES=query process instance list VERIFY_PROCESS_DEFINITION_NAME_NOTES=verify process definition name LOGIN_NOTES=user login UPDATE_PROCESS_DEFINITION_NOTES=update process definition PROCESS_DEFINITION_ID=process definition id PROCESS_DEFINITION_IDS=process definition ids PROCESS_DEFINITION_CODE=process definition code PROCESS_DEFINITION_CODE_LIST=process definition code list IMPORT_PROCESS_DEFINITION_NOTES=import process definition RELEASE_PROCESS_DEFINITION_NOTES=release process definition QUERY_PROCESS_DEFINITION_BY_ID_NOTES=query process definition by id QUERY_PROCESS_DEFINITION_LIST_NOTES=query process definition list QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=query process definition list paging QUERY_ALL_DEFINITION_LIST_NOTES=query all definition list PAGE_NO=page no PROCESS_INSTANCE_ID=process instance id PROCESS_INSTANCE_JSON=process instance info(json format) SCHEDULE_TIME=schedule time SYNC_DEFINE=update the information of the process instance to the process definition RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance PREVIEW_SCHEDULE_NOTES=preview schedule SEARCH_VAL=search val USER_ID=user id FORCE_TASK_SUCCESS=force task success QUERY_TASK_INSTANCE_LIST_PAGING_NOTES=query task instance list paging PROCESS_INSTANCE_NAME=process instance name TASK_INSTANCE_ID=task instance id VERIFY_TENANT_CODE_NOTES=verify tenant code QUERY_UI_PLUGIN_DETAIL_BY_ID=query ui plugin detail by id PLUGIN_ID=plugin id QUERY_UI_PLUGINS_BY_TYPE=query ui plugins by type ACTIVATE_USER_NOTES=active user BATCH_ACTIVATE_USER_NOTES=batch active user STATE=state REPEAT_PASSWORD=repeat password REGISTER_USER_NOTES=register user USER_NAMES=user names PAGE_SIZE=page size LIMIT=limit CREATE_WORKER_GROUP_NOTES=create worker group WORKER_ADDR_LIST=worker address list QUERY_WORKER_ADDRESS_LIST_NOTES=query worker address list QUERY_WORKFLOW_LINEAGE_BY_IDS_NOTES=query workflow lineage by ids QUERY_WORKFLOW_LINEAGE_BY_NAME_NOTES=query workflow lineage by name VIEW_TREE_NOTES=view tree UDF_ID=udf id GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id GET_NODE_LIST_BY_DEFINITION_CODE_NOTES=get node list by definition code QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=query process definition by name PROCESS_DEFINITION_ID_LIST=process definition id list QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=query process definition all by project id DELETE_PROCESS_DEFINITION_BY_ID_NOTES=delete process definition by process definition id BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=batch delete process definition by process definition ids BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_NOTES=batch delete process instance by process ids QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id TASK_ID=task instance id PROCESS_INSTANCE_IDS=process_instance ids SKIP_LINE_NUM=skip line num QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log USERS_TAG=users related operation SCHEDULER_TAG=scheduler related operation CREATE_SCHEDULE_NOTES=create schedule CREATE_USER_NOTES=create user TENANT_ID=tenant id QUEUE=queue EMAIL=email PHONE=phone QUERY_USER_LIST_NOTES=query user list UPDATE_USER_NOTES=update user UPDATE_QUEUE_NOTES=update queue DELETE_USER_BY_ID_NOTES=delete user by id GRANT_PROJECT_NOTES=GRANT PROJECT PROJECT_IDS=project ids(string format, multiple projects separated by ",") GRANT_PROJECT_BY_CODE_NOTES=GRANT PROJECT BY CODE REVOKE_PROJECT_NOTES=REVOKE PROJECT FOR USER PROJECT_CODE=project codes GRANT_RESOURCE_NOTES=grant resource file RESOURCE_IDS=resource ids(string format, multiple resources separated by ",") GET_USER_INFO_NOTES=get user info LIST_USER_NOTES=list user VERIFY_USER_NAME_NOTES=verify user name UNAUTHORIZED_USER_NOTES=cancel authorization ALERT_GROUP_ID=alert group id AUTHORIZED_USER_NOTES=authorized user AUTHORIZE_RESOURCE_TREE_NOTES=authorize resource tree RESOURCE_CURRENTDIR=dir of the current resource QUERY_RESOURCE_LIST_PAGING_NOTES=query resource list paging RESOURCE_PID=parent directory ID of the current resource RESOURCE_FULL_NAME=resource full name QUERY_BY_RESOURCE_NAME=query by resource name QUERY_UDF_FUNC_LIST_NOTES=query udf funciton list VERIFY_RESOURCE_NAME_NOTES=verify resource name GRANT_UDF_FUNC_NOTES=grant udf function UDF_IDS=udf ids(string format, multiple udf functions separated by ",") GRANT_DATASOURCE_NOTES=grant datasource DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",") QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=query process instance global variables and local variables VIEW_GANTT_NOTES=view gantt SUB_PROCESS_INSTANCE_ID=sub process instance id TASK_NAME=task instance name TASK_INSTANCE_TAG=task instance related operation LOGGER_TAG=log related operation PROCESS_INSTANCE_TAG=process instance related operation EXECUTION_STATUS=runing status for workflow and task nodes HOST=ip address of running task START_DATE=start date END_DATE=end date QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id UPDATE_DATA_SOURCE_NOTES=update data source DATA_SOURCE_ID=DATA SOURCE ID QUERY_DATA_SOURCE_NOTES=query data source by id QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test DELETE_DATA_SOURCE_NOTES=delete data source VERIFY_DATA_SOURCE_NOTES=verify data source UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source AUTHORIZED_DATA_SOURCE_NOTES=authorized data source DELETE_SCHEDULER_BY_ID_NOTES=delete scheduler by id QUERY_ALERT_GROUP_LIST_PAGING_NOTES=query alert group list paging EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=export process definition by id BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES=batch export process definition by ids QUERY_USER_CREATED_PROJECT_NOTES=query user created project QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES=query authorized and user created project COPY_PROCESS_DEFINITION_NOTES=copy process definition notes MOVE_PROCESS_DEFINITION_NOTES=move process definition notes TARGET_PROJECT_ID=target project id IS_COPY=is copy DELETE_PROCESS_DEFINITION_VERSION_NOTES=delete process definition version QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=query process definition versions SWITCH_PROCESS_DEFINITION_VERSION_NOTES=switch process definition version VERSION=version
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=查询定时列表 PROCESS_INSTANCE_EXECUTOR_TAG=流程实例执行相关操作 UI_PLUGINS_TAG=UI插件相关操作 WORK_FLOW_LINEAGE_TAG=工作流血缘相关操作 RUN_PROCESS_INSTANCE_NOTES=运行流程实例 START_NODE_LIST=开始节点列表(节点name) TASK_DEPEND_TYPE=任务依赖类型 COMMAND_TYPE=指令类型 RUN_MODE=运行模式 TIMEOUT=超时时间 EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=执行流程实例的各种操作(暂停、停止、重跑、恢复等) EXECUTE_TYPE=执行类型 EXECUTOR_TAG=流程相关操作 EXECUTOR_NAME=流程名称 START_CHECK_PROCESS_DEFINITION_NOTES=检查流程定义 DESC=备注(描述) GROUP_NAME=组名称 WORKER_GROUP=worker群组 startParams=启动参数 GROUP_TYPE=组类型 QUERY_ALERT_GROUP_LIST_NOTES=告警组列表 UPDATE_ALERT_GROUP_NOTES=编辑(更新)告警组 DELETE_ALERT_GROUP_BY_ID_NOTES=通过ID删除告警组 VERIFY_ALERT_GROUP_NAME_NOTES=检查告警组是否存在 GRANT_ALERT_GROUP_NOTES=授权告警组 PROCESS_DEFINITION_IDS=流程定义ID PROCESS_DEFINITION_CODE=流程定义编码 PROCESS_DEFINITION_CODE_LIST=流程定义编码列表 USER_IDS=用户ID列表 ALERT_GROUP_TAG=告警组相关操作 WORKER_GROUP_TAG=Worker分组管理 SAVE_WORKER_GROUP_NOTES=创建Worker分组 ALERT_PLUGIN_INSTANCE_TAG=告警插件实例相关操作 WORKER_GROUP_NAME=Worker分组名称 WORKER_IP_LIST=Worker ip列表,注意:多个IP地址以逗号分割 QUERY_WORKER_GROUP_PAGING_NOTES=Worker分组管理 QUERY_WORKER_GROUP_LIST_NOTES=查询worker group分组 DELETE_WORKER_GROUP_BY_ID_NOTES=通过ID删除worker group DATA_ANALYSIS_TAG=任务状态分析相关操作 COUNT_TASK_STATE_NOTES=任务状态统计 COUNT_PROCESS_INSTANCE_NOTES=统计流程实例状态 COUNT_PROCESS_DEFINITION_BY_USER_NOTES=统计用户创建的流程定义 COUNT_COMMAND_STATE_NOTES=统计命令状态 COUNT_QUEUE_STATE_NOTES=统计队列里任务状态 ACCESS_TOKEN_TAG=访问token相关操作 MONITOR_TAG=监控相关操作 MASTER_LIST_NOTES=master服务列表 WORKER_LIST_NOTES=worker服务列表 QUERY_DATABASE_STATE_NOTES=查询数据库状态 QUERY_ZOOKEEPER_STATE_NOTES=查询Zookeeper状态 TASK_STATE=任务实例状态 SOURCE_TABLE=源表 DEST_TABLE=目标表 TASK_DATE=任务时间 QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=分页查询历史任务记录列表 DATA_SOURCE_TAG=数据源相关操作 CREATE_DATA_SOURCE_NOTES=创建数据源 DATA_SOURCE_NAME=数据源名称 DATA_SOURCE_NOTE=数据源描述 DB_TYPE=数据源类型 DATA_SOURCE_HOST=IP主机名 DATA_SOURCE_PORT=数据源端口 DATABASE_NAME=数据库名 QUEUE_TAG=队列相关操作 QUERY_TOPN_LONGEST_RUNNING_PROCESS_INSTANCE_NOTES=查询topN最长运行流程实例 QUERY_QUEUE_LIST_NOTES=查询队列列表 QUERY_QUEUE_LIST_PAGING_NOTES=分页查询队列列表 CREATE_QUEUE_NOTES=创建队列 YARN_QUEUE_NAME=hadoop yarn队列名 QUEUE_ID=队列ID TENANT_DESC=租户描述 QUERY_TENANT_LIST_PAGING_NOTES=分页查询租户列表 QUERY_TENANT_LIST_NOTES=查询租户列表 UPDATE_TENANT_NOTES=更新租户 DELETE_TENANT_NOTES=删除租户 RESOURCES_TAG=资源中心相关操作 CREATE_RESOURCE_NOTES=创建资源 RESOURCE_FULL_NAME=资源全名 RESOURCE_TYPE=资源文件类型 RESOURCE_NAME=资源文件名称 RESOURCE_DESC=资源文件描述 RESOURCE_FILE=资源文件 RESOURCE_ID=资源ID QUERY_RESOURCE_LIST_NOTES=查询资源列表 QUERY_BY_RESOURCE_NAME=通过资源名称查询 QUERY_UDF_FUNC_LIST_NOTES=查询UDF函数列表 VERIFY_RESOURCE_NAME_NOTES=验证资源名称 DELETE_RESOURCE_BY_ID_NOTES=通过ID删除资源 VIEW_RESOURCE_BY_ID_NOTES=通过ID浏览资源 ONLINE_CREATE_RESOURCE_NOTES=在线创建资源 SUFFIX=资源文件后缀 CONTENT=资源文件内容 UPDATE_RESOURCE_NOTES=在线更新资源文件 DOWNLOAD_RESOURCE_NOTES=下载资源文件 CREATE_UDF_FUNCTION_NOTES=创建UDF函数 UDF_TYPE=UDF类型 FUNC_NAME=函数名称 CLASS_NAME=包名类名 ARG_TYPES=参数 UDF_DESC=udf描述,使用说明 VIEW_UDF_FUNCTION_NOTES=查看udf函数 UPDATE_UDF_FUNCTION_NOTES=更新udf函数 QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=分页查询udf函数列表 VERIFY_UDF_FUNCTION_NAME_NOTES=验证udf函数名 DELETE_UDF_FUNCTION_NOTES=删除UDF函数 AUTHORIZED_FILE_NOTES=授权文件 UNAUTHORIZED_FILE_NOTES=取消授权文件 AUTHORIZED_UDF_FUNC_NOTES=授权udf函数 UNAUTHORIZED_UDF_FUNC_NOTES=取消udf函数授权 VERIFY_QUEUE_NOTES=验证队列 TENANT_TAG=租户相关操作 CREATE_TENANT_NOTES=创建租户 TENANT_CODE=操作系统租户 QUEUE_NAME=队列名 PASSWORD=密码 DATA_SOURCE_OTHER=jdbc连接参数,格式为:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=kerberos认证参数 java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=kerberos认证参数 login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=kerberos认证参数 login.user.keytab.path PROJECT_TAG=项目相关操作 CREATE_PROJECT_NOTES=创建项目 PROJECT_DESC=项目描述 UPDATE_PROJECT_NOTES=更新项目 PROJECT_ID=项目ID QUERY_PROJECT_BY_ID_NOTES=通过项目ID查询项目信息 QUERY_PROJECT_LIST_PAGING_NOTES=分页查询项目列表 QUERY_ALL_PROJECT_LIST_NOTES=查询所有项目 DELETE_PROJECT_BY_ID_NOTES=通过ID删除项目 QUERY_UNAUTHORIZED_PROJECT_NOTES=查询未授权的项目 QUERY_AUTHORIZED_PROJECT_NOTES=查询授权项目 QUERY_AUTHORIZED_USER_NOTES=查询拥有项目授权的用户 TASK_RECORD_TAG=任务记录相关操作 QUERY_TASK_RECORD_LIST_PAGING_NOTES=分页查询任务记录列表 CREATE_TOKEN_NOTES=创建token,注意需要先登录 QUERY_ACCESS_TOKEN_LIST_NOTES=分页查询access token列表 QUERY_ACCESS_TOKEN_BY_USER_NOTES=查询指定用户的access token SCHEDULE=定时 WARNING_TYPE=发送策略 WARNING_GROUP_ID=发送组ID FAILURE_STRATEGY=失败策略 RECEIVERS=收件人 RECEIVERS_CC=收件人(抄送) WORKER_GROUP_ID=Worker Server分组ID PROCESS_INSTANCE_PRIORITY=流程实例优先级 EXPECTED_PARALLELISM_NUMBER=补数任务自定义并行度 UPDATE_SCHEDULE_NOTES=更新定时 SCHEDULE_ID=定时ID ONLINE_SCHEDULE_NOTES=定时上线 OFFLINE_SCHEDULE_NOTES=定时下线 QUERY_SCHEDULE_NOTES=查询定时 QUERY_SCHEDULE_LIST_PAGING_NOTES=分页查询定时 LOGIN_TAG=用户登录相关操作 USER_NAME=用户名 PROJECT_NAME=项目名称 CREATE_PROCESS_DEFINITION_NOTES=创建流程定义 PROCESS_INSTANCE_START_TIME=流程实例启动时间 PROCESS_INSTANCE_END_TIME=流程实例结束时间 PROCESS_INSTANCE_SIZE=流程实例个数 PROCESS_DEFINITION_NAME=流程定义名称 PROCESS_DEFINITION_JSON=流程定义详细信息(json格式) PROCESS_DEFINITION_LOCATIONS=流程定义节点坐标位置信息(json格式) PROCESS_INSTANCE_LOCATIONS=流程实例节点坐标位置信息(json格式) PROCESS_DEFINITION_CONNECTS=流程定义节点图标连接信息(json格式) PROCESS_INSTANCE_CONNECTS=流程实例节点图标连接信息(json格式) PROCESS_DEFINITION_DESC=流程定义描述信息 PROCESS_DEFINITION_TAG=流程定义相关操作 SIGNOUT_NOTES=退出登录 USER_PASSWORD=用户密码 UPDATE_PROCESS_INSTANCE_NOTES=更新流程实例 QUERY_PROCESS_INSTANCE_LIST_NOTES=查询流程实例列表 VERIFY_PROCESS_DEFINITION_NAME_NOTES=验证流程定义名字 LOGIN_NOTES=用户登录 UPDATE_PROCESS_DEFINITION_NOTES=更新流程定义 PROCESS_DEFINITION_ID=流程定义ID RELEASE_PROCESS_DEFINITION_NOTES=发布流程定义 QUERY_PROCESS_DEFINITION_BY_ID_NOTES=通过流程定义ID查询流程定义 QUERY_PROCESS_DEFINITION_LIST_NOTES=查询流程定义列表 QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=分页查询流程定义列表 QUERY_ALL_DEFINITION_LIST_NOTES=查询所有流程定义 PAGE_NO=页码号 PROCESS_INSTANCE_ID=流程实例ID PROCESS_INSTANCE_IDS=流程实例ID集合 PROCESS_INSTANCE_JSON=流程实例信息(json格式) PREVIEW_SCHEDULE_NOTES=定时调度预览 SCHEDULE_TIME=定时时间 SYNC_DEFINE=更新流程实例的信息是否同步到流程定义 RECOVERY_PROCESS_INSTANCE_FLAG=是否恢复流程实例 SEARCH_VAL=搜索值 FORCE_TASK_SUCCESS=强制TASK成功 QUERY_TASK_INSTANCE_LIST_PAGING_NOTES=分页查询任务实例列表 PROCESS_INSTANCE_NAME=流程实例名称 TASK_INSTANCE_ID=任务实例ID VERIFY_TENANT_CODE_NOTES=验证租户 QUERY_UI_PLUGIN_DETAIL_BY_ID=通过ID查询UI插件详情 QUERY_UI_PLUGINS_BY_TYPE=通过类型查询UI插件 ACTIVATE_USER_NOTES=激活用户 BATCH_ACTIVATE_USER_NOTES=批量激活用户 REPEAT_PASSWORD=重复密码 REGISTER_USER_NOTES=用户注册 STATE=状态 USER_NAMES=多个用户名 PLUGIN_ID=插件ID USER_ID=用户ID PAGE_SIZE=页大小 LIMIT=显示多少条 UDF_ID=udf ID AUTHORIZE_RESOURCE_TREE_NOTES=授权资源树 RESOURCE_CURRENTDIR=当前资源目录 RESOURCE_PID=资源父目录ID QUERY_RESOURCE_LIST_PAGING_NOTES=分页查询资源列表 VIEW_TREE_NOTES=树状图 IMPORT_PROCESS_DEFINITION_NOTES=导入流程定义 GET_NODE_LIST_BY_DEFINITION_ID_NOTES=通过流程定义ID获得任务节点列表 PROCESS_DEFINITION_ID_LIST=流程定义id列表 QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=通过项目ID查询流程定义 BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=通过流程定义ID集合批量删除流程定义 BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_NOTES=通过流程实例ID集合批量删除流程实例 DELETE_PROCESS_DEFINITION_BY_ID_NOTES=通过流程定义ID删除流程定义 QUERY_PROCESS_INSTANCE_BY_ID_NOTES=通过流程实例ID查询流程实例 DELETE_PROCESS_INSTANCE_BY_ID_NOTES=通过流程实例ID删除流程实例 TASK_ID=任务实例ID SKIP_LINE_NUM=忽略行数 QUERY_TASK_INSTANCE_LOG_NOTES=查询任务实例日志 DOWNLOAD_TASK_INSTANCE_LOG_NOTES=下载任务实例日志 USERS_TAG=用户相关操作 SCHEDULER_TAG=定时相关操作 CREATE_SCHEDULE_NOTES=创建定时 CREATE_USER_NOTES=创建用户 CREATE_WORKER_GROUP_NOTES=创建Worker分组 WORKER_ADDR_LIST=worker地址列表 QUERY_WORKER_ADDRESS_LIST_NOTES=查询worker地址列表 QUERY_WORKFLOW_LINEAGE_BY_IDS_NOTES=通过IDs查询工作流血缘列表 QUERY_WORKFLOW_LINEAGE_BY_NAME_NOTES=通过名称查询工作流血缘列表 TENANT_ID=租户ID QUEUE=使用的队列 EMAIL=邮箱 PHONE=手机号 QUERY_USER_LIST_NOTES=查询用户列表 UPDATE_USER_NOTES=更新用户 UPDATE_QUEUE_NOTES=更新队列 DELETE_USER_BY_ID_NOTES=删除用户通过ID GRANT_PROJECT_NOTES=授权项目 PROJECT_IDS=项目IDS(字符串格式,多个项目以","分割) GRANT_PROJECT_BY_CODE_NOTES=授权项目 REVOKE_PROJECT_NOTES=撤销用户的项目权限 PROJECT_CODE=项目Code GRANT_RESOURCE_NOTES=授权资源文件 RESOURCE_IDS=资源ID列表(字符串格式,多个资源ID以","分割) GET_USER_INFO_NOTES=获取用户信息 GET_NODE_LIST_BY_DEFINITION_CODE_NOTES=通过流程定义编码查询节点列表 QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=通过名称查询流程定义 LIST_USER_NOTES=用户列表 VERIFY_USER_NAME_NOTES=验证用户名 UNAUTHORIZED_USER_NOTES=取消授权 ALERT_GROUP_ID=报警组ID AUTHORIZED_USER_NOTES=授权用户 GRANT_UDF_FUNC_NOTES=授权udf函数 UDF_IDS=udf函数id列表(字符串格式,多个udf函数ID以","分割) GRANT_DATASOURCE_NOTES=授权数据源 DATASOURCE_IDS=数据源ID列表(字符串格式,多个数据源ID以","分割) QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=通过任务实例ID查询子流程实例 QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=通过子流程实例ID查询父流程实例信息 QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=查询流程实例全局变量和局部变量 VIEW_GANTT_NOTES=浏览Gantt图 SUB_PROCESS_INSTANCE_ID=子流程实例ID TASK_NAME=任务实例名 TASK_INSTANCE_TAG=任务实例相关操作 LOGGER_TAG=日志相关操作 PROCESS_INSTANCE_TAG=流程实例相关操作 EXECUTION_STATUS=工作流和任务节点的运行状态 HOST=运行任务的主机IP地址 START_DATE=开始时间 END_DATE=结束时间 QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=通过流程实例ID查询任务列表 DELETE_ALERT_PLUGIN_INSTANCE_NOTES=删除告警插件实例 CREATE_ALERT_PLUGIN_INSTANCE_NOTES=创建告警插件实例 GET_ALERT_PLUGIN_INSTANCE_NOTES=查询告警插件实例 QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES=分页查询告警实例列表 QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES=查询所有告警实例列表 UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=更新告警插件实例 ALERT_PLUGIN_INSTANCE_NAME=告警插件实例名称 ALERT_PLUGIN_DEFINE_ID=告警插件定义ID ALERT_PLUGIN_ID=告警插件ID ALERT_PLUGIN_INSTANCE_ID=告警插件实例ID ALERT_PLUGIN_INSTANCE_PARAMS=告警插件实例参数 ALERT_INSTANCE_NAME=告警插件名称 VERIFY_ALERT_INSTANCE_NAME_NOTES=验证告警插件名称 UPDATE_DATA_SOURCE_NOTES=更新数据源 DATA_SOURCE_PARAM=数据源参数 DATA_SOURCE_ID=数据源ID CREATE_ALERT_GROUP_NOTES=创建告警组 QUERY_DATA_SOURCE_NOTES=查询数据源通过ID QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=通过数据源类型查询数据源列表 QUERY_DATA_SOURCE_LIST_PAGING_NOTES=分页查询数据源列表 CONNECT_DATA_SOURCE_NOTES=连接数据源 CONNECT_DATA_SOURCE_TEST_NOTES=连接数据源测试 DELETE_DATA_SOURCE_NOTES=删除数据源 VERIFY_DATA_SOURCE_NOTES=验证数据源 UNAUTHORIZED_DATA_SOURCE_NOTES=未授权的数据源 AUTHORIZED_DATA_SOURCE_NOTES=授权的数据源 DELETE_SCHEDULER_BY_ID_NOTES=根据定时id删除定时数据 QUERY_ALERT_GROUP_LIST_PAGING_NOTES=分页查询告警组列表 EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=通过工作流ID导出工作流定义 BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES=批量导出工作流定义 QUERY_USER_CREATED_PROJECT_NOTES=查询用户创建的项目 QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES=查询授权和用户创建的项目 COPY_PROCESS_DEFINITION_NOTES=复制工作流定义 MOVE_PROCESS_DEFINITION_NOTES=移动工作流定义 TARGET_PROJECT_ID=目标项目ID IS_COPY=是否复制 DELETE_PROCESS_DEFINITION_VERSION_NOTES=删除流程历史版本 QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=查询流程历史版本信息 SWITCH_PROCESS_DEFINITION_VERSION_NOTES=切换流程版本 VERSION=版本号
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AccessTokenControllerTest.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.api.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * access token controller test */ public class AccessTokenControllerTest extends AbstractControllerTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenControllerTest.class); @Test public void testCreateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "607f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testExceptionHandler() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "-1"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "507f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.CREATE_ACCESS_TOKEN_ERROR.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testGenerateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-28 00:00:00"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens/generate") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenList() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("pageNo", "1"); paramsMap.add("pageSize", "20"); paramsMap.add("searchVal", ""); MvcResult mvcResult = mockMvc.perform(get("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenByUser() throws Exception { MvcResult mvcResult = this.mockMvc .perform(get("/access-tokens/user/1") .header("sessionId", this.sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testDelAccessTokenById() throws Exception { testCreateToken(); MvcResult mvcResult = mockMvc.perform(delete("/access-tokens/1") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testUpdateToken() throws Exception { testCreateToken(); MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-20 00:00:00"); paramsMap.add("token", "cxctoken123update"); MvcResult mvcResult = mockMvc.perform(put("/access-tokens/1") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,401
[Feature][dolphinscheduler-api] Built GenerateToken into the CreateToken API
### 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 If CreateToken does not explicitly specify a Token, then GenerateToken is built into the CreateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7401
https://github.com/apache/dolphinscheduler/pull/7404
1f1edb2f23d5a93b2d80f5caf521ea43a81bc374
14343864bf5b840cc297365463300896dcb1ef96
"2021-12-14T08:18:27Z"
java
"2021-12-14T09:54:35Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.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.api.service; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.AccessTokenServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; import org.assertj.core.util.Lists; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service test */ @RunWith(MockitoJUnitRunner.class) public class AccessTokenServiceTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceTest.class); @InjectMocks private AccessTokenServiceImpl accessTokenService; @Mock private AccessTokenMapper accessTokenMapper; @Test @SuppressWarnings("unchecked") public void testQueryAccessTokenList() { IPage<AccessToken> tokenPage = new Page<>(); tokenPage.setRecords(getList()); tokenPage.setTotal(1L); when(accessTokenMapper.selectAccessTokenPage(any(Page.class), eq("zhangsan"), eq(0))).thenReturn(tokenPage); User user = new User(); Result result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10); PageInfo<AccessToken> pageInfo = (PageInfo<AccessToken>) result.getData(); logger.info(result.toString()); Assert.assertTrue(pageInfo.getTotal() > 0); } @Test public void testQueryAccessTokenByUser() { List<AccessToken> accessTokenList = Lists.newArrayList(this.getEntity()); Mockito.when(this.accessTokenMapper.queryAccessTokenByUser(1)).thenReturn(accessTokenList); // USER_NO_OPERATION_PERM User user = this.getLoginUser(); user.setUserType(UserType.GENERAL_USER); Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); // SUCCESS user.setUserType(UserType.ADMIN_USER); result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCreateToken() { when(accessTokenMapper.insert(any(AccessToken.class))).thenReturn(2); Map<String, Object> result = accessTokenService.createToken(getLoginUser(), 1, getDate(), "AccessTokenServiceTest"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testGenerateToken() { Map<String, Object> result = accessTokenService.generateToken(getLoginUser(), Integer.MAX_VALUE,getDate()); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); String token = (String) result.get(Constants.DATA_LIST); Assert.assertNotNull(token); } @Test public void testDelAccessTokenById() { when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); User userLogin = new User(); // not exist Map<String, Object> result = accessTokenService.delAccessTokenById(userLogin, 0); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); // no operate result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); //success userLogin.setId(1); userLogin.setUserType(UserType.ADMIN_USER); result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testUpdateToken() { when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); Map<String, Object> result = accessTokenService.updateToken(getLoginUser(), 1,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // not exist result = accessTokenService.updateToken(getLoginUser(), 2,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); } private User getLoginUser() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); return loginUser; } /** * create entity */ private AccessToken getEntity() { AccessToken accessToken = new AccessToken(); accessToken.setId(1); accessToken.setUserId(1); accessToken.setToken("AccessTokenServiceTest"); Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); accessToken.setExpireTime(date); return accessToken; } /** * entity list */ private List<AccessToken> getList() { List<AccessToken> list = new ArrayList<>(); list.add(getEntity()); return list; } /** * get dateStr */ private String getDate() { Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); return DateUtils.dateToString(date); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,386
[Bug] [python] Task type procedure have bad param name
### 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 In https://github.com/apache/dolphinscheduler/pull/7279#issuecomment-992407008 @devosend find we have a wrong parameter in procedure task type. It would cause error when submit process definition or task definition ### What you expected to happen Should not cause error ### How to reproduce Just submit task to java gateway ### Anything else _No response_ ### 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/7386
https://github.com/apache/dolphinscheduler/pull/7407
7e0010de3548009acf8f3a57dd59d6d0343f5613
4988004150e3c8c264c0be027535bbcfdfd05d7c
"2021-12-14T02:09:40Z"
java
"2021-12-15T02:19:32Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/database.py
# 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. """Task database base task.""" from typing import Dict from pydolphinscheduler.core.task import Task from pydolphinscheduler.java_gateway import launch_gateway class Database(Task): """Base task to handle database, declare behavior for the base handler of database. It a parent class for all database task of dolphinscheduler. And it should run sql like job in multiply sql lik engine, such as: - ClickHouse - DB2 - HIVE - MySQL - Oracle - Postgresql - Presto - SQLServer You provider datasource_name contain connection information, it decisions which database type and database instance would run this sql. """ _task_custom_attr = {"sql"} def __init__( self, task_type: str, name: str, datasource_name: str, sql: str, *args, **kwargs ): super().__init__(name, task_type, *args, **kwargs) self.datasource_name = datasource_name self.sql = sql self._datasource = {} def get_datasource_type(self) -> str: """Get datasource type from java gateway, a wrapper for :func:`get_datasource_info`.""" return self.get_datasource_info(self.datasource_name).get("type") def get_datasource_id(self) -> str: """Get datasource id from java gateway, a wrapper for :func:`get_datasource_info`.""" return self.get_datasource_info(self.datasource_name).get("id") def get_datasource_info(self, name) -> Dict: """Get datasource info from java gateway, contains datasource id, type, name.""" if self._datasource: return self._datasource else: gateway = launch_gateway() self._datasource = gateway.entry_point.getDatasourceInfo(name) return self._datasource @property def task_params(self, camel_attr: bool = True, custom_attr: set = None) -> Dict: """Override Task.task_params for sql task. Sql task have some specials attribute for task_params, and is odd if we directly set as python property, so we Override Task.task_params here. """ params = super().task_params custom_params = { "type": self.get_datasource_type(), "datasource": self.get_datasource_id(), } params.update(custom_params) return params
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,386
[Bug] [python] Task type procedure have bad param name
### 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 In https://github.com/apache/dolphinscheduler/pull/7279#issuecomment-992407008 @devosend find we have a wrong parameter in procedure task type. It would cause error when submit process definition or task definition ### What you expected to happen Should not cause error ### How to reproduce Just submit task to java gateway ### Anything else _No response_ ### 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/7386
https://github.com/apache/dolphinscheduler/pull/7407
7e0010de3548009acf8f3a57dd59d6d0343f5613
4988004150e3c8c264c0be027535bbcfdfd05d7c
"2021-12-14T02:09:40Z"
java
"2021-12-15T02:19:32Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/procedure.py
# 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. """Task procedure.""" from pydolphinscheduler.constants import TaskType from pydolphinscheduler.tasks.database import Database class Procedure(Database): """Task Procedure object, declare behavior for Procedure task to dolphinscheduler. It should run database procedure job in multiply sql lik engine, such as: - ClickHouse - DB2 - HIVE - MySQL - Oracle - Postgresql - Presto - SQLServer You provider datasource_name contain connection information, it decisions which database type and database instance would run this sql. """ def __init__(self, name: str, datasource_name: str, sql: str, *args, **kwargs): super().__init__( TaskType.PROCEDURE, name, datasource_name, sql, *args, **kwargs )
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,386
[Bug] [python] Task type procedure have bad param name
### 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 In https://github.com/apache/dolphinscheduler/pull/7279#issuecomment-992407008 @devosend find we have a wrong parameter in procedure task type. It would cause error when submit process definition or task definition ### What you expected to happen Should not cause error ### How to reproduce Just submit task to java gateway ### Anything else _No response_ ### 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/7386
https://github.com/apache/dolphinscheduler/pull/7407
7e0010de3548009acf8f3a57dd59d6d0343f5613
4988004150e3c8c264c0be027535bbcfdfd05d7c
"2021-12-14T02:09:40Z"
java
"2021-12-15T02:19:32Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/sql.py
# 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. """Task sql.""" import re from typing import Optional from pydolphinscheduler.constants import TaskType from pydolphinscheduler.tasks.database import Database class SqlType: """SQL type, for now it just contain `SELECT` and `NO_SELECT`.""" SELECT = 0 NOT_SELECT = 1 class Sql(Database): """Task SQL object, declare behavior for SQL task to dolphinscheduler. It should run sql job in multiply sql lik engine, such as: - ClickHouse - DB2 - HIVE - MySQL - Oracle - Postgresql - Presto - SQLServer You provider datasource_name contain connection information, it decisions which database type and database instance would run this sql. """ _task_custom_attr = { "sql", "sql_type", "pre_statements", "post_statements", "display_rows", } def __init__( self, name: str, datasource_name: str, sql: str, pre_statements: Optional[str] = None, post_statements: Optional[str] = None, display_rows: Optional[int] = 10, *args, **kwargs ): super().__init__(TaskType.SQL, name, datasource_name, sql, *args, **kwargs) self.pre_statements = pre_statements or [] self.post_statements = post_statements or [] self.display_rows = display_rows @property def sql_type(self) -> int: """Judgement sql type, use regexp to check which type of the sql is.""" pattern_select_str = ( "^(?!(.* |)insert |(.* |)delete |(.* |)drop |(.* |)update |(.* |)alter ).*" ) pattern_select = re.compile(pattern_select_str, re.IGNORECASE) if pattern_select.match(self.sql) is None: return SqlType.NOT_SELECT else: return SqlType.SELECT
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,386
[Bug] [python] Task type procedure have bad param name
### 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 In https://github.com/apache/dolphinscheduler/pull/7279#issuecomment-992407008 @devosend find we have a wrong parameter in procedure task type. It would cause error when submit process definition or task definition ### What you expected to happen Should not cause error ### How to reproduce Just submit task to java gateway ### Anything else _No response_ ### 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/7386
https://github.com/apache/dolphinscheduler/pull/7407
7e0010de3548009acf8f3a57dd59d6d0343f5613
4988004150e3c8c264c0be027535bbcfdfd05d7c
"2021-12-14T02:09:40Z"
java
"2021-12-15T02:19:32Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_database.py
# 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. """Test Task Database.""" from unittest.mock import patch import pytest from pydolphinscheduler.tasks.database import Database TEST_DATABASE_TASK_TYPE = "SQL" TEST_DATABASE_SQL = "select 1" TEST_DATABASE_DATASOURCE_NAME = "test_datasource" @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.database.Database.get_datasource_info", return_value=({"id": 1, "type": "mock_type"}), ) def test_get_datasource_detail(mock_datasource, mock_code_version): """Test :func:`get_datasource_type` and :func:`get_datasource_id` can return expect value.""" name = "test_get_database_detail" task = Database( TEST_DATABASE_TASK_TYPE, name, TEST_DATABASE_DATASOURCE_NAME, TEST_DATABASE_SQL ) assert 1 == task.get_datasource_id() assert "mock_type" == task.get_datasource_type() @pytest.mark.parametrize( "attr, expect", [ ( { "task_type": TEST_DATABASE_TASK_TYPE, "name": "test-task-params", "datasource_name": TEST_DATABASE_DATASOURCE_NAME, "sql": TEST_DATABASE_SQL, }, { "type": "MYSQL", "datasource": 1, "sql": TEST_DATABASE_SQL, "localParams": [], "resourceList": [], "dependence": {}, "waitStartTimeout": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, }, ) ], ) @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.database.Database.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_property_task_params(mock_datasource, mock_code_version, attr, expect): """Test task database task property.""" task = Database(**attr) assert expect == task.task_params @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.database.Database.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_database_get_define(mock_datasource, mock_code_version): """Test task database function get_define.""" name = "test_database_get_define" expect = { "code": 123, "name": name, "version": 1, "description": None, "delayTime": 0, "taskType": TEST_DATABASE_TASK_TYPE, "taskParams": { "type": "MYSQL", "datasource": 1, "sql": TEST_DATABASE_SQL, "localParams": [], "resourceList": [], "dependence": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, "waitStartTimeout": {}, }, "flag": "YES", "taskPriority": "MEDIUM", "workerGroup": "default", "failRetryTimes": 0, "failRetryInterval": 1, "timeoutFlag": "CLOSE", "timeoutNotifyStrategy": None, "timeout": 0, } task = Database( TEST_DATABASE_TASK_TYPE, name, TEST_DATABASE_DATASOURCE_NAME, TEST_DATABASE_SQL ) assert task.get_define() == expect
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,386
[Bug] [python] Task type procedure have bad param name
### 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 In https://github.com/apache/dolphinscheduler/pull/7279#issuecomment-992407008 @devosend find we have a wrong parameter in procedure task type. It would cause error when submit process definition or task definition ### What you expected to happen Should not cause error ### How to reproduce Just submit task to java gateway ### Anything else _No response_ ### 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/7386
https://github.com/apache/dolphinscheduler/pull/7407
7e0010de3548009acf8f3a57dd59d6d0343f5613
4988004150e3c8c264c0be027535bbcfdfd05d7c
"2021-12-14T02:09:40Z"
java
"2021-12-15T02:19:32Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_procedure.py
# 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. """Test Task Procedure.""" from unittest.mock import patch import pytest from pydolphinscheduler.tasks.procedure import Procedure TEST_PROCEDURE_SQL = ( 'create procedure HelloWorld() selece "hello world"; call HelloWorld();' ) TEST_PROCEDURE_DATASOURCE_NAME = "test_datasource" @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.procedure.Procedure.get_datasource_info", return_value=({"id": 1, "type": "mock_type"}), ) def test_get_datasource_detail(mock_datasource, mock_code_version): """Test :func:`get_datasource_type` and :func:`get_datasource_id` can return expect value.""" name = "test_get_datasource_detail" task = Procedure(name, TEST_PROCEDURE_DATASOURCE_NAME, TEST_PROCEDURE_SQL) assert 1 == task.get_datasource_id() assert "mock_type" == task.get_datasource_type() @pytest.mark.parametrize( "attr, expect", [ ( { "name": "test-procedure-task-params", "datasource_name": TEST_PROCEDURE_DATASOURCE_NAME, "sql": TEST_PROCEDURE_SQL, }, { "sql": TEST_PROCEDURE_SQL, "type": "MYSQL", "datasource": 1, "localParams": [], "resourceList": [], "dependence": {}, "waitStartTimeout": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, }, ) ], ) @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.procedure.Procedure.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_property_task_params(mock_datasource, mock_code_version, attr, expect): """Test task sql task property.""" task = Procedure(**attr) assert expect == task.task_params @patch( "pydolphinscheduler.core.task.Task.gen_code_and_version", return_value=(123, 1), ) @patch( "pydolphinscheduler.tasks.procedure.Procedure.get_datasource_info", return_value=({"id": 1, "type": "MYSQL"}), ) def test_sql_get_define(mock_datasource, mock_code_version): """Test task procedure function get_define.""" name = "test_procedure_get_define" expect = { "code": 123, "name": name, "version": 1, "description": None, "delayTime": 0, "taskType": "PROCEDURE", "taskParams": { "type": "MYSQL", "datasource": 1, "sql": TEST_PROCEDURE_SQL, "localParams": [], "resourceList": [], "dependence": {}, "conditionResult": {"successNode": [""], "failedNode": [""]}, "waitStartTimeout": {}, }, "flag": "YES", "taskPriority": "MEDIUM", "workerGroup": "default", "failRetryTimes": 0, "failRetryInterval": 1, "timeoutFlag": "CLOSE", "timeoutNotifyStrategy": None, "timeout": 0, } task = Procedure(name, TEST_PROCEDURE_DATASOURCE_NAME, TEST_PROCEDURE_SQL) assert task.get_define() == expect
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.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.api.controller; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_BY_USER_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.GENERATE_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ACCESS_TOKEN_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; /** * access token controller */ @Api(tags = "ACCESS_TOKEN_TAG") @RestController @RequestMapping("/access-tokens") public class AccessTokenController extends BaseController { @Autowired private AccessTokenService accessTokenService; /** * create token * * @param loginUser login user * @param userId token for user id * @param expireTime expire time for the token * @param token token string (if it is absent, it will be automatically generated) * @return create result state code */ @ApiOperation(value = "createToken", notes = "CREATE_TOKEN_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int"), @ApiImplicitParam(name = "expireTime", value = "EXPIRE_TIME", required = true, dataType = "String", example = "2021-12-31 00:00:00"), @ApiImplicitParam(name = "token", value = "TOKEN", required = false, dataType = "String", example = "xxxx") }) @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result createToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token", required = false) String token) { Map<String, Object> result = accessTokenService.createToken(loginUser, userId, expireTime, token); return returnDataList(result); } /** * generate token string * * @param loginUser login user * @param userId token for user * @param expireTime expire time * @return token string */ @ApiIgnore @PostMapping(value = "/generate") @ResponseStatus(HttpStatus.CREATED) @ApiException(GENERATE_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result generateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime) { Map<String, Object> result = accessTokenService.generateToken(loginUser, userId, expireTime); return returnDataList(result); } /** * query access token list paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return token list of page number and page size */ @ApiOperation(value = "queryAccessTokenList", notes = "QUERY_ACCESS_TOKEN_LIST_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("pageNo") Integer pageNo, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageSize") Integer pageSize) { Result result = checkPageParams(pageNo, pageSize); if (!result.checkResult()) { return result; } searchVal = ParameterUtils.handleEscapes(searchVal); result = accessTokenService.queryAccessTokenList(loginUser, searchVal, pageNo, pageSize); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @ApiOperation(value = "queryAccessTokenByUser", notes = "QUERY_ACCESS_TOKEN_BY_USER_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int") }) @GetMapping(value = "/user/{userId}") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_BY_USER_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("userId") Integer userId) { Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(loginUser, userId); return this.returnDataList(result); } /** * delete access token by id * * @param loginUser login user * @param id token id * @return delete result code */ @ApiIgnore @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result delAccessTokenById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id) { Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); return returnDataList(result); } /** * update token * * @param loginUser login user * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ @ApiIgnore @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token") String token) { Map<String, Object> result = accessTokenService.updateToken(loginUser, id, userId, expireTime, token); return returnDataList(result); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.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.api.service; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * access token service */ public interface AccessTokenService { /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize); /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId); /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return create result code */ Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token); /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ Map<String, Object> generateToken(User loginUser, int userId, String expireTime); /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ Map<String, Object> delAccessTokenById(User loginUser, int id); /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.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.api.service.impl; import org.apache.commons.lang3.StringUtils; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.EncryptionUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service impl */ @Service public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTokenService { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceImpl.class); @Autowired private AccessTokenMapper accessTokenMapper; /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ @Override public Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize); Page<AccessToken> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (loginUser.getUserType() == UserType.ADMIN_USER) { userId = 0; } IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, searchVal, userId); pageInfo.setTotal((int) accessTokenList.getTotal()); pageInfo.setTotalList(accessTokenList.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @Override public Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); // only admin can operate if (isNotAdmin(loginUser, result)) { return result; } // query access token for specified user List<AccessToken> accessTokenList = this.accessTokenMapper.queryAccessTokenByUser(userId); result.put(Constants.DATA_LIST, accessTokenList); this.putMsg(result, Status.SUCCESS); return result; } /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return create result code */ @SuppressWarnings("checkstyle:WhitespaceAround") @Override public Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); // 1. check permission if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } // 2. check if user is existed if (userId <= 0) { throw new IllegalArgumentException("User id should not less than or equals to 0."); } // 3. generate access token if absent if (StringUtils.isBlank(token)) { token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); } // 4. persist to the database AccessToken accessToken = new AccessToken(); accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setCreateTime(new Date()); accessToken.setUpdateTime(new Date()); int insert = accessTokenMapper.insert(accessToken); if (insert > 0) { result.put(Constants.DATA_LIST, accessToken); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR); } return result; } /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ @Override public Map<String, Object> generateToken(User loginUser, int userId, String expireTime) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } String token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); result.put(Constants.DATA_LIST, token); putMsg(result, Status.SUCCESS); return result; } /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ @Override public Map<String, Object> delAccessTokenById(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } if (!hasPerm(loginUser,accessToken.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } accessTokenMapper.deleteById(id); putMsg(result, Status.SUCCESS); return result; } /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string * @return update result code */ @Override public Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setUpdateTime(new Date()); accessTokenMapper.updateById(accessToken); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/resources/i18n/messages.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=query schedule list EXECUTE_PROCESS_TAG=execute process related operation PROCESS_INSTANCE_EXECUTOR_TAG=process instance executor related operation RUN_PROCESS_INSTANCE_NOTES=run process instance START_NODE_LIST=start node list(node name) TASK_DEPEND_TYPE=task depend type COMMAND_TYPE=command type RUN_MODE=run mode TIMEOUT=timeout EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=execute action to process instance EXECUTE_TYPE=execute type START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition GET_RECEIVER_CC_NOTES=query receiver cc DESC=description GROUP_NAME=group name GROUP_TYPE=group type QUERY_ALERT_GROUP_LIST_NOTES=query alert group list UPDATE_ALERT_GROUP_NOTES=update alert group DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not GRANT_ALERT_GROUP_NOTES=grant alert group USER_IDS=user id list ALERT_GROUP_TAG=alert group related operation ALERT_PLUGIN_INSTANCE_TAG=alert plugin instance related operation UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=update alert plugin instance operation CREATE_ALERT_PLUGIN_INSTANCE_NOTES=create alert plugin instance operation DELETE_ALERT_PLUGIN_INSTANCE_NOTES=delete alert plugin instance operation GET_ALERT_PLUGIN_INSTANCE_NOTES=get alert plugin instance operation CREATE_ALERT_GROUP_NOTES=create alert group WORKER_GROUP_TAG=worker group related operation SAVE_WORKER_GROUP_NOTES=create worker group WORKER_GROUP_NAME=worker group name WORKER_IP_LIST=worker ip list, eg. 192.168.1.1,192.168.1.2 QUERY_WORKER_GROUP_PAGING_NOTES=query worker group paging QUERY_WORKER_GROUP_LIST_NOTES=query worker group list DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id DATA_ANALYSIS_TAG=analysis related operation of task state COUNT_TASK_STATE_NOTES=count task state COUNT_PROCESS_INSTANCE_NOTES=count process instance state COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user COUNT_COMMAND_STATE_NOTES=count command state COUNT_QUEUE_STATE_NOTES=count the running status of the task in the queue\ ACCESS_TOKEN_TAG=access token related operation MONITOR_TAG=monitor related operation MASTER_LIST_NOTES=master server list WORKER_LIST_NOTES=worker server list QUERY_DATABASE_STATE_NOTES=query database state QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE TASK_STATE=task instance state SOURCE_TABLE=SOURCE TABLE DEST_TABLE=dest table TASK_DATE=task date QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging DATA_SOURCE_TAG=data source related operation CREATE_DATA_SOURCE_NOTES=create data source DATA_SOURCE_NAME=data source name DATA_SOURCE_NOTE=data source desc DB_TYPE=database type DATA_SOURCE_HOST=DATA SOURCE HOST DATA_SOURCE_PORT=data source port DATABASE_NAME=database name QUEUE_TAG=queue related operation QUERY_QUEUE_LIST_NOTES=query queue list QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging CREATE_QUEUE_NOTES=create queue YARN_QUEUE_NAME=yarn(hadoop) queue name QUEUE_ID=queue id TENANT_DESC=tenant desc QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging QUERY_TENANT_LIST_NOTES=query tenant list UPDATE_TENANT_NOTES=update tenant DELETE_TENANT_NOTES=delete tenant RESOURCES_TAG=resource center related operation CREATE_RESOURCE_NOTES=create resource RESOURCE_TYPE=resource file type RESOURCE_NAME=resource name RESOURCE_DESC=resource file desc RESOURCE_FILE=resource file RESOURCE_ID=resource id QUERY_RESOURCE_LIST_NOTES=query resource list DELETE_RESOURCE_BY_ID_NOTES=delete resource by id VIEW_RESOURCE_BY_ID_NOTES=view resource by id ONLINE_CREATE_RESOURCE_NOTES=online create resource SUFFIX=resource file suffix CONTENT=resource file content UPDATE_RESOURCE_NOTES=edit resource file online DOWNLOAD_RESOURCE_NOTES=download resource file CREATE_UDF_FUNCTION_NOTES=create udf function UDF_TYPE=UDF type FUNC_NAME=function name CLASS_NAME=package and class name ARG_TYPES=arguments UDF_DESC=udf desc VIEW_UDF_FUNCTION_NOTES=view udf function UPDATE_UDF_FUNCTION_NOTES=update udf function QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name DELETE_UDF_FUNCTION_NOTES=delete udf function AUTHORIZED_FILE_NOTES=authorized file UNAUTHORIZED_FILE_NOTES=unauthorized file AUTHORIZED_UDF_FUNC_NOTES=authorized udf func UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=the kerberos authentication parameter java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=the kerberos authentication parameter login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=the kerberos authentication parameter login.user.keytab.path PROJECT_TAG=project related operation CREATE_PROJECT_NOTES=create project PROJECT_DESC=project description UPDATE_PROJECT_NOTES=update project PROJECT_ID=project id QUERY_PROJECT_BY_ID_NOTES=query project info by project id QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING DELETE_PROJECT_BY_ID_NOTES=delete project by id QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project QUERY_ALL_PROJECT_LIST_NOTES=query all project list QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project QUERY_AUTHORIZED_USER_NOTES=query authorized user TASK_RECORD_TAG=task record related operation QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging CREATE_TOKEN_NOTES=create access token for specified user TOKEN=access token string, it will be automatically generated when it absent EXPIRE_TIME=expire time for the token QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging QUERY_ACCESS_TOKEN_BY_USER_NOTES=query access token for specified user SCHEDULE=schedule WARNING_TYPE=warning type(sending strategy) WARNING_GROUP_ID=warning group id FAILURE_STRATEGY=failure strategy RECEIVERS=receivers RECEIVERS_CC=receivers cc WORKER_GROUP_ID=worker server group id PROCESS_INSTANCE_PRIORITY=process instance priority UPDATE_SCHEDULE_NOTES=update schedule SCHEDULE_ID=schedule id ONLINE_SCHEDULE_NOTES=online schedule OFFLINE_SCHEDULE_NOTES=offline schedule QUERY_SCHEDULE_NOTES=query schedule QUERY_SCHEDULE_LIST_PAGING_NOTES=query schedule list paging LOGIN_TAG=User login related operations USER_NAME=user name PROJECT_NAME=project name CREATE_PROCESS_DEFINITION_NOTES=create process definition PROCESS_DEFINITION_NAME=process definition name PROCESS_DEFINITION_JSON=process definition detail info (json format) PROCESS_DEFINITION_LOCATIONS=process definition node locations info (json format) PROCESS_INSTANCE_LOCATIONS=process instance node locations info (json format) PROCESS_DEFINITION_CONNECTS=process definition node connects info (json format) PROCESS_INSTANCE_CONNECTS=process instance node connects info (json format) PROCESS_DEFINITION_DESC=process definition desc PROCESS_DEFINITION_TAG=process definition related opertation SIGNOUT_NOTES=logout USER_PASSWORD=user password UPDATE_PROCESS_INSTANCE_NOTES=update process instance QUERY_PROCESS_INSTANCE_LIST_NOTES=query process instance list VERIFY_PROCESS_DEFINITION_NAME_NOTES=verify process definition name LOGIN_NOTES=user login UPDATE_PROCESS_DEFINITION_NOTES=update process definition PROCESS_DEFINITION_ID=process definition id PROCESS_DEFINITION_IDS=process definition ids RELEASE_PROCESS_DEFINITION_NOTES=release process definition QUERY_PROCESS_DEFINITION_BY_ID_NOTES=query process definition by id QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=query process definition by name QUERY_PROCESS_DEFINITION_LIST_NOTES=query process definition list QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=query process definition list paging QUERY_ALL_DEFINITION_LIST_NOTES=query all definition list PAGE_NO=page no PROCESS_INSTANCE_ID=process instance id PROCESS_INSTANCE_JSON=process instance info(json format) SCHEDULE_TIME=schedule time SYNC_DEFINE=update the information of the process instance to the process definition\ RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance SEARCH_VAL=search val USER_ID=user id PAGE_SIZE=page size LIMIT=limit VIEW_TREE_NOTES=view tree GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id PROCESS_DEFINITION_ID_LIST=process definition id list QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=query process definition all by project id DELETE_PROCESS_DEFINITION_BY_ID_NOTES=delete process definition by process definition id BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=batch delete process definition by process definition ids QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id TASK_ID=task instance id SKIP_LINE_NUM=skip line num QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log USERS_TAG=users related operation SCHEDULER_TAG=scheduler related operation CREATE_SCHEDULE_NOTES=create schedule CREATE_USER_NOTES=create user TENANT_ID=tenant id QUEUE=queue EMAIL=email PHONE=phone QUERY_USER_LIST_NOTES=query user list UPDATE_USER_NOTES=update user DELETE_USER_BY_ID_NOTES=delete user by id GRANT_PROJECT_NOTES=GRANT PROJECT PROJECT_IDS=project ids(string format, multiple projects separated by ",") GRANT_PROJECT_BY_CODE_NOTES=GRANT PROJECT BY CODE REVOKE_PROJECT_NOTES=REVOKE PROJECT FOR USER PROJECT_CODE=project codes GRANT_RESOURCE_NOTES=grant resource file RESOURCE_IDS=resource ids(string format, multiple resources separated by ",") GET_USER_INFO_NOTES=get user info LIST_USER_NOTES=list user VERIFY_USER_NAME_NOTES=verify user name UNAUTHORIZED_USER_NOTES=cancel authorization ALERT_GROUP_ID=alert group id AUTHORIZED_USER_NOTES=authorized user GRANT_UDF_FUNC_NOTES=grant udf function UDF_IDS=udf ids(string format, multiple udf functions separated by ",") GRANT_DATASOURCE_NOTES=grant datasource DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",") QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=query process instance global variables and local variables VIEW_GANTT_NOTES=view gantt SUB_PROCESS_INSTANCE_ID=sub process instance id TASK_NAME=task instance name TASK_INSTANCE_TAG=task instance related operation LOGGER_TAG=log related operation PROCESS_INSTANCE_TAG=process instance related operation EXECUTION_STATUS=runing status for workflow and task nodes HOST=ip address of running task START_DATE=start date END_DATE=end date QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id UPDATE_DATA_SOURCE_NOTES=update data source DATA_SOURCE_ID=DATA SOURCE ID QUERY_DATA_SOURCE_NOTES=query data source by id QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test DELETE_DATA_SOURCE_NOTES=delete data source VERIFY_DATA_SOURCE_NOTES=verify data source UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source AUTHORIZED_DATA_SOURCE_NOTES=authorized data source DELETE_SCHEDULER_BY_ID_NOTES=delete scheduler by id QUERY_ALERT_GROUP_LIST_PAGING_NOTES=query alert group list paging EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=export process definition by id BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES= batch export process definition by ids QUERY_USER_CREATED_PROJECT_NOTES= query user created project QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES= query authorized and user created project COPY_PROCESS_DEFINITION_NOTES= copy process definition notes MOVE_PROCESS_DEFINITION_NOTES= move process definition notes TARGET_PROJECT_ID= target project id IS_COPY = is copy DELETE_PROCESS_DEFINITION_VERSION_NOTES=delete process definition version QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=query process definition versions SWITCH_PROCESS_DEFINITION_VERSION_NOTES=switch process definition version VERSION=version
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/resources/i18n/messages_en_US.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=query schedule list EXECUTE_PROCESS_TAG=execute process related operation PROCESS_INSTANCE_EXECUTOR_TAG=process instance executor related operation RUN_PROCESS_INSTANCE_NOTES=run process instance START_NODE_LIST=start node list(node name) TASK_DEPEND_TYPE=task depend type COMMAND_TYPE=command type RUN_MODE=run mode TIMEOUT=timeout EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=execute action to process instance EXECUTE_TYPE=execute type START_CHECK_PROCESS_DEFINITION_NOTES=start check process definition GET_RECEIVER_CC_NOTES=query receiver cc DESC=description GROUP_NAME=group name GROUP_TYPE=group type QUERY_ALERT_GROUP_LIST_NOTES=query alert group list UPDATE_ALERT_GROUP_NOTES=update alert group DELETE_ALERT_GROUP_BY_ID_NOTES=delete alert group by id VERIFY_ALERT_GROUP_NAME_NOTES=verify alert group name, check alert group exist or not GRANT_ALERT_GROUP_NOTES=grant alert group USER_IDS=user id list EXECUTOR_TAG=executor operation EXECUTOR_NAME=executor name WORKER_GROUP=work group startParams=start parameters ALERT_GROUP_TAG=alert group related operation ALERT_PLUGIN_INSTANCE_TAG=alert plugin instance related operation WORK_FLOW_LINEAGE_TAG=work flow lineage related operation UI_PLUGINS_TAG=UI plugin related operation UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=update alert plugin instance operation CREATE_ALERT_PLUGIN_INSTANCE_NOTES=create alert plugin instance operation DELETE_ALERT_PLUGIN_INSTANCE_NOTES=delete alert plugin instance operation QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES=query alert plugin instance paging QUERY_TOPN_LONGEST_RUNNING_PROCESS_INSTANCE_NOTES=query topN longest running process instance ALERT_PLUGIN_INSTANCE_NAME=alert plugin instance name ALERT_PLUGIN_DEFINE_ID=alert plugin define id ALERT_PLUGIN_ID=alert plugin id ALERT_PLUGIN_INSTANCE_ID=alert plugin instance id ALERT_PLUGIN_INSTANCE_PARAMS=alert plugin instance parameters ALERT_INSTANCE_NAME=alert instance name VERIFY_ALERT_INSTANCE_NAME_NOTES=verify alert instance name DATA_SOURCE_PARAM=datasource parameter QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES=query all alert plugin instances GET_ALERT_PLUGIN_INSTANCE_NOTES=get alert plugin instance operation CREATE_ALERT_GROUP_NOTES=create alert group WORKER_GROUP_TAG=worker group related operation SAVE_WORKER_GROUP_NOTES=create worker group WORKER_GROUP_NAME=worker group name WORKER_IP_LIST=worker ip list, eg. 192.168.1.1,192.168.1.2 QUERY_WORKER_GROUP_PAGING_NOTES=query worker group paging QUERY_WORKER_GROUP_LIST_NOTES=query worker group list DELETE_WORKER_GROUP_BY_ID_NOTES=delete worker group by id DATA_ANALYSIS_TAG=analysis related operation of task state COUNT_TASK_STATE_NOTES=count task state COUNT_PROCESS_INSTANCE_NOTES=count process instance state COUNT_PROCESS_DEFINITION_BY_USER_NOTES=count process definition by user COUNT_COMMAND_STATE_NOTES=count command state COUNT_QUEUE_STATE_NOTES=count the running status of the task in the queue\ ACCESS_TOKEN_TAG=access token related operation MONITOR_TAG=monitor related operation MASTER_LIST_NOTES=master server list WORKER_LIST_NOTES=worker server list QUERY_DATABASE_STATE_NOTES=query database state QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE TASK_STATE=task instance state SOURCE_TABLE=SOURCE TABLE DEST_TABLE=dest table TASK_DATE=task date QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging DATA_SOURCE_TAG=data source related operation CREATE_DATA_SOURCE_NOTES=create data source DATA_SOURCE_NAME=data source name DATA_SOURCE_NOTE=data source desc DB_TYPE=database type DATA_SOURCE_HOST=DATA SOURCE HOST DATA_SOURCE_PORT=data source port DATABASE_NAME=database name QUEUE_TAG=queue related operation QUERY_QUEUE_LIST_NOTES=query queue list QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging CREATE_QUEUE_NOTES=create queue YARN_QUEUE_NAME=yarn(hadoop) queue name QUEUE_ID=queue id TENANT_DESC=tenant desc QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging QUERY_TENANT_LIST_NOTES=query tenant list UPDATE_TENANT_NOTES=update tenant DELETE_TENANT_NOTES=delete tenant RESOURCES_TAG=resource center related operation CREATE_RESOURCE_NOTES=create resource RESOURCE_TYPE=resource file type RESOURCE_NAME=resource name RESOURCE_DESC=resource file desc RESOURCE_FILE=resource file RESOURCE_ID=resource id QUERY_RESOURCE_LIST_NOTES=query resource list DELETE_RESOURCE_BY_ID_NOTES=delete resource by id VIEW_RESOURCE_BY_ID_NOTES=view resource by id ONLINE_CREATE_RESOURCE_NOTES=online create resource SUFFIX=resource file suffix CONTENT=resource file content UPDATE_RESOURCE_NOTES=edit resource file online DOWNLOAD_RESOURCE_NOTES=download resource file CREATE_UDF_FUNCTION_NOTES=create udf function UDF_TYPE=UDF type FUNC_NAME=function name CLASS_NAME=package and class name ARG_TYPES=arguments UDF_DESC=udf desc VIEW_UDF_FUNCTION_NOTES=view udf function UPDATE_UDF_FUNCTION_NOTES=update udf function QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name DELETE_UDF_FUNCTION_NOTES=delete udf function AUTHORIZED_FILE_NOTES=authorized file UNAUTHORIZED_FILE_NOTES=unauthorized file AUTHORIZED_UDF_FUNC_NOTES=authorized udf func UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func VERIFY_QUEUE_NOTES=verify queue TENANT_TAG=tenant related operation CREATE_TENANT_NOTES=create tenant TENANT_CODE=os tenant code QUEUE_NAME=queue name PASSWORD=password DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=the kerberos authentication parameter java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=the kerberos authentication parameter login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=the kerberos authentication parameter login.user.keytab.path PROJECT_TAG=project related operation CREATE_PROJECT_NOTES=create project PROJECT_DESC=project description UPDATE_PROJECT_NOTES=update project PROJECT_ID=project id QUERY_PROJECT_BY_ID_NOTES=query project info by project id QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING QUERY_ALL_PROJECT_LIST_NOTES=query all project list DELETE_PROJECT_BY_ID_NOTES=delete project by id QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project QUERY_AUTHORIZED_USER_NOTES=query authorized user TASK_RECORD_TAG=task record related operation QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging CREATE_TOKEN_NOTES=create access token for specified user TOKEN=access token string, it will be automatically generated when it absent EXPIRE_TIME=expire time for the token QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging QUERY_ACCESS_TOKEN_BY_USER_NOTES=query access token for specified user SCHEDULE=schedule WARNING_TYPE=warning type(sending strategy) WARNING_GROUP_ID=warning group id FAILURE_STRATEGY=failure strategy RECEIVERS=receivers RECEIVERS_CC=receivers cc WORKER_GROUP_ID=worker server group id PROCESS_INSTANCE_START_TIME=process instance start time PROCESS_INSTANCE_END_TIME=process instance end time PROCESS_INSTANCE_SIZE=process instance size PROCESS_INSTANCE_PRIORITY=process instance priority EXPECTED_PARALLELISM_NUMBER=custom parallelism to set the complement task threads UPDATE_SCHEDULE_NOTES=update schedule SCHEDULE_ID=schedule id ONLINE_SCHEDULE_NOTES=online schedule OFFLINE_SCHEDULE_NOTES=offline schedule QUERY_SCHEDULE_NOTES=query schedule QUERY_SCHEDULE_LIST_PAGING_NOTES=query schedule list paging LOGIN_TAG=User login related operations USER_NAME=user name PROJECT_NAME=project name CREATE_PROCESS_DEFINITION_NOTES=create process definition PROCESS_DEFINITION_NAME=process definition name PROCESS_DEFINITION_JSON=process definition detail info (json format) PROCESS_DEFINITION_LOCATIONS=process definition node locations info (json format) PROCESS_INSTANCE_LOCATIONS=process instance node locations info (json format) PROCESS_DEFINITION_CONNECTS=process definition node connects info (json format) PROCESS_INSTANCE_CONNECTS=process instance node connects info (json format) PROCESS_DEFINITION_DESC=process definition desc PROCESS_DEFINITION_TAG=process definition related operation SIGNOUT_NOTES=logout USER_PASSWORD=user password UPDATE_PROCESS_INSTANCE_NOTES=update process instance QUERY_PROCESS_INSTANCE_LIST_NOTES=query process instance list VERIFY_PROCESS_DEFINITION_NAME_NOTES=verify process definition name LOGIN_NOTES=user login UPDATE_PROCESS_DEFINITION_NOTES=update process definition PROCESS_DEFINITION_ID=process definition id PROCESS_DEFINITION_IDS=process definition ids PROCESS_DEFINITION_CODE=process definition code PROCESS_DEFINITION_CODE_LIST=process definition code list IMPORT_PROCESS_DEFINITION_NOTES=import process definition RELEASE_PROCESS_DEFINITION_NOTES=release process definition QUERY_PROCESS_DEFINITION_BY_ID_NOTES=query process definition by id QUERY_PROCESS_DEFINITION_LIST_NOTES=query process definition list QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=query process definition list paging QUERY_ALL_DEFINITION_LIST_NOTES=query all definition list PAGE_NO=page no PROCESS_INSTANCE_ID=process instance id PROCESS_INSTANCE_JSON=process instance info(json format) SCHEDULE_TIME=schedule time SYNC_DEFINE=update the information of the process instance to the process definition RECOVERY_PROCESS_INSTANCE_FLAG=whether to recovery process instance PREVIEW_SCHEDULE_NOTES=preview schedule SEARCH_VAL=search val USER_ID=user id FORCE_TASK_SUCCESS=force task success QUERY_TASK_INSTANCE_LIST_PAGING_NOTES=query task instance list paging PROCESS_INSTANCE_NAME=process instance name TASK_INSTANCE_ID=task instance id VERIFY_TENANT_CODE_NOTES=verify tenant code QUERY_UI_PLUGIN_DETAIL_BY_ID=query ui plugin detail by id PLUGIN_ID=plugin id QUERY_UI_PLUGINS_BY_TYPE=query ui plugins by type ACTIVATE_USER_NOTES=active user BATCH_ACTIVATE_USER_NOTES=batch active user STATE=state REPEAT_PASSWORD=repeat password REGISTER_USER_NOTES=register user USER_NAMES=user names PAGE_SIZE=page size LIMIT=limit CREATE_WORKER_GROUP_NOTES=create worker group WORKER_ADDR_LIST=worker address list QUERY_WORKER_ADDRESS_LIST_NOTES=query worker address list QUERY_WORKFLOW_LINEAGE_BY_IDS_NOTES=query workflow lineage by ids QUERY_WORKFLOW_LINEAGE_BY_NAME_NOTES=query workflow lineage by name VIEW_TREE_NOTES=view tree UDF_ID=udf id GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id GET_NODE_LIST_BY_DEFINITION_CODE_NOTES=get node list by definition code QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=query process definition by name PROCESS_DEFINITION_ID_LIST=process definition id list QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=query process definition all by project id DELETE_PROCESS_DEFINITION_BY_ID_NOTES=delete process definition by process definition id BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=batch delete process definition by process definition ids BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_NOTES=batch delete process instance by process ids QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id TASK_ID=task instance id PROCESS_INSTANCE_IDS=process_instance ids SKIP_LINE_NUM=skip line num QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log USERS_TAG=users related operation SCHEDULER_TAG=scheduler related operation CREATE_SCHEDULE_NOTES=create schedule CREATE_USER_NOTES=create user TENANT_ID=tenant id QUEUE=queue EMAIL=email PHONE=phone QUERY_USER_LIST_NOTES=query user list UPDATE_USER_NOTES=update user UPDATE_QUEUE_NOTES=update queue DELETE_USER_BY_ID_NOTES=delete user by id GRANT_PROJECT_NOTES=GRANT PROJECT PROJECT_IDS=project ids(string format, multiple projects separated by ",") GRANT_PROJECT_BY_CODE_NOTES=GRANT PROJECT BY CODE REVOKE_PROJECT_NOTES=REVOKE PROJECT FOR USER PROJECT_CODE=project codes GRANT_RESOURCE_NOTES=grant resource file RESOURCE_IDS=resource ids(string format, multiple resources separated by ",") GET_USER_INFO_NOTES=get user info LIST_USER_NOTES=list user VERIFY_USER_NAME_NOTES=verify user name UNAUTHORIZED_USER_NOTES=cancel authorization ALERT_GROUP_ID=alert group id AUTHORIZED_USER_NOTES=authorized user AUTHORIZE_RESOURCE_TREE_NOTES=authorize resource tree RESOURCE_CURRENTDIR=dir of the current resource QUERY_RESOURCE_LIST_PAGING_NOTES=query resource list paging RESOURCE_PID=parent directory ID of the current resource RESOURCE_FULL_NAME=resource full name QUERY_BY_RESOURCE_NAME=query by resource name QUERY_UDF_FUNC_LIST_NOTES=query udf funciton list VERIFY_RESOURCE_NAME_NOTES=verify resource name GRANT_UDF_FUNC_NOTES=grant udf function UDF_IDS=udf ids(string format, multiple udf functions separated by ",") GRANT_DATASOURCE_NOTES=grant datasource DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",") QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=query process instance global variables and local variables VIEW_GANTT_NOTES=view gantt SUB_PROCESS_INSTANCE_ID=sub process instance id TASK_NAME=task instance name TASK_INSTANCE_TAG=task instance related operation LOGGER_TAG=log related operation PROCESS_INSTANCE_TAG=process instance related operation EXECUTION_STATUS=runing status for workflow and task nodes HOST=ip address of running task START_DATE=start date END_DATE=end date QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id UPDATE_DATA_SOURCE_NOTES=update data source DATA_SOURCE_ID=DATA SOURCE ID QUERY_DATA_SOURCE_NOTES=query data source by id QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test DELETE_DATA_SOURCE_NOTES=delete data source VERIFY_DATA_SOURCE_NOTES=verify data source UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source AUTHORIZED_DATA_SOURCE_NOTES=authorized data source DELETE_SCHEDULER_BY_ID_NOTES=delete scheduler by id QUERY_ALERT_GROUP_LIST_PAGING_NOTES=query alert group list paging EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=export process definition by id BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES=batch export process definition by ids QUERY_USER_CREATED_PROJECT_NOTES=query user created project QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES=query authorized and user created project COPY_PROCESS_DEFINITION_NOTES=copy process definition notes MOVE_PROCESS_DEFINITION_NOTES=move process definition notes TARGET_PROJECT_ID=target project id IS_COPY=is copy DELETE_PROCESS_DEFINITION_VERSION_NOTES=delete process definition version QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=query process definition versions SWITCH_PROCESS_DEFINITION_VERSION_NOTES=switch process definition version VERSION=version
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/main/resources/i18n/messages_zh_CN.properties
# # 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. # QUERY_SCHEDULE_LIST_NOTES=查询定时列表 PROCESS_INSTANCE_EXECUTOR_TAG=流程实例执行相关操作 UI_PLUGINS_TAG=UI插件相关操作 WORK_FLOW_LINEAGE_TAG=工作流血缘相关操作 RUN_PROCESS_INSTANCE_NOTES=运行流程实例 START_NODE_LIST=开始节点列表(节点name) TASK_DEPEND_TYPE=任务依赖类型 COMMAND_TYPE=指令类型 RUN_MODE=运行模式 TIMEOUT=超时时间 EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES=执行流程实例的各种操作(暂停、停止、重跑、恢复等) EXECUTE_TYPE=执行类型 EXECUTOR_TAG=流程相关操作 EXECUTOR_NAME=流程名称 START_CHECK_PROCESS_DEFINITION_NOTES=检查流程定义 DESC=备注(描述) GROUP_NAME=组名称 WORKER_GROUP=worker群组 startParams=启动参数 GROUP_TYPE=组类型 QUERY_ALERT_GROUP_LIST_NOTES=告警组列表 UPDATE_ALERT_GROUP_NOTES=编辑(更新)告警组 DELETE_ALERT_GROUP_BY_ID_NOTES=通过ID删除告警组 VERIFY_ALERT_GROUP_NAME_NOTES=检查告警组是否存在 GRANT_ALERT_GROUP_NOTES=授权告警组 PROCESS_DEFINITION_IDS=流程定义ID PROCESS_DEFINITION_CODE=流程定义编码 PROCESS_DEFINITION_CODE_LIST=流程定义编码列表 USER_IDS=用户ID列表 ALERT_GROUP_TAG=告警组相关操作 WORKER_GROUP_TAG=Worker分组管理 SAVE_WORKER_GROUP_NOTES=创建Worker分组 ALERT_PLUGIN_INSTANCE_TAG=告警插件实例相关操作 WORKER_GROUP_NAME=Worker分组名称 WORKER_IP_LIST=Worker ip列表,注意:多个IP地址以逗号分割 QUERY_WORKER_GROUP_PAGING_NOTES=Worker分组管理 QUERY_WORKER_GROUP_LIST_NOTES=查询worker group分组 DELETE_WORKER_GROUP_BY_ID_NOTES=通过ID删除worker group DATA_ANALYSIS_TAG=任务状态分析相关操作 COUNT_TASK_STATE_NOTES=任务状态统计 COUNT_PROCESS_INSTANCE_NOTES=统计流程实例状态 COUNT_PROCESS_DEFINITION_BY_USER_NOTES=统计用户创建的流程定义 COUNT_COMMAND_STATE_NOTES=统计命令状态 COUNT_QUEUE_STATE_NOTES=统计队列里任务状态 ACCESS_TOKEN_TAG=访问token相关操作 MONITOR_TAG=监控相关操作 MASTER_LIST_NOTES=master服务列表 WORKER_LIST_NOTES=worker服务列表 QUERY_DATABASE_STATE_NOTES=查询数据库状态 QUERY_ZOOKEEPER_STATE_NOTES=查询Zookeeper状态 TASK_STATE=任务实例状态 SOURCE_TABLE=源表 DEST_TABLE=目标表 TASK_DATE=任务时间 QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=分页查询历史任务记录列表 DATA_SOURCE_TAG=数据源相关操作 CREATE_DATA_SOURCE_NOTES=创建数据源 DATA_SOURCE_NAME=数据源名称 DATA_SOURCE_NOTE=数据源描述 DB_TYPE=数据源类型 DATA_SOURCE_HOST=IP主机名 DATA_SOURCE_PORT=数据源端口 DATABASE_NAME=数据库名 QUEUE_TAG=队列相关操作 QUERY_TOPN_LONGEST_RUNNING_PROCESS_INSTANCE_NOTES=查询topN最长运行流程实例 QUERY_QUEUE_LIST_NOTES=查询队列列表 QUERY_QUEUE_LIST_PAGING_NOTES=分页查询队列列表 CREATE_QUEUE_NOTES=创建队列 YARN_QUEUE_NAME=hadoop yarn队列名 QUEUE_ID=队列ID TENANT_DESC=租户描述 QUERY_TENANT_LIST_PAGING_NOTES=分页查询租户列表 QUERY_TENANT_LIST_NOTES=查询租户列表 UPDATE_TENANT_NOTES=更新租户 DELETE_TENANT_NOTES=删除租户 RESOURCES_TAG=资源中心相关操作 CREATE_RESOURCE_NOTES=创建资源 RESOURCE_FULL_NAME=资源全名 RESOURCE_TYPE=资源文件类型 RESOURCE_NAME=资源文件名称 RESOURCE_DESC=资源文件描述 RESOURCE_FILE=资源文件 RESOURCE_ID=资源ID QUERY_RESOURCE_LIST_NOTES=查询资源列表 QUERY_BY_RESOURCE_NAME=通过资源名称查询 QUERY_UDF_FUNC_LIST_NOTES=查询UDF函数列表 VERIFY_RESOURCE_NAME_NOTES=验证资源名称 DELETE_RESOURCE_BY_ID_NOTES=通过ID删除资源 VIEW_RESOURCE_BY_ID_NOTES=通过ID浏览资源 ONLINE_CREATE_RESOURCE_NOTES=在线创建资源 SUFFIX=资源文件后缀 CONTENT=资源文件内容 UPDATE_RESOURCE_NOTES=在线更新资源文件 DOWNLOAD_RESOURCE_NOTES=下载资源文件 CREATE_UDF_FUNCTION_NOTES=创建UDF函数 UDF_TYPE=UDF类型 FUNC_NAME=函数名称 CLASS_NAME=包名类名 ARG_TYPES=参数 UDF_DESC=udf描述,使用说明 VIEW_UDF_FUNCTION_NOTES=查看udf函数 UPDATE_UDF_FUNCTION_NOTES=更新udf函数 QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=分页查询udf函数列表 VERIFY_UDF_FUNCTION_NAME_NOTES=验证udf函数名 DELETE_UDF_FUNCTION_NOTES=删除UDF函数 AUTHORIZED_FILE_NOTES=授权文件 UNAUTHORIZED_FILE_NOTES=取消授权文件 AUTHORIZED_UDF_FUNC_NOTES=授权udf函数 UNAUTHORIZED_UDF_FUNC_NOTES=取消udf函数授权 VERIFY_QUEUE_NOTES=验证队列 TENANT_TAG=租户相关操作 CREATE_TENANT_NOTES=创建租户 TENANT_CODE=操作系统租户 QUEUE_NAME=队列名 PASSWORD=密码 DATA_SOURCE_OTHER=jdbc连接参数,格式为:{"key1":"value1",...} DATA_SOURCE_PRINCIPAL=principal DATA_SOURCE_KERBEROS_KRB5_CONF=kerberos认证参数 java.security.krb5.conf DATA_SOURCE_KERBEROS_KEYTAB_USERNAME=kerberos认证参数 login.user.keytab.username DATA_SOURCE_KERBEROS_KEYTAB_PATH=kerberos认证参数 login.user.keytab.path PROJECT_TAG=项目相关操作 CREATE_PROJECT_NOTES=创建项目 PROJECT_DESC=项目描述 UPDATE_PROJECT_NOTES=更新项目 PROJECT_ID=项目ID QUERY_PROJECT_BY_ID_NOTES=通过项目ID查询项目信息 QUERY_PROJECT_LIST_PAGING_NOTES=分页查询项目列表 QUERY_ALL_PROJECT_LIST_NOTES=查询所有项目 DELETE_PROJECT_BY_ID_NOTES=通过ID删除项目 QUERY_UNAUTHORIZED_PROJECT_NOTES=查询未授权的项目 QUERY_AUTHORIZED_PROJECT_NOTES=查询授权项目 QUERY_AUTHORIZED_USER_NOTES=查询拥有项目授权的用户 TASK_RECORD_TAG=任务记录相关操作 QUERY_TASK_RECORD_LIST_PAGING_NOTES=分页查询任务记录列表 CREATE_TOKEN_NOTES=为指定用户创建安全令牌 TOKEN=安全令牌字符串,若未显式指定将会自动生成 EXPIRE_TIME=安全令牌的过期时间 QUERY_ACCESS_TOKEN_LIST_NOTES=分页查询access token列表 QUERY_ACCESS_TOKEN_BY_USER_NOTES=查询指定用户的access token SCHEDULE=定时 WARNING_TYPE=发送策略 WARNING_GROUP_ID=发送组ID FAILURE_STRATEGY=失败策略 RECEIVERS=收件人 RECEIVERS_CC=收件人(抄送) WORKER_GROUP_ID=Worker Server分组ID PROCESS_INSTANCE_PRIORITY=流程实例优先级 EXPECTED_PARALLELISM_NUMBER=补数任务自定义并行度 UPDATE_SCHEDULE_NOTES=更新定时 SCHEDULE_ID=定时ID ONLINE_SCHEDULE_NOTES=定时上线 OFFLINE_SCHEDULE_NOTES=定时下线 QUERY_SCHEDULE_NOTES=查询定时 QUERY_SCHEDULE_LIST_PAGING_NOTES=分页查询定时 LOGIN_TAG=用户登录相关操作 USER_NAME=用户名 PROJECT_NAME=项目名称 CREATE_PROCESS_DEFINITION_NOTES=创建流程定义 PROCESS_INSTANCE_START_TIME=流程实例启动时间 PROCESS_INSTANCE_END_TIME=流程实例结束时间 PROCESS_INSTANCE_SIZE=流程实例个数 PROCESS_DEFINITION_NAME=流程定义名称 PROCESS_DEFINITION_JSON=流程定义详细信息(json格式) PROCESS_DEFINITION_LOCATIONS=流程定义节点坐标位置信息(json格式) PROCESS_INSTANCE_LOCATIONS=流程实例节点坐标位置信息(json格式) PROCESS_DEFINITION_CONNECTS=流程定义节点图标连接信息(json格式) PROCESS_INSTANCE_CONNECTS=流程实例节点图标连接信息(json格式) PROCESS_DEFINITION_DESC=流程定义描述信息 PROCESS_DEFINITION_TAG=流程定义相关操作 SIGNOUT_NOTES=退出登录 USER_PASSWORD=用户密码 UPDATE_PROCESS_INSTANCE_NOTES=更新流程实例 QUERY_PROCESS_INSTANCE_LIST_NOTES=查询流程实例列表 VERIFY_PROCESS_DEFINITION_NAME_NOTES=验证流程定义名字 LOGIN_NOTES=用户登录 UPDATE_PROCESS_DEFINITION_NOTES=更新流程定义 PROCESS_DEFINITION_ID=流程定义ID RELEASE_PROCESS_DEFINITION_NOTES=发布流程定义 QUERY_PROCESS_DEFINITION_BY_ID_NOTES=通过流程定义ID查询流程定义 QUERY_PROCESS_DEFINITION_LIST_NOTES=查询流程定义列表 QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES=分页查询流程定义列表 QUERY_ALL_DEFINITION_LIST_NOTES=查询所有流程定义 PAGE_NO=页码号 PROCESS_INSTANCE_ID=流程实例ID PROCESS_INSTANCE_IDS=流程实例ID集合 PROCESS_INSTANCE_JSON=流程实例信息(json格式) PREVIEW_SCHEDULE_NOTES=定时调度预览 SCHEDULE_TIME=定时时间 SYNC_DEFINE=更新流程实例的信息是否同步到流程定义 RECOVERY_PROCESS_INSTANCE_FLAG=是否恢复流程实例 SEARCH_VAL=搜索值 FORCE_TASK_SUCCESS=强制TASK成功 QUERY_TASK_INSTANCE_LIST_PAGING_NOTES=分页查询任务实例列表 PROCESS_INSTANCE_NAME=流程实例名称 TASK_INSTANCE_ID=任务实例ID VERIFY_TENANT_CODE_NOTES=验证租户 QUERY_UI_PLUGIN_DETAIL_BY_ID=通过ID查询UI插件详情 QUERY_UI_PLUGINS_BY_TYPE=通过类型查询UI插件 ACTIVATE_USER_NOTES=激活用户 BATCH_ACTIVATE_USER_NOTES=批量激活用户 REPEAT_PASSWORD=重复密码 REGISTER_USER_NOTES=用户注册 STATE=状态 USER_NAMES=多个用户名 PLUGIN_ID=插件ID USER_ID=用户ID PAGE_SIZE=页大小 LIMIT=显示多少条 UDF_ID=udf ID AUTHORIZE_RESOURCE_TREE_NOTES=授权资源树 RESOURCE_CURRENTDIR=当前资源目录 RESOURCE_PID=资源父目录ID QUERY_RESOURCE_LIST_PAGING_NOTES=分页查询资源列表 VIEW_TREE_NOTES=树状图 IMPORT_PROCESS_DEFINITION_NOTES=导入流程定义 GET_NODE_LIST_BY_DEFINITION_ID_NOTES=通过流程定义ID获得任务节点列表 PROCESS_DEFINITION_ID_LIST=流程定义id列表 QUERY_PROCESS_DEFINITION_All_BY_PROJECT_ID_NOTES=通过项目ID查询流程定义 BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES=通过流程定义ID集合批量删除流程定义 BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_NOTES=通过流程实例ID集合批量删除流程实例 DELETE_PROCESS_DEFINITION_BY_ID_NOTES=通过流程定义ID删除流程定义 QUERY_PROCESS_INSTANCE_BY_ID_NOTES=通过流程实例ID查询流程实例 DELETE_PROCESS_INSTANCE_BY_ID_NOTES=通过流程实例ID删除流程实例 TASK_ID=任务实例ID SKIP_LINE_NUM=忽略行数 QUERY_TASK_INSTANCE_LOG_NOTES=查询任务实例日志 DOWNLOAD_TASK_INSTANCE_LOG_NOTES=下载任务实例日志 USERS_TAG=用户相关操作 SCHEDULER_TAG=定时相关操作 CREATE_SCHEDULE_NOTES=创建定时 CREATE_USER_NOTES=创建用户 CREATE_WORKER_GROUP_NOTES=创建Worker分组 WORKER_ADDR_LIST=worker地址列表 QUERY_WORKER_ADDRESS_LIST_NOTES=查询worker地址列表 QUERY_WORKFLOW_LINEAGE_BY_IDS_NOTES=通过IDs查询工作流血缘列表 QUERY_WORKFLOW_LINEAGE_BY_NAME_NOTES=通过名称查询工作流血缘列表 TENANT_ID=租户ID QUEUE=使用的队列 EMAIL=邮箱 PHONE=手机号 QUERY_USER_LIST_NOTES=查询用户列表 UPDATE_USER_NOTES=更新用户 UPDATE_QUEUE_NOTES=更新队列 DELETE_USER_BY_ID_NOTES=删除用户通过ID GRANT_PROJECT_NOTES=授权项目 PROJECT_IDS=项目IDS(字符串格式,多个项目以","分割) GRANT_PROJECT_BY_CODE_NOTES=授权项目 REVOKE_PROJECT_NOTES=撤销用户的项目权限 PROJECT_CODE=项目Code GRANT_RESOURCE_NOTES=授权资源文件 RESOURCE_IDS=资源ID列表(字符串格式,多个资源ID以","分割) GET_USER_INFO_NOTES=获取用户信息 GET_NODE_LIST_BY_DEFINITION_CODE_NOTES=通过流程定义编码查询节点列表 QUERY_PROCESS_DEFINITION_BY_NAME_NOTES=通过名称查询流程定义 LIST_USER_NOTES=用户列表 VERIFY_USER_NAME_NOTES=验证用户名 UNAUTHORIZED_USER_NOTES=取消授权 ALERT_GROUP_ID=报警组ID AUTHORIZED_USER_NOTES=授权用户 GRANT_UDF_FUNC_NOTES=授权udf函数 UDF_IDS=udf函数id列表(字符串格式,多个udf函数ID以","分割) GRANT_DATASOURCE_NOTES=授权数据源 DATASOURCE_IDS=数据源ID列表(字符串格式,多个数据源ID以","分割) QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=通过任务实例ID查询子流程实例 QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=通过子流程实例ID查询父流程实例信息 QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES=查询流程实例全局变量和局部变量 VIEW_GANTT_NOTES=浏览Gantt图 SUB_PROCESS_INSTANCE_ID=子流程实例ID TASK_NAME=任务实例名 TASK_INSTANCE_TAG=任务实例相关操作 LOGGER_TAG=日志相关操作 PROCESS_INSTANCE_TAG=流程实例相关操作 EXECUTION_STATUS=工作流和任务节点的运行状态 HOST=运行任务的主机IP地址 START_DATE=开始时间 END_DATE=结束时间 QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=通过流程实例ID查询任务列表 DELETE_ALERT_PLUGIN_INSTANCE_NOTES=删除告警插件实例 CREATE_ALERT_PLUGIN_INSTANCE_NOTES=创建告警插件实例 GET_ALERT_PLUGIN_INSTANCE_NOTES=查询告警插件实例 QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES=分页查询告警实例列表 QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES=查询所有告警实例列表 UPDATE_ALERT_PLUGIN_INSTANCE_NOTES=更新告警插件实例 ALERT_PLUGIN_INSTANCE_NAME=告警插件实例名称 ALERT_PLUGIN_DEFINE_ID=告警插件定义ID ALERT_PLUGIN_ID=告警插件ID ALERT_PLUGIN_INSTANCE_ID=告警插件实例ID ALERT_PLUGIN_INSTANCE_PARAMS=告警插件实例参数 ALERT_INSTANCE_NAME=告警插件名称 VERIFY_ALERT_INSTANCE_NAME_NOTES=验证告警插件名称 UPDATE_DATA_SOURCE_NOTES=更新数据源 DATA_SOURCE_PARAM=数据源参数 DATA_SOURCE_ID=数据源ID CREATE_ALERT_GROUP_NOTES=创建告警组 QUERY_DATA_SOURCE_NOTES=查询数据源通过ID QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=通过数据源类型查询数据源列表 QUERY_DATA_SOURCE_LIST_PAGING_NOTES=分页查询数据源列表 CONNECT_DATA_SOURCE_NOTES=连接数据源 CONNECT_DATA_SOURCE_TEST_NOTES=连接数据源测试 DELETE_DATA_SOURCE_NOTES=删除数据源 VERIFY_DATA_SOURCE_NOTES=验证数据源 UNAUTHORIZED_DATA_SOURCE_NOTES=未授权的数据源 AUTHORIZED_DATA_SOURCE_NOTES=授权的数据源 DELETE_SCHEDULER_BY_ID_NOTES=根据定时id删除定时数据 QUERY_ALERT_GROUP_LIST_PAGING_NOTES=分页查询告警组列表 EXPORT_PROCESS_DEFINITION_BY_ID_NOTES=通过工作流ID导出工作流定义 BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES=批量导出工作流定义 QUERY_USER_CREATED_PROJECT_NOTES=查询用户创建的项目 QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES=查询授权和用户创建的项目 COPY_PROCESS_DEFINITION_NOTES=复制工作流定义 MOVE_PROCESS_DEFINITION_NOTES=移动工作流定义 TARGET_PROJECT_ID=目标项目ID IS_COPY=是否复制 DELETE_PROCESS_DEFINITION_VERSION_NOTES=删除流程历史版本 QUERY_PROCESS_DEFINITION_VERSIONS_NOTES=查询流程历史版本信息 SWITCH_PROCESS_DEFINITION_VERSION_NOTES=切换流程版本 VERSION=版本号
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AccessTokenControllerTest.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.api.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * access token controller test */ public class AccessTokenControllerTest extends AbstractControllerTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenControllerTest.class); @Test public void testCreateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "607f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testCreateTokenWhenTokenAbsent() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", null); MvcResult mvcResult = this.mockMvc .perform(post("/access-tokens") .header("sessionId", this.sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testExceptionHandler() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "-1"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "507f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.CREATE_ACCESS_TOKEN_ERROR.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testGenerateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-28 00:00:00"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens/generate") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenList() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("pageNo", "1"); paramsMap.add("pageSize", "20"); paramsMap.add("searchVal", ""); MvcResult mvcResult = mockMvc.perform(get("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenByUser() throws Exception { MvcResult mvcResult = this.mockMvc .perform(get("/access-tokens/user/1") .header("sessionId", this.sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testDelAccessTokenById() throws Exception { testCreateToken(); MvcResult mvcResult = mockMvc.perform(delete("/access-tokens/1") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testUpdateToken() throws Exception { testCreateToken(); MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-20 00:00:00"); paramsMap.add("token", "cxctoken123update"); MvcResult mvcResult = mockMvc.perform(put("/access-tokens/1") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,408
[Feature][dolphinscheduler-api] Built GenerateToken into the UpdateToken API
### 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 If UpdateToken does not explicitly specify a Token, then GenerateToken is built into the UpdateToken interface, otherwise the current behavior remains unchanged, which is beneficial to reduce the count of network request interactions ### 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/7408
https://github.com/apache/dolphinscheduler/pull/7411
4988004150e3c8c264c0be027535bbcfdfd05d7c
6b5c3934490027c57e8e8651d02d696060b290f5
"2021-12-14T10:16:21Z"
java
"2021-12-15T02:39:43Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.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.api.service; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.AccessTokenServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; import org.assertj.core.util.Lists; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service test */ @RunWith(MockitoJUnitRunner.class) public class AccessTokenServiceTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceTest.class); @InjectMocks private AccessTokenServiceImpl accessTokenService; @Mock private AccessTokenMapper accessTokenMapper; @Test @SuppressWarnings("unchecked") public void testQueryAccessTokenList() { IPage<AccessToken> tokenPage = new Page<>(); tokenPage.setRecords(getList()); tokenPage.setTotal(1L); when(accessTokenMapper.selectAccessTokenPage(any(Page.class), eq("zhangsan"), eq(0))).thenReturn(tokenPage); User user = new User(); Result result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10); PageInfo<AccessToken> pageInfo = (PageInfo<AccessToken>) result.getData(); logger.info(result.toString()); Assert.assertTrue(pageInfo.getTotal() > 0); } @Test public void testQueryAccessTokenByUser() { List<AccessToken> accessTokenList = Lists.newArrayList(this.getEntity()); Mockito.when(this.accessTokenMapper.queryAccessTokenByUser(1)).thenReturn(accessTokenList); // USER_NO_OPERATION_PERM User user = this.getLoginUser(); user.setUserType(UserType.GENERAL_USER); Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); // SUCCESS user.setUserType(UserType.ADMIN_USER); result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCreateToken() { // Given Token when(accessTokenMapper.insert(any(AccessToken.class))).thenReturn(2); Map<String, Object> result = accessTokenService.createToken(getLoginUser(), 1, getDate(), "AccessTokenServiceTest"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // Token is absent result = this.accessTokenService.createToken(getLoginUser(), 1, getDate(), null); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testGenerateToken() { Map<String, Object> result = accessTokenService.generateToken(getLoginUser(), Integer.MAX_VALUE,getDate()); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); String token = (String) result.get(Constants.DATA_LIST); Assert.assertNotNull(token); } @Test public void testDelAccessTokenById() { when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); User userLogin = new User(); // not exist Map<String, Object> result = accessTokenService.delAccessTokenById(userLogin, 0); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); // no operate result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); //success userLogin.setId(1); userLogin.setUserType(UserType.ADMIN_USER); result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testUpdateToken() { when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); Map<String, Object> result = accessTokenService.updateToken(getLoginUser(), 1,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // not exist result = accessTokenService.updateToken(getLoginUser(), 2,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); } private User getLoginUser() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); return loginUser; } /** * create entity */ private AccessToken getEntity() { AccessToken accessToken = new AccessToken(); accessToken.setId(1); accessToken.setUserId(1); accessToken.setToken("AccessTokenServiceTest"); Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); accessToken.setExpireTime(date); return accessToken; } /** * entity list */ private List<AccessToken> getList() { List<AccessToken> list = new ArrayList<>(); list.add(getEntity()); return list; } /** * get dateStr */ private String getDate() { Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); return DateUtils.dateToString(date); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,418
[Feature][dolphinscheduler-api] Return domain object after UpdateXxx success
### 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 Return domain object after UpdateXxx success ### 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/7418
https://github.com/apache/dolphinscheduler/pull/7420
bc995752d6b52f2f94bf17ea806c60f8d63b7342
801e6dd6bb721ee2d9f35528673865483957fcd3
"2021-12-15T03:16:23Z"
java
"2021-12-15T05:40:07Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.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.api.controller; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_BY_USER_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_ACCESS_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.GENERATE_TOKEN_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_ACCESSTOKEN_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_ACCESS_TOKEN_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; /** * access token controller */ @Api(tags = "ACCESS_TOKEN_TAG") @RestController @RequestMapping("/access-tokens") public class AccessTokenController extends BaseController { @Autowired private AccessTokenService accessTokenService; /** * create token * * @param loginUser login user * @param userId token for user id * @param expireTime expire time for the token * @param token token string (if it is absent, it will be automatically generated) * @return create result state code */ @ApiOperation(value = "createToken", notes = "CREATE_TOKEN_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int"), @ApiImplicitParam(name = "expireTime", value = "EXPIRE_TIME", required = true, dataType = "String", example = "2021-12-31 00:00:00"), @ApiImplicitParam(name = "token", value = "TOKEN", required = false, dataType = "String", example = "xxxx") }) @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result createToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token", required = false) String token) { Map<String, Object> result = accessTokenService.createToken(loginUser, userId, expireTime, token); return returnDataList(result); } /** * generate token string * * @param loginUser login user * @param userId token for user * @param expireTime expire time * @return token string */ @ApiIgnore @PostMapping(value = "/generate") @ResponseStatus(HttpStatus.CREATED) @ApiException(GENERATE_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result generateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime) { Map<String, Object> result = accessTokenService.generateToken(loginUser, userId, expireTime); return returnDataList(result); } /** * query access token list paging * * @param loginUser login user * @param pageNo page number * @param searchVal search value * @param pageSize page size * @return token list of page number and page size */ @ApiOperation(value = "queryAccessTokenList", notes = "QUERY_ACCESS_TOKEN_LIST_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("pageNo") Integer pageNo, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageSize") Integer pageSize) { Result result = checkPageParams(pageNo, pageSize); if (!result.checkResult()) { return result; } searchVal = ParameterUtils.handleEscapes(searchVal); result = accessTokenService.queryAccessTokenList(loginUser, searchVal, pageNo, pageSize); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @ApiOperation(value = "queryAccessTokenByUser", notes = "QUERY_ACCESS_TOKEN_BY_USER_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int") }) @GetMapping(value = "/user/{userId}") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_ACCESSTOKEN_BY_USER_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAccessTokenByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("userId") Integer userId) { Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(loginUser, userId); return this.returnDataList(result); } /** * delete access token by id * * @param loginUser login user * @param id token id * @return delete result code */ @ApiIgnore @DeleteMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result delAccessTokenById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id) { Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); return returnDataList(result); } /** * update token * * @param loginUser login user * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return update result code */ @ApiOperation(value = "updateToken", notes = "UPDATE_TOKEN_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "TOKEN_ID", required = true, dataType = "Int"), @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int"), @ApiImplicitParam(name = "expireTime", value = "EXPIRE_TIME", required = true, dataType = "String", example = "2021-12-31 00:00:00"), @ApiImplicitParam(name = "token", value = "TOKEN", required = false, dataType = "String", example = "xxxx") }) @PutMapping(value = "/{id}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_ACCESS_TOKEN_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable(value = "id") int id, @RequestParam(value = "userId") int userId, @RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "token", required = false) String token) { Map<String, Object> result = accessTokenService.updateToken(loginUser, id, userId, expireTime, token); return returnDataList(result); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,418
[Feature][dolphinscheduler-api] Return domain object after UpdateXxx success
### 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 Return domain object after UpdateXxx success ### 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/7418
https://github.com/apache/dolphinscheduler/pull/7420
bc995752d6b52f2f94bf17ea806c60f8d63b7342
801e6dd6bb721ee2d9f35528673865483957fcd3
"2021-12-15T03:16:23Z"
java
"2021-12-15T05:40:07Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/AccessTokenService.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.api.service; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * access token service */ public interface AccessTokenService { /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize); /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId); /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return create result code */ Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token); /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ Map<String, Object> generateToken(User loginUser, int userId, String expireTime); /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ Map<String, Object> delAccessTokenById(User loginUser, int id); /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return update result code */ Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,418
[Feature][dolphinscheduler-api] Return domain object after UpdateXxx success
### 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 Return domain object after UpdateXxx success ### 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/7418
https://github.com/apache/dolphinscheduler/pull/7420
bc995752d6b52f2f94bf17ea806c60f8d63b7342
801e6dd6bb721ee2d9f35528673865483957fcd3
"2021-12-15T03:16:23Z"
java
"2021-12-15T05:40:07Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.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.api.service.impl; import org.apache.commons.lang3.StringUtils; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.AccessTokenService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.EncryptionUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service impl */ @Service public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTokenService { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceImpl.class); @Autowired private AccessTokenMapper accessTokenMapper; /** * query access token list * * @param loginUser login user * @param searchVal search value * @param pageNo page number * @param pageSize page size * @return token list for page number and page size */ @Override public Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) { Result result = new Result(); PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize); Page<AccessToken> page = new Page<>(pageNo, pageSize); int userId = loginUser.getId(); if (loginUser.getUserType() == UserType.ADMIN_USER) { userId = 0; } IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, searchVal, userId); pageInfo.setTotal((int) accessTokenList.getTotal()); pageInfo.setTotalList(accessTokenList.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query access token for specified user * * @param loginUser login user * @param userId user id * @return token list for specified user */ @Override public Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, false); // only admin can operate if (isNotAdmin(loginUser, result)) { return result; } // query access token for specified user List<AccessToken> accessTokenList = this.accessTokenMapper.queryAccessTokenByUser(userId); result.put(Constants.DATA_LIST, accessTokenList); this.putMsg(result, Status.SUCCESS); return result; } /** * create token * * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return create result code */ @SuppressWarnings("checkstyle:WhitespaceAround") @Override public Map<String, Object> createToken(User loginUser, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); // 1. check permission if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } // 2. check if user is existed if (userId <= 0) { throw new IllegalArgumentException("User id should not less than or equals to 0."); } // 3. generate access token if absent if (StringUtils.isBlank(token)) { token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); } // 4. persist to the database AccessToken accessToken = new AccessToken(); accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setCreateTime(new Date()); accessToken.setUpdateTime(new Date()); int insert = accessTokenMapper.insert(accessToken); if (insert > 0) { result.put(Constants.DATA_LIST, accessToken); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR); } return result; } /** * generate token * * @param userId token for user * @param expireTime token expire time * @return token string */ @Override public Map<String, Object> generateToken(User loginUser, int userId, String expireTime) { Map<String, Object> result = new HashMap<>(); if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } String token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); result.put(Constants.DATA_LIST, token); putMsg(result, Status.SUCCESS); return result; } /** * delete access token * * @param loginUser login user * @param id token id * @return delete result code */ @Override public Map<String, Object> delAccessTokenById(User loginUser, int id) { Map<String, Object> result = new HashMap<>(); AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } if (!hasPerm(loginUser,accessToken.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } accessTokenMapper.deleteById(id); putMsg(result, Status.SUCCESS); return result; } /** * update token by id * * @param id token id * @param userId token for user * @param expireTime token expire time * @param token token string (if it is absent, it will be automatically generated) * @return update result code */ @Override public Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token) { Map<String, Object> result = new HashMap<>(); // 1. check permission if (!hasPerm(loginUser,userId)) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } // 2. check if token is existed AccessToken accessToken = accessTokenMapper.selectById(id); if (accessToken == null) { logger.error("access token not exist, access token id {}", id); putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST); return result; } // 3. generate access token if absent if (StringUtils.isBlank(token)) { token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis()); } // 4. persist to the database accessToken.setUserId(userId); accessToken.setExpireTime(DateUtils.stringToDate(expireTime)); accessToken.setToken(token); accessToken.setUpdateTime(new Date()); accessTokenMapper.updateById(accessToken); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,418
[Feature][dolphinscheduler-api] Return domain object after UpdateXxx success
### 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 Return domain object after UpdateXxx success ### 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/7418
https://github.com/apache/dolphinscheduler/pull/7420
bc995752d6b52f2f94bf17ea806c60f8d63b7342
801e6dd6bb721ee2d9f35528673865483957fcd3
"2021-12-15T03:16:23Z"
java
"2021-12-15T05:40:07Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AccessTokenControllerTest.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.api.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * access token controller test */ public class AccessTokenControllerTest extends AbstractControllerTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenControllerTest.class); @Test public void testCreateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "607f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testCreateTokenIfAbsent() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", null); MvcResult mvcResult = this.mockMvc .perform(post("/access-tokens") .header("sessionId", this.sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testExceptionHandler() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "-1"); paramsMap.add("expireTime", "2019-12-18 00:00:00"); paramsMap.add("token", "507f5aeaaa2093dbdff5d5522ce00510"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.CREATE_ACCESS_TOKEN_ERROR.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testGenerateToken() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-28 00:00:00"); MvcResult mvcResult = mockMvc.perform(post("/access-tokens/generate") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenList() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("pageNo", "1"); paramsMap.add("pageSize", "20"); paramsMap.add("searchVal", ""); MvcResult mvcResult = mockMvc.perform(get("/access-tokens") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testQueryAccessTokenByUser() throws Exception { MvcResult mvcResult = this.mockMvc .perform(get("/access-tokens/user/1") .header("sessionId", this.sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testDelAccessTokenById() throws Exception { testCreateToken(); MvcResult mvcResult = mockMvc.perform(delete("/access-tokens/1") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testUpdateToken() throws Exception { testCreateToken(); MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-20 00:00:00"); paramsMap.add("token", "cxctoken123update"); MvcResult mvcResult = mockMvc.perform(put("/access-tokens/1") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testUpdateTokenIfAbsent() throws Exception { this.testCreateTokenIfAbsent(); MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId", "4"); paramsMap.add("expireTime", "2019-12-20 00:00:00"); paramsMap.add("token", null); MvcResult mvcResult = this.mockMvc .perform(put("/access-tokens/2") .header("sessionId", this.sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,418
[Feature][dolphinscheduler-api] Return domain object after UpdateXxx success
### 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 Return domain object after UpdateXxx success ### 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/7418
https://github.com/apache/dolphinscheduler/pull/7420
bc995752d6b52f2f94bf17ea806c60f8d63b7342
801e6dd6bb721ee2d9f35528673865483957fcd3
"2021-12-15T03:16:23Z"
java
"2021-12-15T05:40:07Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.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.api.service; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.AccessTokenServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.dao.entity.AccessToken; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; import org.assertj.core.util.Lists; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * access token service test */ @RunWith(MockitoJUnitRunner.class) public class AccessTokenServiceTest { private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceTest.class); @InjectMocks private AccessTokenServiceImpl accessTokenService; @Mock private AccessTokenMapper accessTokenMapper; @Test @SuppressWarnings("unchecked") public void testQueryAccessTokenList() { IPage<AccessToken> tokenPage = new Page<>(); tokenPage.setRecords(getList()); tokenPage.setTotal(1L); when(accessTokenMapper.selectAccessTokenPage(any(Page.class), eq("zhangsan"), eq(0))).thenReturn(tokenPage); User user = new User(); Result result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10); PageInfo<AccessToken> pageInfo = (PageInfo<AccessToken>) result.getData(); logger.info(result.toString()); Assert.assertTrue(pageInfo.getTotal() > 0); } @Test public void testQueryAccessTokenByUser() { List<AccessToken> accessTokenList = Lists.newArrayList(this.getEntity()); Mockito.when(this.accessTokenMapper.queryAccessTokenByUser(1)).thenReturn(accessTokenList); // USER_NO_OPERATION_PERM User user = this.getLoginUser(); user.setUserType(UserType.GENERAL_USER); Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); // SUCCESS user.setUserType(UserType.ADMIN_USER); result = this.accessTokenService.queryAccessTokenByUser(user, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCreateToken() { // Given Token when(accessTokenMapper.insert(any(AccessToken.class))).thenReturn(2); Map<String, Object> result = accessTokenService.createToken(getLoginUser(), 1, getDate(), "AccessTokenServiceTest"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // Token is absent result = this.accessTokenService.createToken(getLoginUser(), 1, getDate(), null); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testGenerateToken() { Map<String, Object> result = accessTokenService.generateToken(getLoginUser(), Integer.MAX_VALUE,getDate()); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); String token = (String) result.get(Constants.DATA_LIST); Assert.assertNotNull(token); } @Test public void testDelAccessTokenById() { when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); User userLogin = new User(); // not exist Map<String, Object> result = accessTokenService.delAccessTokenById(userLogin, 0); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); // no operate result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS)); //success userLogin.setId(1); userLogin.setUserType(UserType.ADMIN_USER); result = accessTokenService.delAccessTokenById(userLogin, 1); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testUpdateToken() { // Given Token when(accessTokenMapper.selectById(1)).thenReturn(getEntity()); Map<String, Object> result = accessTokenService.updateToken(getLoginUser(), 1,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // Token is absent result = accessTokenService.updateToken(getLoginUser(), 1, Integer.MAX_VALUE,getDate(),null); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); // ACCESS_TOKEN_NOT_EXIST result = accessTokenService.updateToken(getLoginUser(), 2,Integer.MAX_VALUE,getDate(),"token"); logger.info(result.toString()); Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS)); } private User getLoginUser() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); return loginUser; } /** * create entity */ private AccessToken getEntity() { AccessToken accessToken = new AccessToken(); accessToken.setId(1); accessToken.setUserId(1); accessToken.setToken("AccessTokenServiceTest"); Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); accessToken.setExpireTime(date); return accessToken; } /** * entity list */ private List<AccessToken> getList() { List<AccessToken> list = new ArrayList<>(); list.add(getEntity()); return list; } /** * get dateStr */ private String getDate() { Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30); return DateUtils.dateToString(date); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,392
[Bug] [DataSource] Add hive datasource failed
### 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 ![](https://files.catbox.moe/9zynlw.png) Update Kerberos environment failed when add new hive datasource. ### What you expected to happen add new hive datasource success. ### How to reproduce add new hive datasource. ### Anything else It's a bug in 2.0.1-release. ### 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/7392
https://github.com/apache/dolphinscheduler/pull/7393
801e6dd6bb721ee2d9f35528673865483957fcd3
a17a8d777a3d4d2eda2409b1917ad5ddd3123969
"2021-12-14T04:33:02Z"
java
"2021-12-15T09:36:05Z"
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.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.datasource.hive; import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF; import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF_PATH; import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.utils.CommonUtil; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.utils.Constants; import org.apache.dolphinscheduler.spi.utils.PropertyUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; import java.io.IOException; import java.lang.reflect.Field; import java.sql.Connection; import java.sql.SQLException; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.zaxxer.hikari.HikariDataSource; import sun.security.krb5.Config; public class HiveDataSourceClient extends CommonDataSourceClient { private static final Logger logger = LoggerFactory.getLogger(HiveDataSourceClient.class); private ScheduledExecutorService kerberosRenewalService; private Configuration hadoopConf; protected HikariDataSource oneSessionDataSource; private UserGroupInformation ugi; public HiveDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { super(baseConnectionParam, dbType); } @Override protected void preInit() { logger.info("PreInit in {}", getClass().getName()); this.kerberosRenewalService = Executors.newSingleThreadScheduledExecutor(); } @Override protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) { logger.info("Create Configuration for hive configuration."); this.hadoopConf = createHadoopConf(); logger.info("Create Configuration success."); logger.info("Create UserGroupInformation."); this.ugi = createUserGroupInformation(baseConnectionParam.getUser()); logger.info("Create ugi success."); super.initClient(baseConnectionParam, dbType); this.oneSessionDataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam); logger.info("Init {} success.", getClass().getName()); } @Override protected void checkEnv(BaseConnectionParam baseConnectionParam) { super.checkEnv(baseConnectionParam); checkKerberosEnv(); } private void checkKerberosEnv() { String krb5File = PropertyUtils.getString(JAVA_SECURITY_KRB5_CONF_PATH); if (StringUtils.isNotBlank(krb5File)) { System.setProperty(JAVA_SECURITY_KRB5_CONF, krb5File); try { Config.refresh(); Class<?> kerberosName = Class.forName("org.apache.hadoop.security.authentication.util.KerberosName"); Field field = kerberosName.getDeclaredField("defaultRealm"); field.setAccessible(true); field.set(null, Config.getInstance().getDefaultRealm()); } catch (Exception e) { throw new RuntimeException("Update Kerberos environment failed.", e); } } } private UserGroupInformation createUserGroupInformation(String username) { String krb5File = PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH); String keytab = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH); String principal = PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME); try { UserGroupInformation ugi = CommonUtil.createUGI(getHadoopConf(), principal, keytab, krb5File, username); try { Field isKeytabField = ugi.getClass().getDeclaredField("isKeytab"); isKeytabField.setAccessible(true); isKeytabField.set(ugi, true); } catch (NoSuchFieldException | IllegalAccessException e) { logger.warn(e.getMessage()); } kerberosRenewalService.scheduleWithFixedDelay(() -> { try { ugi.checkTGTAndReloginFromKeytab(); } catch (IOException e) { logger.error("Check TGT and Renewal from Keytab error", e); } }, 5, 5, TimeUnit.MINUTES); return ugi; } catch (IOException e) { throw new RuntimeException("createUserGroupInformation fail. ", e); } } protected Configuration createHadoopConf() { Configuration hadoopConf = new Configuration(); hadoopConf.setBoolean("ipc.client.fallback-to-simple-auth-allowed", true); return hadoopConf; } protected Configuration getHadoopConf() { return this.hadoopConf; } @Override public Connection getConnection() { try { return oneSessionDataSource.getConnection(); } catch (SQLException e) { logger.error("get oneSessionDataSource Connection fail SQLException: {}", e.getMessage(), e); return null; } } @Override public void close() { super.close(); logger.info("close HiveDataSourceClient."); kerberosRenewalService.shutdown(); this.ugi = null; this.oneSessionDataSource.close(); this.oneSessionDataSource = null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,854
[Bug] [File Manage] queryResourcePaging : An error occurs when an authorized user accesses a resource
### 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 There is an error in ResourceMapper.xml (line:66) This will cause authorized users not to read the file list; ### What you expected to happen An unnecessary ”and“ was written logs: Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql : SELECT COUNT(1) FROM ( select d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, d.create_time, d.update_time, d.pid, d.full_name, d.is_directory from t_ds_resources d where d.type=? and d.pid=? and ( and d.id in ( ? , ? ) or d.user_id=? ) order by d.update_time desc ) TOTAL at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:39) at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.queryTotal(PaginationInterceptor.java:248) at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.intercept(PaginationInterceptor.java:202) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy182.prepare(Unknown Source) at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.prepareStatement(MybatisSimpleExecutor.java:94) at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:66) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147) ... 110 common frames omitted ### How to reproduce Use the super/root/admin account to create a folder and file, and then authorize it to ordinary users. When ordinary users view it, there will be no data, and the above error will appear in the log file. ### Anything else _No response_ ### Version 2.0.0-alpha ### Are you willing to submit PR? - [ ] 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/6854
https://github.com/apache/dolphinscheduler/pull/6907
f36ca0290770cd0f70a8fd29b17d0daf02d525db
676a952bcbeba1790b03954915ec352cd920b6d1
"2021-11-15T08:55:07Z"
java
"2021-12-15T11:18:00Z"
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ResourceMapper.xml
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ 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. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ResourceMapper"> <sql id="baseSqlV2"> ${alias}.id, ${alias}.alias, ${alias}.file_name, ${alias}.description, ${alias}.user_id, ${alias}.type, ${alias}.size, ${alias}.create_time, ${alias}.update_time, ${alias}.pid, ${alias}.full_name, ${alias}.is_directory </sql> <select id="queryResourceList" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where 1= 1 <if test="fullName != null and fullName != ''"> and r.full_name = #{fullName} </if> <if test="type != -1"> and r.type = #{type} </if> <if test="userId != 0"> and r.user_id = #{userId} </if> </select> <select id="queryResourceListAuthored" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where 1 = 1 <if test="type != -1"> and r.type=#{type} </if> <if test="userId != 0"> and r.user_id=#{userId} </if> </select> <select id="queryResourcePaging" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="d"/> </include> from t_ds_resources d where d.type=#{type} and d.pid=#{id} <if test="userId != 0"> and ( <if test="resIds != null and resIds.size() > 0"> d.id in <foreach collection="resIds" item="i" open="(" close=") or" separator=","> #{i} </foreach> </if> d.user_id=#{userId} ) </if> <if test="searchVal != null and searchVal != ''"> and d.alias like concat('%', #{searchVal}, '%') </if> order by d.update_time desc </select> <select id="queryResourceExceptUserId" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where r.user_id <![CDATA[ <> ]]> #{userId} </select> <select id="listAuthorizedResource" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where r.type = 0 and r.user_id=#{userId} <if test="resNames != null and resNames.length > 0"> and full_name in <foreach collection="resNames" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <select id="queryResourceListById" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where 1 = 1 <if test="resIds != null and resIds.size() > 0"> and r.id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <select id="listAuthorizedResourceById" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where r.user_id=#{userId} <if test="resIds != null and resIds.length > 0"> and id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> </select> <delete id="deleteIds" parameterType="java.lang.Integer"> delete from t_ds_resources where id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </delete> <select id="listChildren" resultType="java.lang.Integer"> select id from t_ds_resources where pid = #{direcotyId} </select> <select id="queryResource" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where r.type = #{type} and r.full_name = #{fullName} </select> <update id="batchUpdateResource" parameterType="java.util.List"> <foreach collection="resourceList" item="resource" index="index" open="" close="" separator=";"> update t_ds_resources <set> full_name=#{resource.fullName}, update_time=#{resource.updateTime} </set> <where> id=#{resource.id} </where> </foreach> </update> <select id="listResourceByIds" resultType="org.apache.dolphinscheduler.dao.entity.Resource"> select <include refid="baseSqlV2"> <property name="alias" value="r"/> </include> from t_ds_resources r where r.id in <foreach collection="resIds" item="i" open="(" close=")" separator=","> #{i} </foreach> </select> <select id="existResourceByUser" resultType="java.lang.Boolean"> select 1 from t_ds_resources where full_name = #{fullName} and type = #{type} and user_id = #{userId} limit 1 </select> <select id="existResource" resultType="java.lang.Boolean"> select 1 from t_ds_resources where full_name = #{fullName} and type = #{type} limit 1 </select> </mapper>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,926
[Feature][Python] Add workflow as code task type dependent
### 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 Add python api task type dependent. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6926
https://github.com/apache/dolphinscheduler/pull/7405
676a952bcbeba1790b03954915ec352cd920b6d1
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
"2021-11-19T07:04:43Z"
java
"2021-12-16T01:58:50Z"
dolphinscheduler-python/pydolphinscheduler/examples/task_dependent_example.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,926
[Feature][Python] Add workflow as code task type dependent
### 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 Add python api task type dependent. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6926
https://github.com/apache/dolphinscheduler/pull/7405
676a952bcbeba1790b03954915ec352cd920b6d1
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
"2021-11-19T07:04:43Z"
java
"2021-12-16T01:58:50Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/constants.py
# 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. """Constants for pydolphinscheduler.""" class ProcessDefinitionReleaseState: """Constants for :class:`pydolphinscheduler.core.process_definition.ProcessDefinition` release state.""" ONLINE: str = "ONLINE" OFFLINE: str = "OFFLINE" class ProcessDefinitionDefault: """Constants default value for :class:`pydolphinscheduler.core.process_definition.ProcessDefinition`.""" PROJECT: str = "project-pydolphin" TENANT: str = "tenant_pydolphin" USER: str = "userPythonGateway" # TODO simple set password same as username USER_PWD: str = "userPythonGateway" USER_EMAIL: str = "userPythonGateway@dolphinscheduler.com" USER_PHONE: str = "11111111111" USER_STATE: int = 1 QUEUE: str = "queuePythonGateway" WORKER_GROUP: str = "default" TIME_ZONE: str = "Asia/Shanghai" class TaskPriority(str): """Constants for task priority.""" HIGHEST = "HIGHEST" HIGH = "HIGH" MEDIUM = "MEDIUM" LOW = "LOW" LOWEST = "LOWEST" class TaskFlag(str): """Constants for task flag.""" YES = "YES" NO = "NO" class TaskTimeoutFlag(str): """Constants for task timeout flag.""" CLOSE = "CLOSE" class TaskType(str): """Constants for task type, it will also show you which kind we support up to now.""" SHELL = "SHELL" HTTP = "HTTP" PYTHON = "PYTHON" SQL = "SQL" SUB_PROCESS = "SUB_PROCESS" PROCEDURE = "PROCEDURE" class DefaultTaskCodeNum(str): """Constants and default value for default task code number.""" DEFAULT = 1 class JavaGatewayDefault(str): """Constants and default value for java gateway.""" RESULT_MESSAGE_KEYWORD = "msg" RESULT_MESSAGE_SUCCESS = "success" RESULT_STATUS_KEYWORD = "status" RESULT_STATUS_SUCCESS = "SUCCESS" RESULT_DATA = "data" class Delimiter(str): """Constants for delimiter.""" BAR = "-" DASH = "/" COLON = ":" UNDERSCORE = "_" class Time(str): """Constants for date.""" FMT_STD_DATE = "%Y-%m-%d" LEN_STD_DATE = 10 FMT_DASH_DATE = "%Y/%m/%d" FMT_SHORT_DATE = "%Y%m%d" LEN_SHORT_DATE = 8 FMT_STD_TIME = "%H:%M:%S" FMT_NO_COLON_TIME = "%H%M%S"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,926
[Feature][Python] Add workflow as code task type dependent
### 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 Add python api task type dependent. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6926
https://github.com/apache/dolphinscheduler/pull/7405
676a952bcbeba1790b03954915ec352cd920b6d1
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
"2021-11-19T07:04:43Z"
java
"2021-12-16T01:58:50Z"
dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/tasks/dependent.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,926
[Feature][Python] Add workflow as code task type dependent
### 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 Add python api task type dependent. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6926
https://github.com/apache/dolphinscheduler/pull/7405
676a952bcbeba1790b03954915ec352cd920b6d1
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
"2021-11-19T07:04:43Z"
java
"2021-12-16T01:58:50Z"
dolphinscheduler-python/pydolphinscheduler/tests/tasks/test_dependent.py
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,926
[Feature][Python] Add workflow as code task type dependent
### 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 Add python api task type dependent. sub task in #6407. we should cover all parameter from UI side and make it suitable for python. ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/6926
https://github.com/apache/dolphinscheduler/pull/7405
676a952bcbeba1790b03954915ec352cd920b6d1
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
"2021-11-19T07:04:43Z"
java
"2021-12-16T01:58:50Z"
dolphinscheduler-python/src/main/java/org/apache/dolphinscheduler/server/PythonGatewayServer.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.server; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.QueueService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.service.TaskDefinitionService; import org.apache.dolphinscheduler.api.service.TenantService; import org.apache.dolphinscheduler.api.service.UsersService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Queue; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import py4j.GatewayServer; @ComponentScan(value = "org.apache.dolphinscheduler") public class PythonGatewayServer extends SpringBootServletInitializer { private static final Logger LOGGER = LoggerFactory.getLogger(PythonGatewayServer.class); private static final WarningType DEFAULT_WARNING_TYPE = WarningType.NONE; private static final int DEFAULT_WARNING_GROUP_ID = 0; private static final FailureStrategy DEFAULT_FAILURE_STRATEGY = FailureStrategy.CONTINUE; private static final Priority DEFAULT_PRIORITY = Priority.MEDIUM; private static final Long DEFAULT_ENVIRONMENT_CODE = -1L; private static final TaskDependType DEFAULT_TASK_DEPEND_TYPE = TaskDependType.TASK_POST; private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL; private static final int DEFAULT_DRY_RUN = 0; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProjectService projectService; @Autowired private TenantService tenantService; @Autowired private ExecutorService executorService; @Autowired private ProcessDefinitionService processDefinitionService; @Autowired private TaskDefinitionService taskDefinitionService; @Autowired private UsersService usersService; @Autowired private QueueService queueService; @Autowired private ProjectMapper projectMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private ScheduleMapper scheduleMapper; @Autowired private DataSourceMapper dataSourceMapper; // TODO replace this user to build in admin user if we make sure build in one could not be change private final User dummyAdminUser = new User() { { setId(Integer.MAX_VALUE); setUserName("dummyUser"); setUserType(UserType.ADMIN_USER); } }; private final Queue queuePythonGateway = new Queue() { { setId(Integer.MAX_VALUE); setQueueName("queuePythonGateway"); } }; public String ping() { return "PONG"; } // TODO Should we import package in python client side? utils package can but service can not, why // Core api public Map<String, Object> genTaskCodeList(Integer genNum) { return taskDefinitionService.genTaskCodeList(genNum); } public Map<String, Long> getCodeAndVersion(String projectName, String taskName) throws CodeGenerateUtils.CodeGenerateException { Project project = projectMapper.queryByName(projectName); Map<String, Long> result = new HashMap<>(); // project do not exists, mean task not exists too, so we should directly return init value if (project == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), taskName); if (taskDefinition == null) { result.put("code", CodeGenerateUtils.getInstance().genCode()); result.put("version", 0L); } else { result.put("code", taskDefinition.getCode()); result.put("version", (long) taskDefinition.getVersion()); } return result; } /** * create or update process definition. * If process definition do not exists in Project=`projectCode` would create a new one * If process definition already exists in Project=`projectCode` would update it * * @param userName user name who create or update process definition * @param projectName project name which process definition belongs to * @param name process definition name * @param description description * @param globalParams global params * @param schedule schedule for process definition, will not set schedule if null, * and if would always fresh exists schedule if not null * @param locations locations json object about all tasks * @param timeout timeout for process definition working, if running time longer than timeout, * task will mark as fail * @param workerGroup run task in which worker group * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ public Long createOrUpdateProcessDefinition(String userName, String projectName, String name, String description, String globalParams, String schedule, String locations, int timeout, String workerGroup, String tenantCode, String taskRelationJson, String taskDefinitionJson, ProcessExecutionTypeEnum executionType) { User user = usersService.queryUser(userName); Project project = (Project) projectService.queryByName(user, projectName).get(Constants.DATA_LIST); long projectCode = project.getCode(); ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, name); long processDefinitionCode; // create or update process definition if (processDefinition != null) { processDefinitionCode = processDefinition.getCode(); // make sure process definition offline which could edit processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); } else { Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, executionType); processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST); processDefinitionCode = processDefinition.getCode(); } // Fresh process definition schedule if (schedule != null) { createOrUpdateSchedule(user, projectCode, processDefinitionCode, schedule, workerGroup); } processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE); return processDefinitionCode; } /** * get process definition * @param user user who create or update schedule * @param projectCode project which process definition belongs to * @param processDefinitionName process definition name */ private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) { Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, processDefinitionName); Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS); ProcessDefinition processDefinition = null; if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) { processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); } else if (verifyStatus != Status.SUCCESS) { String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST."; LOGGER.error(msg); throw new RuntimeException(msg); } return processDefinition; } /** * create or update process definition schedule. * It would always use latest schedule define in workflow-as-code, and set schedule online when * it's not null * * @param user user who create or update schedule * @param projectCode project which process definition belongs to * @param processDefinitionCode process definition code * @param schedule schedule expression * @param workerGroup work group */ private void createOrUpdateSchedule(User user, long projectCode, long processDefinitionCode, String schedule, String workerGroup) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode); // create or update schedule int scheduleId; if (scheduleObj == null) { processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE); Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, DEFAULT_WARNING_TYPE, DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); scheduleId = (int) result.get("scheduleId"); } else { scheduleId = scheduleObj.getId(); processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE); schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, DEFAULT_WARNING_TYPE, DEFAULT_WARNING_GROUP_ID, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE); } schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE); } public void execProcessInstance(String userName, String projectName, String processDefinitionName, String cronTime, String workerGroup, Integer timeout ) { User user = usersService.queryUser(userName); Project project = projectMapper.queryByName(projectName); ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName); // make sure process definition online processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE); executorService.execProcessInstance(user, project.getCode(), processDefinition.getCode(), cronTime, null, DEFAULT_FAILURE_STRATEGY, null, DEFAULT_TASK_DEPEND_TYPE, DEFAULT_WARNING_TYPE, DEFAULT_WARNING_GROUP_ID, DEFAULT_RUN_MODE, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE, timeout, null, null, DEFAULT_DRY_RUN ); } // side object public Map<String, Object> createProject(String userName, String name, String desc) { User user = usersService.queryUser(userName); return projectService.createProject(user, name, desc); } public Map<String, Object> createQueue(String name, String queueName) { Result<Object> verifyQueueExists = queueService.verifyQueue(name, queueName); if (verifyQueueExists.getCode() == 0) { return queueService.createQueue(dummyAdminUser, name, queueName); } else { Map<String, Object> result = new HashMap<>(); // TODO function putMsg do not work here result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } } public Map<String, Object> createTenant(String tenantCode, String desc, String queueName) throws Exception { if (tenantService.checkTenantExists(tenantCode)) { Map<String, Object> result = new HashMap<>(); // TODO function putMsg do not work here result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } else { Result<Object> verifyQueueExists = queueService.verifyQueue(queueName, queueName); if (verifyQueueExists.getCode() == 0) { // TODO why create do not return id? queueService.createQueue(dummyAdminUser, queueName, queueName); } Map<String, Object> result = queueService.queryQueueName(queueName); List<Queue> queueList = (List<Queue>) result.get(Constants.DATA_LIST); Queue queue = queueList.get(0); return tenantService.createTenant(dummyAdminUser, tenantCode, queue.getId(), desc); } } public void createUser(String userName, String userPassword, String email, String phone, String tenantCode, String queue, int state) { User user = usersService.queryUser(userName); if (Objects.isNull(user)) { Map<String, Object> tenantResult = tenantService.queryByTenantCode(tenantCode); Tenant tenant = (Tenant) tenantResult.get(Constants.DATA_LIST); usersService.createUser(userName, userPassword, email, tenant.getId(), phone, queue, state); } } /** * Get datasource by given datasource name. It return map contain datasource id, type, name. * Useful in Python API create sql task which need datasource information. * * @param datasourceName user who create or update schedule */ public Map<String, Object> getDatasourceInfo(String datasourceName) { Map<String, Object> result = new HashMap<>(); List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(datasourceName); if (dataSourceList.size() > 1) { String msg = String.format("Get more than one datasource by name %s", datasourceName); logger.error(msg); throw new IllegalArgumentException(msg); } else if (dataSourceList.size() == 0) { String msg = String.format("Can not find any datasource by name %s", datasourceName); logger.error(msg); throw new IllegalArgumentException(msg); } else { DataSource dataSource = dataSourceList.get(0); result.put("id", dataSource.getId()); result.put("type", dataSource.getType().name()); result.put("name", dataSource.getName()); } return result; } /** * Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code. * Useful in Python API create subProcess task which need processDefinition information. * * @param userName user who create or update schedule * @param projectName project name which process definition belongs to * @param processDefinitionName process definition name */ public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) { Map<String, Object> result = new HashMap<>(); User user = usersService.queryUser(userName); Project project = (Project) projectService.queryByName(user, projectName).get(Constants.DATA_LIST); long projectCode = project.getCode(); ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, processDefinitionName); // get process definition info if (processDefinition != null) { // make sure process definition online processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinition.getCode(), ReleaseState.ONLINE); result.put("id", processDefinition.getId()); result.put("name", processDefinition.getName()); result.put("code", processDefinition.getCode()); } else { String msg = String.format("Can not find valid process definition by name %s", processDefinitionName); logger.error(msg); throw new IllegalArgumentException(msg); } return result; } @PostConstruct public void run() { GatewayServer server = new GatewayServer(this); GatewayServer.turnLoggingOn(); // Start server to accept python client RPC server.start(); } public static void main(String[] args) { SpringApplication.run(PythonGatewayServer.class, args); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/index.html
<!-- * 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. --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <link rel="icon" href="/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Dolphin Scheduler Admin</title> </head> <body> <div id="app"></div> <script type="module" src="/src/main.ts"></script> </body> </html>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/router/index.ts
/* * 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. */ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' const routes: RouteRecordRaw[] = [ { path: '/login', redirect: { name: 'Login' }, component: () => import('@/layouts/content/Content'), children: [ { path: '/login', name: 'Login', component: () => import('@/views/login/Login'), }, ], }, ] const index = createRouter({ history: createWebHistory(), routes, }) export default index
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/router/routes.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/utils/classification.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/utils/index.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/views/home/index.module.scss
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/views/home/index.tsx
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/views/login/index.module.scss
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/src/views/login/index.tsx
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,432
[Feature][UI-Next] Added the configuration of routes
### 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 - Automatically generate mappings for files - Add a new utils folder and some definition methods Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7432
https://github.com/apache/dolphinscheduler/pull/7433
6f93ebf3ba66a2e99e56e1844243dfc75d43556c
7aeb12c5de8e67273af45d61f284a356f32f6af1
"2021-12-15T12:40:01Z"
java
"2021-12-16T02:22:15Z"
dolphinscheduler-ui-next/tsconfig.json
{ "compilerOptions": { "target": "esnext", "module": "esnext", "moduleResolution": "node", "strict": true, "jsx": "preserve", "sourceMap": true, "resolveJsonModule": true, "esModuleInterop": true, "lib": ["esnext", "dom"], "baseUrl": ".", "paths": { "@/*": ["src/*"] } }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/package.json
{ "name": "dolphinscheduler-ui-next", "version": "0.0.0", "scripts": { "dev": "vite", "build:dev": "vue-tsc --noEmit && vite build --mode development", "build:prod": "vue-tsc --noEmit && vite build --mode production", "preview": "vite preview", "lint": "eslint src --fix --ext .ts,.tsx,.vue", "prettier": "prettier --config .prettier.js --write src/**/*.{vue,ts,tsx}" }, "dependencies": { "@vueuse/core": "^7.2.2", "axios": "^0.24.0", "date-fns": "^2.27.0", "naive-ui": "^2.21.5", "nprogress": "^0.2.0", "pinia": "^2.0.0-rc.10", "vfonts": "^0.1.0", "vue": "^3.2.23", "vue-i18n": "^9.2.0-beta.23", "vue-router": "^4.0.12" }, "devDependencies": { "@types/node": "^16.11.13", "@types/nprogress": "^0.2.0", "@typescript-eslint/eslint-plugin": "^5.6.0", "@typescript-eslint/parser": "^5.6.0", "@vitejs/plugin-vue": "^1.10.2", "@vitejs/plugin-vue-jsx": "^1.3.1", "dart-sass": "^1.25.0", "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-vue": "^8.2.0", "prettier": "^2.5.1", "sass": "^1.44.0", "sass-loader": "^12.4.0", "typescript": "^4.4.4", "vite": "^2.7.0", "vite-plugin-compression": "^0.3.6", "vue-tsc": "^0.28.10" } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/assets/images/logo.svg
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/env.d.ts
/* * 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. */ declare module '*.vue' { import { DefineComponent } from 'vue' // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types const component: DefineComponent<{}, {}, any> export default component } declare module '*.scss' { const classes: { readonly [key: string]: string } export default classes } declare module '*.png' declare module '*.jpg' declare module '*.jpeg'
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/locales/modules/en_US.ts
/* * 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. */ const login = { test: 'Test', } export default { login, }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
/* * 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. */ const login = { test: '测试', } export default { login, }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/utils/classification.ts
/* * 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. */ import type { Component } from 'vue' interface modules extends Object { [key: string]: any } const classification = (modules: modules) => { const components: { [key: string]: Component } = {} // All TSX files under the views folder automatically generate mapping relationship Object.keys(modules).forEach((key: string) => { const nameMatch: string[] | null = key.match(/^\/src\/views\/(.+)\.tsx/) if (!nameMatch) { return } // If the page is named Index, the parent folder is used as the name const indexMatch: string[] | null = nameMatch[1].match(/(.*)\/Index$/i) let name: string = indexMatch ? indexMatch[1] : nameMatch[1] ;[name] = name.split('/').splice(-1) components[name] = modules[key] }) return components } export default classification
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/views/login/index.module.scss
/* * 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. */ .container { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/src/views/login/index.tsx
/* * 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. */ import { defineComponent } from 'vue' import styles from './index.module.scss' import { useI18n } from 'vue-i18n' import { NButton } from 'naive-ui' import { useThemeStore } from '@/store/theme/theme' const Login = defineComponent({ name: 'login', setup() { const { t, locale } = useI18n() const themeStore = useThemeStore() const setTheme = (): void => { themeStore.setDarkTheme() } return { t, locale, setTheme } }, render() { return ( <div class={styles.container}> <NButton type='error' onClick={this.setTheme}> {this.t('login.test')} + 切换主题 </NButton> <select v-model={this.locale}> <option value='en_US'>en_US</option> <option value='zh_CN'>zh_CN</option> </select> </div> ) }, }) export default Login
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,455
[Feature][UI-Next] Added login pages and functions
### 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 -Added login pages and functions Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7455
https://github.com/apache/dolphinscheduler/pull/7456
5c8b7b794023812c618bcea0ee659f7bfb6c9290
91e3423c724e9abbfb2e84fa54af0fd792e0361e
"2021-12-17T00:58:49Z"
java
"2021-12-17T01:28:34Z"
dolphinscheduler-ui-next/tsconfig.json
{ "compilerOptions": { "target": "esnext", "module": "esnext", "moduleResolution": "node", "strict": true, "jsx": "preserve", "sourceMap": true, "resolveJsonModule": true, "esModuleInterop": true, "lib": ["esnext", "dom"], "baseUrl": ".", "paths": { "@/*": ["src/*"] }, "types": ["vite/client"] }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,457
[Feature][UI] The search box can be searched by pressing enter button.
### 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 The search box can be searched by pressing enter button in ui.Just like the old version 1.3.X. branch: 2.0.1-release ### Use case search ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] 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/7457
https://github.com/apache/dolphinscheduler/pull/7461
0c7aa4e2c5af05a1df099e1ba29cef876446f79e
fb31dcd59cb1ca1b500c32f78e68bfe68bb149c7
"2021-12-17T02:30:19Z"
java
"2021-12-17T06:40:40Z"
dolphinscheduler-ui/src/js/module/components/conditions/conditions.vue
/* * 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. */ <template> <div class="conditions-model"> <div class="left"> <slot name="button-group"></slot> </div> <div class="right"> <div class="form-box"> <slot name="search-group" v-if="isShow"></slot> <template v-if="!isShow"> <div class="list"> <el-button size="mini" @click="_ckQuery" icon="el-icon-search" ></el-button> </div> <div class="list"> <el-input v-model="searchVal" @keyup.enter="_ckQuery" size="mini" :placeholder="$t('Please enter keyword')" type="text" style="width: 180px" clearable > </el-input> </div> <div class="list" v-if="taskTypeShow"> <el-select size="mini" style="width: 140px" :placeholder="$t('type')" :value="taskType" @change="_onChangeTaskType" clearable > <el-option v-for="(task, index) in taskTypeList" :key="index" :value="task.desc" :label="index" > </el-option> </el-select> </div> </template> </div> </div> </div> </template> <script> import _ from 'lodash' /** * taskType list */ import { tasksType } from '@/conf/home/pages/dag/_source/config.js' export default { name: 'conditions', data () { return { // taskType list taskTypeList: tasksType, // search value searchVal: '', // taskType switch taskType: '' } }, props: { taskTypeShow: Boolean, operation: Array }, methods: { /** * switch taskType */ _onChangeTaskType (val) { this.taskType = val }, /** * emit Query parameter */ _ckQuery () { this.$emit('on-conditions', { searchVal: _.trim(this.searchVal), taskType: this.taskType }) } }, computed: { // Whether the slot comes in isShow () { return this.$slots['search-group'] } }, created () { // Routing parameter merging if (!_.isEmpty(this.$route.query)) { this.searchVal = this.$route.query.searchVal || '' this.taskType = this.$route.query.taskType || '' } }, components: {} } </script>
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/package.json
{ "name": "dolphinscheduler-ui-next", "version": "0.0.0", "scripts": { "dev": "vite", "build:dev": "vue-tsc --noEmit && vite build --mode development", "build:prod": "vue-tsc --noEmit && vite build --mode production", "preview": "vite preview", "lint": "eslint src --fix --ext .ts,.tsx,.vue", "prettier": "prettier --config .prettier.js --write src/**/*.{vue,ts,tsx}" }, "dependencies": { "@vueuse/core": "^7.2.2", "axios": "^0.24.0", "date-fns": "^2.27.0", "naive-ui": "^2.21.5", "nprogress": "^0.2.0", "pinia": "^2.0.0-rc.10", "vfonts": "^0.1.0", "vue": "^3.2.23", "vue-i18n": "^9.2.0-beta.23", "vue-router": "^4.0.12" }, "devDependencies": { "@types/node": "^16.11.13", "@types/nprogress": "^0.2.0", "@typescript-eslint/eslint-plugin": "^5.6.0", "@typescript-eslint/parser": "^5.6.0", "@vitejs/plugin-vue": "^1.10.2", "@vitejs/plugin-vue-jsx": "^1.3.1", "dart-sass": "^1.25.0", "eslint": "^8.4.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-vue": "^8.2.0", "prettier": "^2.5.1", "sass": "^1.44.0", "sass-loader": "^12.4.0", "typescript": "^4.4.4", "typescript-plugin-css-modules": "^3.4.0", "vite": "^2.7.0", "vite-plugin-compression": "^0.3.6", "vue-tsc": "^0.28.10" } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/locales/modules/en_US.ts
/* * 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. */ const login = { test: 'Test', username: 'Username', username_tips: 'Please enter your username', password: 'Password', password_tips: 'Please enter your password', signin: 'Sign In', } export default { login, }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/locales/modules/zh_CN.ts
/* * 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. */ const login = { test: '测试', username: '用户名', username_tips: '请输入用户名', password: '密码', password_tips: '请输入密码', signin: '登录', } export default { login, }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/router/index.ts
/* * 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. */ import { createRouter, createWebHistory, RouteRecordRaw, NavigationGuardNext, RouteLocationNormalized, } from 'vue-router' import routes from './routes' // NProgress import NProgress from 'nprogress' import 'nprogress/nprogress.css' const router = createRouter({ history: createWebHistory(), routes, }) /** * Routing to intercept */ router.beforeEach( async ( to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext ) => { NProgress.start() next() NProgress.done() } ) router.afterEach(() => { NProgress.done() }) export default router
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/service/service.ts
/* * 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. */ import axios, { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' const baseRequestConfig: AxiosRequestConfig = { baseURL: '/dolphinscheduler', timeout: 10000, } const service = axios.create(baseRequestConfig) const err = (error: AxiosError): Promise<AxiosError> => { return Promise.reject(error) } service.interceptors.request.use((config: AxiosRequestConfig<any>) => { return config }, err) service.interceptors.response.use((res: AxiosResponse) => { return res.data }, err) export { service as axios }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/store/theme/theme.ts
/* * 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. */ import { defineStore } from 'pinia' import ThemeState from './types' export const useThemeStore = defineStore({ id: 'theme', state: (): ThemeState => ({ darkTheme: true, }), getters: { getTheme(): boolean { return this.darkTheme }, }, actions: { setDarkTheme(): void { this.darkTheme = !this.darkTheme }, }, })
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,471
[Feature][UI-Next] Interface debugging
### 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 - Interface debugging(login) - Import `qs` package - Modified AXIOS to support QS Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332) ### 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/7471
https://github.com/apache/dolphinscheduler/pull/7472
b54482cbb5ff51fc69df626767d807e033556c3f
fc162826d91576da2649f5acfd6f11bcff58c5d7
"2021-12-17T10:07:57Z"
java
"2021-12-17T13:10:59Z"
dolphinscheduler-ui-next/src/views/login/index.tsx
/* * 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. */ import { defineComponent, reactive, ref, toRefs, withKeys } from 'vue' import styles from './index.module.scss' import { useI18n } from 'vue-i18n' import { NInput, NButton, NSwitch, NForm, NFormItem, FormRules } from 'naive-ui' import { useRouter } from 'vue-router' import type { Router } from 'vue-router' const Login = defineComponent({ name: 'login', setup() { const { t, locale } = useI18n() const state = reactive({ loginFormRef: ref(), loginForm: { username: '', password: '', }, rules: { username: { trigger: ['input', 'blur'], validator() { if (state.loginForm.username === '') { return new Error(`${t('login.username_tips')}`) } }, }, password: { trigger: ['input', 'blur'], validator() { if (state.loginForm.password === '') { return new Error(`${t('login.password_tips')}`) } }, }, } as FormRules, }) const handleChange = (value: string) => { locale.value = value } const router: Router = useRouter() const handleLogin = () => { state.loginFormRef.validate((valid: any) => { if (!valid) { router.push({ path: 'home' }) } else { console.log('Invalid') } }) } return { t, locale, handleChange, handleLogin, ...toRefs(state) } }, render() { return ( <div class={styles.container}> <div class={styles['language-switch']}> <NSwitch onUpdateValue={this.handleChange} checked-value='en_US' unchecked-value='zh_CN' > {{ checked: () => 'en_US', unchecked: () => 'zh_CN', }} </NSwitch> </div> <div class={styles['login-model']}> <div class={styles.logo}> <div class={styles['logo-img']}></div> </div> <div class={styles['form-model']}> <NForm rules={this.rules} ref='loginFormRef'> <NFormItem label={this.t('login.username')} label-style={{ color: 'black' }} path='username' > <NInput type='text' size='large' v-model={[this.loginForm.username, 'value']} placeholder={this.t('login.username_tips')} autofocus onKeydown={withKeys(this.handleLogin, ['enter'])} /> </NFormItem> <NFormItem label={this.t('login.password')} label-style={{ color: 'black' }} path='password' > <NInput type='password' size='large' v-model={[this.loginForm.password, 'value']} placeholder={this.t('login.password_tips')} onKeydown={withKeys(this.handleLogin, ['enter'])} /> </NFormItem> </NForm> <NButton round type='primary' onClick={this.handleLogin}> {this.t('login.signin')} </NButton> </div> </div> </div> ) }, }) export default Login
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactory.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.alert.wechat; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.alert.api.AlertChannelFactory; import org.apache.dolphinscheduler.alert.api.AlertConstants; import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.spi.params.base.ParamsOptions; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.params.base.Validate; import org.apache.dolphinscheduler.spi.params.input.InputParam; import org.apache.dolphinscheduler.spi.params.radio.RadioParam; import java.util.Arrays; import java.util.List; import com.google.auto.service.AutoService; @AutoService(AlertChannelFactory.class) public final class WeChatAlertChannelFactory implements AlertChannelFactory { @Override public String name() { return "WeChat"; } @Override public List<PluginParams> params() { InputParam corpIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_CORP_ID) .setPlaceholder("please input corp id ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam secretParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_SECRET) .setPlaceholder("please input secret ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam usersParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USERS) .setPlaceholder("please input users ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam userSendMsgParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_USER_SEND_MSG) .setPlaceholder("please input corp id ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); InputParam agentIdParam = InputParam.newBuilder(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID, WeChatAlertParamsConstants.ENTERPRISE_WE_CHAT_AGENT_ID) .setPlaceholder("please input agent id ") .addValidate(Validate.newBuilder() .setRequired(true) .build()) .build(); RadioParam showType = RadioParam.newBuilder(AlertConstants.NAME_SHOW_TYPE, AlertConstants.SHOW_TYPE) .addParamsOptions(new ParamsOptions(ShowType.TABLE.getDescp(), ShowType.TABLE.getDescp(), false)) .addParamsOptions(new ParamsOptions(ShowType.TEXT.getDescp(), ShowType.TEXT.getDescp(), false)) .setValue(ShowType.TABLE.getDescp()) .addValidate(Validate.newBuilder().setRequired(true).build()) .build(); return Arrays.asList(corpIdParam, secretParam, usersParam, userSendMsgParam, agentIdParam, showType); } @Override public AlertChannel create() { return new WeChatAlertChannel(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertConstants.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.alert.wechat; public final class WeChatAlertConstants { static final String MARKDOWN_QUOTE = ">"; static final String MARKDOWN_ENTER = "\n"; static final String CHARSET = "UTF-8"; static final String WE_CHAT_PUSH_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={token}"; static final String WE_CHAT_TOKEN_URL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpId}&corpsecret={secret}"; private WeChatAlertConstants() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertParamsConstants.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.alert.wechat; public final class WeChatAlertParamsConstants { static final String ENTERPRISE_WE_CHAT_CORP_ID = "$t('corpId')"; static final String NAME_ENTERPRISE_WE_CHAT_CORP_ID = "corpId"; static final String ENTERPRISE_WE_CHAT_SECRET = "$t('secret')"; static final String NAME_ENTERPRISE_WE_CHAT_SECRET = "secret"; static final String ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "$t('teamSendMsg')"; static final String NAME_ENTERPRISE_WE_CHAT_TEAM_SEND_MSG = "teamSendMsg"; static final String ENTERPRISE_WE_CHAT_USER_SEND_MSG = "$t('userSendMsg')"; static final String NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG = "userSendMsg"; static final String ENTERPRISE_WE_CHAT_AGENT_ID = "$t('agentId')"; static final String NAME_ENTERPRISE_WE_CHAT_AGENT_ID = "agentId"; static final String ENTERPRISE_WE_CHAT_USERS = "$t('users')"; static final String NAME_ENTERPRISE_WE_CHAT_USERS = "users"; private WeChatAlertParamsConstants() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatSender.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.alert.wechat; import static java.util.Objects.requireNonNull; import org.apache.dolphinscheduler.alert.api.AlertConstants; import org.apache.dolphinscheduler.alert.api.AlertResult; import org.apache.dolphinscheduler.alert.api.ShowType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class WeChatSender { private static final Logger logger = LoggerFactory.getLogger(WeChatSender.class); private static final String MUST_NOT_NULL = " must not null"; private static final String ALERT_STATUS = "false"; private static final String AGENT_ID_REG_EXP = "{agentId}"; private static final String MSG_REG_EXP = "{msg}"; private static final String USER_REG_EXP = "{toUser}"; private static final String CORP_ID_REGEX = "{corpId}"; private static final String SECRET_REGEX = "{secret}"; private static final String TOKEN_REGEX = "{token}"; private final String weChatAgentId; private final String weChatUsers; private final String weChatUserSendMsg; private final String weChatTokenUrlReplace; private final String weChatToken; private final String showType; WeChatSender(Map<String, String> config) { weChatAgentId = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_AGENT_ID); weChatUsers = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USERS); String weChatCorpId = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_CORP_ID); String weChatSecret = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_SECRET); String weChatTokenUrl = WeChatAlertConstants.WE_CHAT_TOKEN_URL; weChatUserSendMsg = config.get(WeChatAlertParamsConstants.NAME_ENTERPRISE_WE_CHAT_USER_SEND_MSG); showType = config.get(AlertConstants.NAME_SHOW_TYPE); requireNonNull(showType, AlertConstants.NAME_SHOW_TYPE + MUST_NOT_NULL); weChatTokenUrlReplace = weChatTokenUrl .replace(CORP_ID_REGEX, weChatCorpId) .replace(SECRET_REGEX, weChatSecret); weChatToken = getToken(); } private static String post(String url, String data) throws IOException { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new StringEntity(data, WeChatAlertConstants.CHARSET)); CloseableHttpResponse response = httpClient.execute(httpPost); String resp; try { HttpEntity entity = response.getEntity(); resp = EntityUtils.toString(entity, WeChatAlertConstants.CHARSET); EntityUtils.consume(entity); } finally { response.close(); } logger.info("Enterprise WeChat send [{}], param:{}, resp:{}", url, data, resp); return resp; } } /** * convert table to markdown style * * @param title the title * @param content the content * @return markdown table content */ private static String markdownTable(String title, String content) { List<LinkedHashMap> mapItemsList = JSONUtils.toList(content, LinkedHashMap.class); if (null == mapItemsList || mapItemsList.isEmpty()) { logger.error("itemsList is null"); throw new RuntimeException("itemsList is null"); } StringBuilder contents = new StringBuilder(200); for (LinkedHashMap mapItems : mapItemsList) { Set<Entry<String, Object>> entries = mapItems.entrySet(); Iterator<Entry<String, Object>> iterator = entries.iterator(); StringBuilder t = new StringBuilder(String.format("`%s`%s", title, WeChatAlertConstants.MARKDOWN_ENTER)); while (iterator.hasNext()) { Map.Entry<String, Object> entry = iterator.next(); t.append(WeChatAlertConstants.MARKDOWN_QUOTE); t.append(entry.getKey()).append(":").append(entry.getValue()); t.append(WeChatAlertConstants.MARKDOWN_ENTER); } contents.append(t); } return contents.toString(); } /** * convert text to markdown style * * @param title the title * @param content the content * @return markdown text */ private static String markdownText(String title, String content) { if (StringUtils.isNotEmpty(content)) { List<LinkedHashMap> mapItemsList = JSONUtils.toList(content, LinkedHashMap.class); if (null == mapItemsList || mapItemsList.isEmpty()) { logger.error("itemsList is null"); throw new RuntimeException("itemsList is null"); } StringBuilder contents = new StringBuilder(100); contents.append(String.format("`%s`%n", title)); for (LinkedHashMap mapItems : mapItemsList) { Set<Map.Entry<String, Object>> entries = mapItems.entrySet(); for (Entry<String, Object> entry : entries) { contents.append(WeChatAlertConstants.MARKDOWN_QUOTE); contents.append(entry.getKey()).append(":").append(entry.getValue()); contents.append(WeChatAlertConstants.MARKDOWN_ENTER); } } return contents.toString(); } return null; } private static String get(String url) throws IOException { String resp; try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet httpGet = new HttpGet(url); try (CloseableHttpResponse response = httpClient.execute(httpGet)) { HttpEntity entity = response.getEntity(); resp = EntityUtils.toString(entity, WeChatAlertConstants.CHARSET); EntityUtils.consume(entity); } HashMap<String, Object> map = JSONUtils.parseObject(resp, HashMap.class); if (map != null && null != map.get("access_token")) { return map.get("access_token").toString(); } else { return null; } } } private static String mkString(Iterable<String> list) { if (null == list || StringUtils.isEmpty("|")) { return null; } StringBuilder sb = new StringBuilder(); boolean first = true; for (String item : list) { if (first) { first = false; } else { sb.append("|"); } sb.append(item); } return sb.toString(); } private static AlertResult checkWeChatSendMsgResult(String result) { AlertResult alertResult = new AlertResult(); alertResult.setStatus(ALERT_STATUS); if (null == result) { alertResult.setMessage("we chat send fail"); logger.info("send we chat msg error,resp is null"); return alertResult; } WeChatSendMsgResponse sendMsgResponse = JSONUtils.parseObject(result, WeChatSendMsgResponse.class); if (null == sendMsgResponse) { alertResult.setMessage("we chat send fail"); logger.info("send we chat msg error,resp error"); return alertResult; } if (sendMsgResponse.errcode == 0) { alertResult.setStatus("true"); alertResult.setMessage("we chat alert send success"); return alertResult; } alertResult.setStatus(ALERT_STATUS); alertResult.setMessage(sendMsgResponse.getErrmsg()); return alertResult; } /** * make user multi user message * * @param toUser the toUser * @param agentId the agentId * @param msg the msg * @return Enterprise WeChat send message */ private String makeUserSendMsg(Collection<String> toUser, String agentId, String msg) { String listUser = mkString(toUser); return weChatUserSendMsg.replace(USER_REG_EXP, listUser) .replace(AGENT_ID_REG_EXP, agentId) .replace(MSG_REG_EXP, msg); } /** * send Enterprise WeChat * * @return Enterprise WeChat resp, demo: {"errcode":0,"errmsg":"ok","invaliduser":""} */ public AlertResult sendEnterpriseWeChat(String title, String content) { AlertResult alertResult; List<String> userList = Arrays.asList(weChatUsers.split(",")); String data = markdownByAlert(title, content); String msg = makeUserSendMsg(userList, weChatAgentId, data); if (null == weChatToken) { alertResult = new AlertResult(); alertResult.setMessage("send we chat alert fail,get weChat token error"); alertResult.setStatus(ALERT_STATUS); return alertResult; } String enterpriseWeChatPushUrlReplace = WeChatAlertConstants.WE_CHAT_PUSH_URL.replace(TOKEN_REGEX, weChatToken); try { return checkWeChatSendMsgResult(post(enterpriseWeChatPushUrlReplace, msg)); } catch (Exception e) { logger.info("send we chat alert msg exception : {}", e.getMessage()); alertResult = new AlertResult(); alertResult.setMessage("send we chat alert fail"); alertResult.setStatus(ALERT_STATUS); } return alertResult; } /** * Determine the mardown style based on the show type of the alert * * @return the markdown alert table/text */ private String markdownByAlert(String title, String content) { String result = ""; if (showType.equals(ShowType.TABLE.getDescp())) { result = markdownTable(title, content); } else if (showType.equals(ShowType.TEXT.getDescp())) { result = markdownText(title, content); } return result; } private String getToken() { try { return get(weChatTokenUrlReplace); } catch (IOException e) { logger.info("we chat alert get token error{}", e.getMessage()); } return null; } static final class WeChatSendMsgResponse { private Integer errcode; private String errmsg; public WeChatSendMsgResponse() { } public Integer getErrcode() { return this.errcode; } public void setErrcode(Integer errcode) { this.errcode = errcode; } public String getErrmsg() { return this.errmsg; } public void setErrmsg(String errmsg) { this.errmsg = errmsg; } public boolean equals(final Object o) { if (o == this) { return true; } if (!(o instanceof WeChatSendMsgResponse)) { return false; } final WeChatSendMsgResponse other = (WeChatSendMsgResponse) o; final Object this$errcode = this.getErrcode(); final Object other$errcode = other.getErrcode(); if (this$errcode == null ? other$errcode != null : !this$errcode.equals(other$errcode)) { return false; } final Object this$errmsg = this.getErrmsg(); final Object other$errmsg = other.getErrmsg(); if (this$errmsg == null ? other$errmsg != null : !this$errmsg.equals(other$errmsg)) { return false; } return true; } public int hashCode() { final int PRIME = 59; int result = 1; final Object $errcode = this.getErrcode(); result = result * PRIME + ($errcode == null ? 43 : $errcode.hashCode()); final Object $errmsg = this.getErrmsg(); result = result * PRIME + ($errmsg == null ? 43 : $errmsg.hashCode()); return result; } public String toString() { return "WeChatSender.WeChatSendMsgResponse(errcode=" + this.getErrcode() + ", errmsg=" + this.getErrmsg() + ")"; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/main/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatType.java
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,460
[Feature][Alert] Wechat alert support send to group chat
### 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 only support sending to apps right now in 2.0.1-release. https://work.weixin.qq.com/api/doc/90000/90135/90236 We should add support send to appchat .And add a switch button in UI. https://work.weixin.qq.com/api/doc/90000/90135/90248 ### 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/7460
https://github.com/apache/dolphinscheduler/pull/7465
fc162826d91576da2649f5acfd6f11bcff58c5d7
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
"2021-12-17T04:05:54Z"
java
"2021-12-18T02:26:16Z"
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-wechat/src/test/java/org/apache/dolphinscheduler/plugin/alert/wechat/WeChatAlertChannelFactoryTest.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.alert.wechat; import org.apache.dolphinscheduler.alert.api.AlertChannel; import org.apache.dolphinscheduler.spi.params.base.PluginParams; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import java.util.List; import org.junit.Assert; import org.junit.Test; /** * WeChatAlertChannelFactoryTest */ public class WeChatAlertChannelFactoryTest { @Test public void testGetParams() { WeChatAlertChannelFactory weChatAlertChannelFactory = new WeChatAlertChannelFactory(); List<PluginParams> params = weChatAlertChannelFactory.params(); JSONUtils.toJsonString(params); Assert.assertEquals(6, params.size()); } @Test public void testCreate() { WeChatAlertChannelFactory dingTalkAlertChannelFactory = new WeChatAlertChannelFactory(); AlertChannel alertChannel = dingTalkAlertChannelFactory.create(); Assert.assertNotNull(alertChannel); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,451
[Improvement][Worker] Remove '+1' (day) in the date of the complement data
### 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 the data is supplemented, the date is always +1. This often misleads users. So I think we should remove this. ### Use case The date is always the same as user selected in ui when the data is supplemented. ### Related issues #5979 ### 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/7451
https://github.com/apache/dolphinscheduler/pull/7452
86b476a1601872d1e47c3e9ca5ee4c18cbea92d3
92bbb9e4af3fb6132331828282bbe6e4bb97040d
"2021-12-16T14:01:28Z"
java
"2021-12-18T03:04:45Z"
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.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.server.worker.runner; import static java.util.Calendar.DAY_OF_MONTH; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.Event; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.RetryerUtils; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.TaskExecuteAckCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; import org.apache.dolphinscheduler.server.worker.plugin.TaskPluginManager; import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.queue.entity.TaskExecutionContext; import org.apache.dolphinscheduler.spi.task.AbstractTask; import org.apache.dolphinscheduler.spi.task.TaskAlertInfo; import org.apache.dolphinscheduler.spi.task.TaskChannel; import org.apache.dolphinscheduler.spi.task.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Delayed; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.rholder.retry.RetryException; /** * task scheduler thread */ public class TaskExecuteThread implements Runnable, Delayed { /** * logger */ private final Logger logger = LoggerFactory.getLogger(TaskExecuteThread.class); /** * task instance */ private TaskExecutionContext taskExecutionContext; /** * abstract task */ private AbstractTask task; /** * task callback service */ private TaskCallbackService taskCallbackService; /** * alert client server */ private AlertClientService alertClientService; private TaskPluginManager taskPluginManager; /** * constructor * * @param taskExecutionContext taskExecutionContext * @param taskCallbackService taskCallbackService */ public TaskExecuteThread(TaskExecutionContext taskExecutionContext, TaskCallbackService taskCallbackService, AlertClientService alertClientService) { this.taskExecutionContext = taskExecutionContext; this.taskCallbackService = taskCallbackService; this.alertClientService = alertClientService; } public TaskExecuteThread(TaskExecutionContext taskExecutionContext, TaskCallbackService taskCallbackService, AlertClientService alertClientService, TaskPluginManager taskPluginManager) { this.taskExecutionContext = taskExecutionContext; this.taskCallbackService = taskCallbackService; this.alertClientService = alertClientService; this.taskPluginManager = taskPluginManager; } @Override public void run() { TaskExecuteResponseCommand responseCommand = new TaskExecuteResponseCommand(taskExecutionContext.getTaskInstanceId(), taskExecutionContext.getProcessInstanceId()); if (Constants.DRY_RUN_FLAG_YES == taskExecutionContext.getDryRun()) { responseCommand.setStatus(ExecutionStatus.SUCCESS.getCode()); responseCommand.setEndTime(new Date()); TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); ResponceCache.get().cache(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command(), Event.RESULT); taskCallbackService.sendResult(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command()); return; } try { logger.info("script path : {}", taskExecutionContext.getExecutePath()); // check if the OS user exists if (!OSUtils.getUserList().contains(taskExecutionContext.getTenantCode())) { String errorLog = String.format("tenantCode: %s does not exist", taskExecutionContext.getTenantCode()); logger.error(errorLog); responseCommand.setStatus(ExecutionStatus.FAILURE.getCode()); responseCommand.setEndTime(new Date()); return; } if (taskExecutionContext.getStartTime() == null) { taskExecutionContext.setStartTime(new Date()); } if (taskExecutionContext.getCurrentExecutionStatus() != ExecutionStatus.RUNNING_EXECUTION) { changeTaskExecutionStatusToRunning(); } logger.info("the task begins to execute. task instance id: {}", taskExecutionContext.getTaskInstanceId()); // copy hdfs/minio file to local downloadResource(taskExecutionContext.getExecutePath(), taskExecutionContext.getResources(), logger); taskExecutionContext.setEnvFile(CommonUtils.getSystemEnvPath()); taskExecutionContext.setDefinedParams(getGlobalParamsMap()); taskExecutionContext.setTaskAppId(String.format("%s_%s", taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId())); preBuildBusinessParams(); TaskChannel taskChannel = taskPluginManager.getTaskChannelMap().get(taskExecutionContext.getTaskType()); if (null == taskChannel) { throw new RuntimeException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType())); } TaskRequest taskRequest = JSONUtils.parseObject(JSONUtils.toJsonString(taskExecutionContext), TaskRequest.class); String taskLogName = LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getProcessDefineCode(), taskExecutionContext.getProcessDefineVersion(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId()); taskRequest.setTaskLogName(taskLogName); task = taskChannel.createTask(taskRequest); // task init this.task.init(); //init varPool this.task.getParameters().setVarPool(taskExecutionContext.getVarPool()); // task handle this.task.handle(); // task result process if (this.task.getNeedAlert()) { sendAlert(this.task.getTaskAlertInfo()); } responseCommand.setStatus(this.task.getExitStatus().getCode()); responseCommand.setEndTime(new Date()); responseCommand.setProcessId(this.task.getProcessId()); responseCommand.setAppIds(this.task.getAppIds()); responseCommand.setVarPool(JSONUtils.toJsonString(this.task.getParameters().getVarPool())); logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), this.task.getExitStatus()); } catch (Throwable e) { logger.error("task scheduler failure", e); kill(); responseCommand.setStatus(ExecutionStatus.FAILURE.getCode()); responseCommand.setEndTime(new Date()); responseCommand.setProcessId(task.getProcessId()); responseCommand.setAppIds(task.getAppIds()); } finally { TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); ResponceCache.get().cache(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command(), Event.RESULT); taskCallbackService.sendResult(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command()); clearTaskExecPath(); } } private void sendAlert(TaskAlertInfo taskAlertInfo) { alertClientService.sendAlert(taskAlertInfo.getAlertGroupId(), taskAlertInfo.getTitle(), taskAlertInfo.getContent()); } /** * when task finish, clear execute path. */ private void clearTaskExecPath() { logger.info("develop mode is: {}", CommonUtils.isDevelopMode()); if (!CommonUtils.isDevelopMode()) { // get exec dir String execLocalPath = taskExecutionContext.getExecutePath(); if (StringUtils.isEmpty(execLocalPath)) { logger.warn("task: {} exec local path is empty.", taskExecutionContext.getTaskName()); return; } if ("/".equals(execLocalPath)) { logger.warn("task: {} exec local path is '/', direct deletion is not allowed", taskExecutionContext.getTaskName()); return; } try { org.apache.commons.io.FileUtils.deleteDirectory(new File(execLocalPath)); logger.info("exec local path: {} cleared.", execLocalPath); } catch (IOException e) { logger.error("delete exec dir failed : {}", e.getMessage(), e); } } } /** * get global paras map * * @return map */ private Map<String, String> getGlobalParamsMap() { Map<String, String> globalParamsMap = new HashMap<>(16); // global params string String globalParamsStr = taskExecutionContext.getGlobalParams(); if (globalParamsStr != null) { List<Property> globalParamsList = JSONUtils.toList(globalParamsStr, Property.class); globalParamsMap.putAll(globalParamsList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue))); } return globalParamsMap; } /** * kill task */ public void kill() { if (task != null) { try { task.cancelApplication(true); ProcessUtils.killYarnJob(taskExecutionContext); } catch (Exception e) { logger.error(e.getMessage(), e); } } } /** * download resource file * * @param execLocalPath execLocalPath * @param projectRes projectRes * @param logger logger */ private void downloadResource(String execLocalPath, Map<String, String> projectRes, Logger logger) { if (MapUtils.isEmpty(projectRes)) { return; } Set<Map.Entry<String, String>> resEntries = projectRes.entrySet(); for (Map.Entry<String, String> resource : resEntries) { String fullName = resource.getKey(); String tenantCode = resource.getValue(); File resFile = new File(execLocalPath, fullName); if (!resFile.exists()) { try { // query the tenant code of the resource according to the name of the resource String resHdfsPath = HadoopUtils.getHdfsResourceFileName(tenantCode, fullName); logger.info("get resource file from hdfs :{}", resHdfsPath); HadoopUtils.getInstance().copyHdfsToLocal(resHdfsPath, execLocalPath + File.separator + fullName, false, true); } catch (Exception e) { logger.error(e.getMessage(), e); throw new RuntimeException(e.getMessage()); } } else { logger.info("file : {} exists ", resFile.getName()); } } } /** * send an ack to change the status of the task. */ private void changeTaskExecutionStatusToRunning() { taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); Command ackCommand = buildAckCommand().convert2Command(); try { RetryerUtils.retryCall(() -> { taskCallbackService.sendAck(taskExecutionContext.getTaskInstanceId(), ackCommand); return Boolean.TRUE; }); } catch (ExecutionException | RetryException e) { logger.error(e.getMessage(), e); } } /** * build ack command. * * @return TaskExecuteAckCommand */ private TaskExecuteAckCommand buildAckCommand() { TaskExecuteAckCommand ackCommand = new TaskExecuteAckCommand(); ackCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); ackCommand.setStatus(taskExecutionContext.getCurrentExecutionStatus().getCode()); ackCommand.setStartTime(taskExecutionContext.getStartTime()); ackCommand.setLogPath(taskExecutionContext.getLogPath()); ackCommand.setHost(taskExecutionContext.getHost()); if (TaskType.SQL.getDesc().equalsIgnoreCase(taskExecutionContext.getTaskType()) || TaskType.PROCEDURE.getDesc().equalsIgnoreCase(taskExecutionContext.getTaskType())) { ackCommand.setExecutePath(null); } else { ackCommand.setExecutePath(taskExecutionContext.getExecutePath()); } return ackCommand; } /** * get current TaskExecutionContext * * @return TaskExecutionContext */ public TaskExecutionContext getTaskExecutionContext() { return this.taskExecutionContext; } @Override public long getDelay(TimeUnit unit) { return unit.convert(DateUtils.getRemainTime(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getDelayTime() * 60L), TimeUnit.SECONDS); } @Override public int compareTo(Delayed o) { if (o == null) { return 1; } return Long.compare(this.getDelay(TimeUnit.MILLISECONDS), o.getDelay(TimeUnit.MILLISECONDS)); } private void preBuildBusinessParams() { Map<String, Property> paramsMap = new HashMap<>(); // replace variable TIME with $[YYYYmmddd...] in shell file when history run job and batch complement job if (taskExecutionContext.getScheduleTime() != null) { Date date = taskExecutionContext.getScheduleTime(); if (CommandType.COMPLEMENT_DATA.getCode() == taskExecutionContext.getCmdTypeIfComplement()) { date = DateUtils.add(taskExecutionContext.getScheduleTime(), DAY_OF_MONTH, 1); } String dateTime = DateUtils.format(date, Constants.PARAMETER_FORMAT_TIME); Property p = new Property(); p.setValue(dateTime); p.setProp(Constants.PARAMETER_DATETIME); paramsMap.put(Constants.PARAMETER_DATETIME, p); } taskExecutionContext.setParamsMap(paramsMap); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/process-instances/index.ts
/* * 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. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/process-instances/types.ts
/* * 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. */ interface CodeReq { projectCode: number } interface ProcessInstanceListReq { pageNo: number pageSize: number endDate?: string executorName?: string host?: string processDefineCode?: number processDefiniteCode?: string searchVal?: string startDate?: string stateType?: string } interface BatchDeleteReq { processInstanceIds: string projectName: string alertGroup?: string createTime?: string email?: string id?: number phone?: string queue?: string queueName?: string state?: number tenantCode?: string tenantId?: number updateTime?: string userName?: string userPassword?: string userType?: string } interface SubIdReq { subId: number } interface TaskReq { taskCode: string taskId: number } interface LongestReq { endTime: string size: number startTime: string } interface IdReq { id: number }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/projects/index.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/projects/types.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/queues/index.ts
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
7,462
[Feature][UI Next] Write part of the api method.
### 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 Write part of the api method. Please refer to the main `issue` [#7332](https://github.com/apache/dolphinscheduler/issues/7332). ### 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/7462
https://github.com/apache/dolphinscheduler/pull/7476
01a2b9684a4c6478ca4aea74b2307558c57468a7
2f7a406ea9d1cc79441759ae3691a88841f50fb7
"2021-12-17T06:48:25Z"
java
"2021-12-18T09:07:24Z"
dolphinscheduler-ui-next/src/service/modules/queues/types.ts