status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/plugin/DataSourceClientProvider.java
private static final DataSourceClientProvider INSTANCE = new DataSourceClientProvider(); } public static DataSourceClientProvider getInstance() { return DataSourceClientProviderHolder.INSTANCE; } public Connection getConnection(DbType dbType, ConnectionParam connectionParam) throws ExecutionException { BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam; String datasourceUniqueId = DataSourceUtils.getDatasourceUniqueId(baseConnectionParam, dbType); logger.info("getConnection datasourceUniqueId {}", datasourceUniqueId); DataSourceClient dataSourceClient = uniqueId2dataSourceClientCache.get(datasourceUniqueId, () -> { Map<String, DataSourceChannel> dataSourceChannelMap = dataSourcePluginManager.getDataSourceChannelMap(); DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getDescp()); if (null == dataSourceChannel) { throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getDescp())); } return dataSourceChannel.createDataSourceClient(baseConnectionParam, dbType); }); return dataSourceClient.getConnection(); } private void initDataSourcePlugin() { dataSourcePluginManager = new DataSourcePluginManager(); dataSourcePluginManager.installPlugin(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
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 com.google.common.util.concurrent.ThreadFactoryBuilder; import com.zaxxer.hikari.HikariDataSource; import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.hive.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 org.slf4j.Logger;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
import org.slf4j.LoggerFactory; import sun.security.krb5.Config; 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 static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.*; 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; private boolean retryGetConnection = true; public HiveDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { super(baseConnectionParam, dbType); } @Override protected void preInit() { logger.info("PreInit in {}", getClass().getName()); this.kerberosRenewalService = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("Hive-Kerberos-Renewal-Thread-").setDaemon(true).build()); } @Override protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) { logger.info("Create Configuration for hive configuration."); this.hadoopConf = createHadoopConf();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
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, dbType); 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); Boolean kerberosStartupState = PropertyUtils.getBoolean(HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false); if (kerberosStartupState && 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
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() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
return this.hadoopConf; } @Override public Connection getConnection() { try { return oneSessionDataSource.getConnection(); } catch (SQLException e) { boolean kerberosStartupState = PropertyUtils.getBoolean(HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false); if (retryGetConnection && kerberosStartupState) { retryGetConnection = false; createUserGroupInformation(baseConnectionParam.getUser()); Connection connection = getConnection(); retryGetConnection = true; return connection; } logger.error("get oneSessionDataSource Connection fail SQLException: {}", e.getMessage(), e); return null; } } @Override public void close() { super.close(); logger.info("close {}.", this.getClass().getSimpleName()); kerberosRenewalService.shutdown(); this.ugi = null; this.oneSessionDataSource.close(); this.oneSessionDataSource = null; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,918
[Bug] [DataSource] MySQL Connection number increasing
### 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 dolphin worker-server, mysql connection number increasing always, which lead mysql server cannot work. ![image](https://user-images.githubusercontent.com/25889738/178624684-ca6fa8eb-73e5-4dde-b0f2-d45a73208ca5.png) while the mysql connection like below: ![image](https://user-images.githubusercontent.com/25889738/178625005-caf48f0d-b3d4-434f-8fca-3c4073a654ff.png) ### What you expected to happen mysql connection number keep in normal number, ### How to reproduce use MySQL DataSource to perform frequent operations, such as query and create table/delete table/update table. ### Anything else _No response_ ### Version 3.0.0-beta-2 ### 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/10918
https://github.com/apache/dolphinscheduler/pull/11120
952aee80e78246dd6ea67ebbc6a7d3ade2ae2f62
71cf7e1baa7b813ac381c37c0345e837d2c07557
2022-07-13T00:49:08Z
java
2022-07-23T12:43:37Z
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/DataSourceClient.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.spi.datasource; import java.sql.Connection; public interface DataSourceClient { void checkClient(); void close(); Connection getConnection(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.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.common.utils; import static org.apache.dolphinscheduler.common.Constants.FOLDER_SEPARATOR; import static org.apache.dolphinscheduler.common.Constants.FORMAT_S_S; import static org.apache.dolphinscheduler.common.Constants.RESOURCE_TYPE_FILE; import static org.apache.dolphinscheduler.common.Constants.RESOURCE_TYPE_UDF; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ResUploadType; import org.apache.dolphinscheduler.common.exception.BaseException;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.spi.enums.ResourceType; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.security.UserGroupInformation; import java.io.BufferedReader; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.PrivilegedExceptionAction; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.node.ObjectNode;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; /** * hadoop utils * single instance */ public class HadoopUtils implements Closeable, StorageOperate { private static final Logger logger = LoggerFactory.getLogger(HadoopUtils.class); private String hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER); public static final String RM_HA_IDS = PropertyUtils.getString(Constants.YARN_RESOURCEMANAGER_HA_RM_IDS); public static final String APP_ADDRESS = PropertyUtils.getString(Constants.YARN_APPLICATION_STATUS_ADDRESS); public static final String JOB_HISTORY_ADDRESS = PropertyUtils.getString(Constants.YARN_JOB_HISTORY_STATUS_ADDRESS); public static final int HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE = PropertyUtils.getInt(Constants.HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT, 8088); private static final String HADOOP_UTILS_KEY = "HADOOP_UTILS_KEY"; private static final LoadingCache<String, HadoopUtils> cache = CacheBuilder .newBuilder() .expireAfterWrite(PropertyUtils.getInt(Constants.KERBEROS_EXPIRE_TIME, 2), TimeUnit.HOURS) .build(new CacheLoader<String, HadoopUtils>() { @Override public HadoopUtils load(String key) throws Exception { return new HadoopUtils(); } }); private volatile boolean yarnEnabled = false; private Configuration configuration; private FileSystem fs; private HadoopUtils() { hdfsUser = PropertyUtils.getString(Constants.HDFS_ROOT_USER); init();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
initHdfsPath(); } public static HadoopUtils getInstance() { return cache.getUnchecked(HADOOP_UTILS_KEY); } /** * init dolphinscheduler root path in hdfs */ private void initHdfsPath() { Path path = new Path(RESOURCE_UPLOAD_PATH); try { if (!fs.exists(path)) { fs.mkdirs(path); } } catch (Exception e) { logger.error(e.getMessage(), e); } } /** * init hadoop configuration */ private void init() throws NullPointerException { try { configuration = new HdfsConfiguration(); if (CommonUtils.loadKerberosConf(configuration)) { hdfsUser = ""; } String defaultFS = configuration.get(Constants.FS_DEFAULT_FS); if (StringUtils.isBlank(defaultFS)){ defaultFS= PropertyUtils.getString(Constants.FS_DEFAULT_FS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
} if (StringUtils.isNotBlank(defaultFS)) { Map<String, String> fsRelatedProps = PropertyUtils.getPrefixedProperties("fs."); configuration.set(Constants.FS_DEFAULT_FS, defaultFS); fsRelatedProps.forEach((key, value) -> configuration.set(key, value)); } else { logger.error("property:{} can not to be empty, please set!", Constants.FS_DEFAULT_FS); throw new NullPointerException( String.format("property: %s can not to be empty, please set!", Constants.FS_DEFAULT_FS) ); } if (!defaultFS.startsWith("file")) { logger.info("get property:{} -> {}, from core-site.xml hdfs-site.xml ", Constants.FS_DEFAULT_FS, defaultFS); } if (StringUtils.isNotEmpty(hdfsUser)) { UserGroupInformation ugi = UserGroupInformation.createRemoteUser(hdfsUser); ugi.doAs((PrivilegedExceptionAction<Boolean>) () -> { fs = FileSystem.get(configuration); return true; }); } else { logger.warn("resource.hdfs.root.user is not set value!"); fs = FileSystem.get(configuration); } } catch (Exception e) { logger.error(e.getMessage(), e); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
/** * @return Configuration */ public Configuration getConfiguration() { return configuration; } /** * @return DefaultFS */ public String getDefaultFS() { return getConfiguration().get(Constants.FS_DEFAULT_FS); } /** * get application url * if rmHaIds contains xx, it signs not use resourcemanager * otherwise: * if rmHaIds is empty, single resourcemanager enabled * if rmHaIds not empty: resourcemanager HA enabled * * @param applicationId application id * @return url of application */ public String getApplicationUrl(String applicationId) throws BaseException { yarnEnabled = true; String appUrl = StringUtils.isEmpty(RM_HA_IDS) ? APP_ADDRESS : getAppAddress(APP_ADDRESS, RM_HA_IDS); if (StringUtils.isBlank(appUrl)) { throw new BaseException("yarn application url generation failed"); } logger.debug("yarn application url:{}, applicationId:{}", appUrl, applicationId); return String.format(appUrl, HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE, applicationId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
} public String getJobHistoryUrl(String applicationId) { String jobId = applicationId.replace("application", "job"); return String.format(JOB_HISTORY_ADDRESS, jobId); } /** * cat file on hdfs * * @param hdfsFilePath hdfs file path * @return byte[] byte array * @throws IOException errors */ public byte[] catFile(String hdfsFilePath) throws IOException { if (StringUtils.isBlank(hdfsFilePath)) { logger.error("hdfs file path:{} is blank", hdfsFilePath); return new byte[0]; } try (FSDataInputStream fsDataInputStream = fs.open(new Path(hdfsFilePath))) { return IOUtils.toByteArray(fsDataInputStream); } } /** * cat file on hdfs * * @param hdfsFilePath hdfs file path * @param skipLineNums skip line numbers * @param limit read how many lines * @return content of file * @throws IOException errors
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
*/ public List<String> catFile(String hdfsFilePath, int skipLineNums, int limit) throws IOException { if (StringUtils.isBlank(hdfsFilePath)) { logger.error("hdfs file path:{} is blank", hdfsFilePath); return Collections.emptyList(); } try (FSDataInputStream in = fs.open(new Path(hdfsFilePath))) { BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); Stream<String> stream = br.lines().skip(skipLineNums).limit(limit); return stream.collect(Collectors.toList()); } } @Override public List<String> vimFile(String bucketName, String hdfsFilePath, int skipLineNums, int limit) throws IOException { return catFile(hdfsFilePath, skipLineNums, limit); } @Override public void createTenantDirIfNotExists(String tenantCode) throws IOException { getInstance().mkdir(tenantCode, getHdfsResDir(tenantCode)); getInstance().mkdir(tenantCode, getHdfsUdfDir(tenantCode)); } @Override public String getResDir(String tenantCode) { return getHdfsResDir(tenantCode); } @Override public String getUdfDir(String tenantCode) { return getHdfsUdfDir(tenantCode); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* make the given file and all non-existent parents into * directories. Has the semantics of Unix 'mkdir -p'. * Existence of the directory hierarchy is not an error. * * @param hdfsPath path to create * @return mkdir result * @throws IOException errors */ @Override public boolean mkdir(String tenantCode, String hdfsPath) throws IOException { return fs.mkdirs(new Path(hdfsPath)); } @Override public String getResourceFileName(String tenantCode, String fullName) { return getHdfsResourceFileName(tenantCode, fullName); } @Override public String getFileName(ResourceType resourceType, String tenantCode, String fileName) { return getHdfsFileName(resourceType, tenantCode, fileName); } @Override public void download(String bucketName, String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite) throws IOException { copyHdfsToLocal(srcHdfsFilePath, dstFile, deleteSource, overwrite); } /** * copy files between FileSystems * * @param srcPath source hdfs path * @param dstPath destination hdfs path * @param deleteSource whether to delete the src
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* @param overwrite whether to overwrite an existing file * @return if success or not * @throws IOException errors */ @Override public boolean copy(String srcPath, String dstPath, boolean deleteSource, boolean overwrite) throws IOException { return FileUtil.copy(fs, new Path(srcPath), fs, new Path(dstPath), deleteSource, overwrite, fs.getConf()); } /** * the src file is on the local disk. Add it to FS at * the given dst name. * * @param srcFile local file * @param dstHdfsPath destination hdfs path * @param deleteSource whether to delete the src * @param overwrite whether to overwrite an existing file * @return if success or not * @throws IOException errors */ public boolean copyLocalToHdfs(String srcFile, String dstHdfsPath, boolean deleteSource, boolean overwrite) throws IOException { Path srcPath = new Path(srcFile); Path dstPath = new Path(dstHdfsPath); fs.copyFromLocalFile(deleteSource, overwrite, srcPath, dstPath); return true; } @Override public boolean upload(String buckName, String srcFile, String dstPath, boolean deleteSource, boolean overwrite) throws IOException { return copyLocalToHdfs(srcFile, dstPath, deleteSource, overwrite); } /*
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* copy hdfs file to local * * @param srcHdfsFilePath source hdfs file path * @param dstFile destination file * @param deleteSource delete source * @param overwrite overwrite * @return result of copy hdfs file to local * @throws IOException errors */ public boolean copyHdfsToLocal(String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite) throws IOException { Path srcPath = new Path(srcHdfsFilePath); File dstPath = new File(dstFile); if (dstPath.exists()) { if (dstPath.isFile()) { if (overwrite) { Files.delete(dstPath.toPath()); } } else { logger.error("destination file must be a file"); } } if (!dstPath.getParentFile().exists() && !dstPath.getParentFile().mkdirs()) { return false; } return FileUtil.copy(fs, srcPath, dstPath, deleteSource, fs.getConf()); } /** * delete a file * * @param hdfsFilePath the path to delete.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* @param recursive if path is a directory and set to * true, the directory is deleted else throws an exception. In * case of a file the recursive can be set to either true or false. * @return true if delete is successful else false. * @throws IOException errors */ @Override public boolean delete(String tenantCode, String hdfsFilePath, boolean recursive) throws IOException { return fs.delete(new Path(hdfsFilePath), recursive); } /** * check if exists * * @param hdfsFilePath source file path * @return result of exists or not * @throws IOException errors */ @Override public boolean exists(String tenantCode, String hdfsFilePath) throws IOException { return fs.exists(new Path(hdfsFilePath)); } /** * Gets a list of files in the directory * * @param filePath file path * @return {@link FileStatus} file status * @throws IOException errors */ public FileStatus[] listFileStatus(String filePath) throws IOException { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
return fs.listStatus(new Path(filePath)); } catch (IOException e) { logger.error("Get file list exception", e); throw new IOException("Get file list exception", e); } } /** * Renames Path src to Path dst. Can take place on local fs * or remote DFS. * * @param src path to be renamed * @param dst new path after rename * @return true if rename is successful * @throws IOException on failure */ public boolean rename(String src, String dst) throws IOException { return fs.rename(new Path(src), new Path(dst)); } /** * hadoop resourcemanager enabled or not * * @return result */ public boolean isYarnEnabled() { return yarnEnabled; } /** * get the state of an application * * @param applicationId application id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* @return the return may be null or there may be other parse exceptions */ public ExecutionStatus getApplicationStatus(String applicationId) throws BaseException { if (StringUtils.isEmpty(applicationId)) { return null; } String result; String applicationUrl = getApplicationUrl(applicationId); logger.debug("generate yarn application url, applicationUrl={}", applicationUrl); String responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(applicationUrl) : HttpUtils.get(applicationUrl); if (responseContent != null) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("app")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("app").path("finalStatus").asText(); } else { String jobHistoryUrl = getJobHistoryUrl(applicationId); logger.debug("generate yarn job history application url, jobHistoryUrl={}", jobHistoryUrl); responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(jobHistoryUrl) : HttpUtils.get(jobHistoryUrl); if (null != responseContent) { ObjectNode jsonObject = JSONUtils.parseObject(responseContent); if (!jsonObject.has("job")) { return ExecutionStatus.FAILURE; } result = jsonObject.path("job").path("state").asText(); } else { return ExecutionStatus.FAILURE; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
} return getExecutionStatus(result); } private ExecutionStatus getExecutionStatus(String result) { switch (result) { case Constants.ACCEPTED: return ExecutionStatus.SUBMITTED_SUCCESS; case Constants.SUCCEEDED: case Constants.ENDED: return ExecutionStatus.SUCCESS; case Constants.NEW: case Constants.NEW_SAVING: case Constants.SUBMITTED: case Constants.FAILED: return ExecutionStatus.FAILURE; case Constants.KILLED: return ExecutionStatus.KILL; case Constants.RUNNING: default: return ExecutionStatus.RUNNING_EXECUTION; } } /** * get data hdfs path * * @return data hdfs path */ public static String getHdfsDataBasePath() { if (FOLDER_SEPARATOR.equals(RESOURCE_UPLOAD_PATH)) { return "";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
} else { return RESOURCE_UPLOAD_PATH; } } /** * hdfs resource dir * * @param tenantCode tenant code * @param resourceType resource type * @return hdfs resource dir */ public static String getHdfsDir(ResourceType resourceType, String tenantCode) { String hdfsDir = ""; if (resourceType.equals(ResourceType.FILE)) { hdfsDir = getHdfsResDir(tenantCode); } else if (resourceType.equals(ResourceType.UDF)) { hdfsDir = getHdfsUdfDir(tenantCode); } return hdfsDir; } @Override public String getDir(ResourceType resourceType, String tenantCode) { return getHdfsDir(resourceType, tenantCode); } /** * hdfs resource dir * * @param tenantCode tenant code * @return hdfs resource dir */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
public static String getHdfsResDir(String tenantCode) { return String.format("%s/" + RESOURCE_TYPE_FILE, getHdfsTenantDir(tenantCode)); } /** * hdfs udf dir * * @param tenantCode tenant code * @return get udf dir on hdfs */ public static String getHdfsUdfDir(String tenantCode) { return String.format("%s/" + RESOURCE_TYPE_UDF, getHdfsTenantDir(tenantCode)); } /** * get hdfs file name * * @param resourceType resource type * @param tenantCode tenant code * @param fileName file name * @return hdfs file name */ public static String getHdfsFileName(ResourceType resourceType, String tenantCode, String fileName) { if (fileName.startsWith(FOLDER_SEPARATOR)) { fileName = fileName.replaceFirst(FOLDER_SEPARATOR, ""); } return String.format(FORMAT_S_S, getHdfsDir(resourceType, tenantCode), fileName); } /** * get absolute path and name for resource file on hdfs * * @param tenantCode tenant code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* @param fileName file name * @return get absolute path and name for file on hdfs */ public static String getHdfsResourceFileName(String tenantCode, String fileName) { if (fileName.startsWith(FOLDER_SEPARATOR)) { fileName = fileName.replaceFirst(FOLDER_SEPARATOR, ""); } return String.format(FORMAT_S_S, getHdfsResDir(tenantCode), fileName); } /** * get absolute path and name for udf file on hdfs * * @param tenantCode tenant code * @param fileName file name * @return get absolute path and name for udf file on hdfs */ public static String getHdfsUdfFileName(String tenantCode, String fileName) { if (fileName.startsWith(FOLDER_SEPARATOR)) { fileName = fileName.replaceFirst(FOLDER_SEPARATOR, ""); } return String.format(FORMAT_S_S, getHdfsUdfDir(tenantCode), fileName); } /** * @param tenantCode tenant code * @return file directory of tenants on hdfs */ public static String getHdfsTenantDir(String tenantCode) { return String.format(FORMAT_S_S, getHdfsDataBasePath(), tenantCode); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
* getAppAddress * * @param appAddress app address * @param rmHa resource manager ha * @return app address */ public static String getAppAddress(String appAddress, String rmHa) { String activeRM = YarnHAAdminUtils.getActiveRMName(rmHa); if (StringUtils.isEmpty(activeRM)) { return null; } String[] split1 = appAddress.split(Constants.DOUBLE_SLASH); if (split1.length != 2) { return null; } String start = split1[0] + Constants.DOUBLE_SLASH; String[] split2 = split1[1].split(Constants.COLON); if (split2.length != 2) { return null; } String end = Constants.COLON + split2[1]; return start + activeRM + end; } @Override public void close() throws IOException { if (fs != null) { try { fs.close(); } catch (IOException e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
logger.error("Close HadoopUtils instance failed", e); throw new IOException("Close HadoopUtils instance failed", e); } } } /** * yarn ha admin utils */ private static final class YarnHAAdminUtils { /** * get active resourcemanager */ public static String getActiveRMName(String rmIds) { String[] rmIdArr = rmIds.split(Constants.COMMA); String yarnUrl = "http://%s:" + HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE + "/ws/v1/cluster/info"; try { /** * send http get request to rm */ for (String rmId : rmIdArr) { String state = getRMState(String.format(yarnUrl, rmId)); if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) { return rmId; } } } catch (Exception e) { logger.error("yarn ha application url generation failed, message:{}", e.getMessage()); } return null; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
/** * get ResourceManager state */ public static String getRMState(String url) { String retStr = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(url) : HttpUtils.get(url); if (StringUtils.isEmpty(retStr)) { return null; } ObjectNode jsonObject = JSONUtils.parseObject(retStr); if (!jsonObject.has("clusterInfo")) { return null; } return jsonObject.get("clusterInfo").path("haState").asText(); } } @Override public void deleteTenant(String tenantCode) throws Exception { String tenantPath = getHdfsDataBasePath() + FOLDER_SEPARATOR + tenantCode; if (exists(tenantCode, tenantPath)) { delete(tenantCode, tenantPath, true); } } @Override public ResUploadType returnStorageType() { return ResUploadType.HDFS; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.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.common.utils; import org.apache.dolphinscheduler.spi.utils.PropertyUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java
import org.apache.hadoop.security.UserGroupInformation; import java.net.InetAddress; import java.net.UnknownHostException; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * configuration test */ @RunWith(PowerMockRunner.class) @PrepareForTest(value = { PropertyUtils.class, UserGroupInformation.class}) public class CommonUtilsTest { private static final Logger logger = LoggerFactory.getLogger(CommonUtilsTest.class); @Test public void getSystemEnvPath() { String envPath; envPath = CommonUtils.getSystemEnvPath(); Assert.assertEquals("/etc/profile", envPath); } @Test public void isDevelopMode() { logger.info("develop mode: {}",CommonUtils.isDevelopMode()); Assert.assertTrue(true); } @Test public void getHdfsDataBasePath() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,013
[Improvement][Common] YarnHAAdminUtils#getActiveRMName function can not supported HTTPS Hadoop environment
### 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 HTTP requests are hard-coded in this place, and HTTPS Hadoop environment cannot be supported ![image](https://user-images.githubusercontent.com/27595289/179392569-6b1f58f7-714b-4e8b-bae7-5665bd9bf5d8.png) ### 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/11013
https://github.com/apache/dolphinscheduler/pull/11017
ccb76414686bf70d3ada7ad2d35fdc21c7b6f659
f13e7a95ae0c396e943ed048eacda54f9c7d68a1
2022-07-17T09:40:57Z
java
2022-07-25T03:07:40Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/CommonUtilsTest.java
logger.info(HadoopUtils.getHdfsDataBasePath()); Assert.assertTrue(true); } @Test public void getDownloadFilename() { logger.info(FileUtils.getDownloadFilename("a.txt")); Assert.assertTrue(true); } @Test public void getUploadFilename() { logger.info(FileUtils.getUploadFilename("1234", "a.txt")); Assert.assertTrue(true); } @Test public void getHdfsDir() { logger.info(HadoopUtils.getHdfsResDir("1234")); Assert.assertTrue(true); } @Test public void test() { InetAddress ip; try { ip = InetAddress.getLocalHost(); logger.info(ip.getHostAddress()); } catch (UnknownHostException e) { e.printStackTrace(); } Assert.assertTrue(true); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.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.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.http.HttpEntity;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.java
import org.apache.http.client.config.AuthSchemes; import org.apache.http.client.config.CookieSpecs; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.Objects; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * http utils */ public class HttpUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.java
public static final Logger logger = LoggerFactory.getLogger(HttpUtils.class); private HttpUtils() { throw new UnsupportedOperationException("Construct HttpUtils"); } public static CloseableHttpClient getInstance() { return HttpClientInstance.httpClient; } private static class HttpClientInstance { private static final CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).setDefaultRequestConfig(requestConfig).build(); } private static PoolingHttpClientConnectionManager cm; private static SSLContext ctx = null; private static SSLConnectionSocketFactory socketFactory; private static RequestConfig requestConfig; private static Registry<ConnectionSocketFactory> socketFactoryRegistry; private static X509TrustManager xtm = new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) { }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.java
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) { } @Override public X509Certificate[] getAcceptedIssuers() { return null; } }; static { try { ctx = SSLContext.getInstance(SSLConnectionSocketFactory.TLS); ctx.init(null, new TrustManager[]{xtm}, null); } catch (NoSuchAlgorithmException e) { logger.error("SSLContext init with NoSuchAlgorithmException", e); } catch (KeyManagementException e) { logger.error("SSLContext init with KeyManagementException", e); } socketFactory = new SSLConnectionSocketFactory(ctx, NoopHostnameVerifier.INSTANCE); requestConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES) .setExpectContinueEnabled(Boolean.TRUE) .setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.NTLM, AuthSchemes.DIGEST)) .setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.BASIC)) .setConnectTimeout(Constants.HTTP_CONNECT_TIMEOUT).setSocketTimeout(Constants.SOCKET_TIMEOUT) .setConnectionRequestTimeout(Constants.HTTP_CONNECTION_REQUEST_TIMEOUT).setRedirectsEnabled(true) .build(); socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", PlainConnectionSocketFactory.INSTANCE).register("https", socketFactory).build(); cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry); cm.setDefaultMaxPerRoute(60);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.java
cm.setMaxTotal(100); } /** * get http request content * * @param url url * @return http get request response content */ public static String get(String url) { CloseableHttpClient httpclient = HttpUtils.getInstance(); HttpGet httpget = new HttpGet(url); return getResponseContentString(httpget, httpclient); } /** * get http response content * * @param httpget httpget * @param httpClient httpClient * @return http get request response content */ public static String getResponseContentString(HttpGet httpget, CloseableHttpClient httpClient) { if (Objects.isNull(httpget) || Objects.isNull(httpClient)) { logger.error("HttpGet or HttpClient parameter is null"); return null; } String responseContent = null; CloseableHttpResponse response = null; try { response = httpClient.execute(httpget); // c
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HttpUtils.java
if (response.getStatusLine().getStatusCode() == 200) { HttpEntity entity = response.getEntity(); if (entity != null) { responseContent = EntityUtils.toString(entity, Constants.UTF_8); } else { logger.warn("http entity is null"); } } else { logger.error("http get:{} response status code is not 200!", response.getStatusLine().getStatusCode()); } } catch (IOException ioe) { logger.error(ioe.getMessage(), ioe); } finally { try { if (response != null) { EntityUtils.consume(response.getEntity()); response.close(); } } catch (IOException e) { logger.error(e.getMessage(), e); } if (!httpget.isAborted()) { httpget.releaseConnection(); httpget.abort(); } } return responseContent; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/KerberosHttpClient.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.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.http.auth.AuthSchemeProvider; import org.apache.http.auth.AuthScope; import org.apache.http.auth.Credentials;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/KerberosHttpClient.java
import org.apache.http.client.config.AuthSchemes; import org.apache.http.client.methods.HttpGet; import org.apache.http.config.Lookup; import org.apache.http.config.RegistryBuilder; import org.apache.http.impl.auth.SPNegoSchemeFactory; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import java.security.Principal; import java.security.PrivilegedAction; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.security.auth.Subject; import javax.security.auth.kerberos.KerberosPrincipal; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * kerberos http client */ public class KerberosHttpClient { public static final Logger logger = LoggerFactory.getLogger(KerberosHttpClient.class); private String principal; private String keyTabLocation; public KerberosHttpClient(String principal, String keyTabLocation) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/KerberosHttpClient.java
super(); this.principal = principal; this.keyTabLocation = keyTabLocation; } public KerberosHttpClient(String principal, String keyTabLocation, boolean isDebug) { this(principal, keyTabLocation); if (isDebug) { System.setProperty("sun.security.spnego.debug", "true"); System.setProperty("sun.security.krb5.debug", "true"); } } public KerberosHttpClient(String principal, String keyTabLocation, String krb5Location, boolean isDebug) { this(principal, keyTabLocation, isDebug); System.setProperty("java.security.krb5.conf", krb5Location); } private static CloseableHttpClient buildSpengoHttpClient() { HttpClientBuilder builder = HttpClientBuilder.create(); Lookup<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create() .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(true)).build(); builder.setDefaultAuthSchemeRegistry(authSchemeRegistry); BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(new AuthScope(null, -1, null), new Credentials() { @Override public Principal getUserPrincipal() { return null; } @Override public String getPassword() { return null; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/KerberosHttpClient.java
}); builder.setDefaultCredentialsProvider(credentialsProvider); return builder.build(); } public String get(final String url, final String userId) { logger.info("Calling KerberosHttpClient {} {} {}", this.principal, this.keyTabLocation, url); Configuration config = new Configuration() { @SuppressWarnings("serial") @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) { Map<String, Object> options = new HashMap<>(9); options.put("useTicketCache", "false"); options.put("useKeyTab", "true"); options.put("keyTab", keyTabLocation); options.put("refreshKrb5Config", "true"); options.put("principal", principal); options.put("storeKey", "true"); options.put("doNotPrompt", "true"); options.put("isInitiator", "true"); options.put("debug", "true"); return new AppConfigurationEntry[] { new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options) }; } }; Set<Principal> princ = new HashSet<>(1); princ.add(new KerberosPrincipal(userId)); Subject sub = new Subject(false, princ, new HashSet<>(), new HashSet<>()); LoginContext lc; try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/KerberosHttpClient.java
lc = new LoginContext("", sub, null, config); lc.login(); Subject serviceSubject = lc.getSubject(); return Subject.doAs(serviceSubject, (PrivilegedAction<String>) () -> { CloseableHttpClient httpClient = buildSpengoHttpClient(); HttpGet httpget = new HttpGet(url); return HttpUtils.getResponseContentString(httpget, httpClient); }); } catch (LoginException le) { logger.error("Kerberos authentication failed ", le); } return null; } /** * get http request content by kerberosClient * * @param url url * @return http get request response content */ public static String get(String url) { String responseContent; KerberosHttpClient kerberosHttpClient = new KerberosHttpClient( PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME), PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_PATH), PropertyUtils.getString(Constants.JAVA_SECURITY_KRB5_CONF_PATH), true); responseContent = kerberosHttpClient.get(url, PropertyUtils.getString(Constants.LOGIN_USER_KEY_TAB_USERNAME)); return responseContent; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LocalServerHttpUtilsTest.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.common.utils; import com.fasterxml.jackson.databind.node.ObjectNode; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.dolphinscheduler.common.Constants; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.junit.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LocalServerHttpUtilsTest extends TestCase{
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LocalServerHttpUtilsTest.java
public static final Logger logger = LoggerFactory.getLogger(LocalServerHttpUtilsTest.class); private static LocalJettyHttpServer server = null; public static Test suite(){ TestSuite suite=new TestSuite(); suite.addTestSuite(LocalServerHttpUtilsTest.class); server = new LocalJettyHttpServer(suite); return server; } public void testGetTest() throws Exception { String result = null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,072
[Improvement][Common] DS can not request Https url with Kerberos authentication
### 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 In some production environments, kerberos authentication is enabled for security purposes and HTTP ports are disabled while HTTPS ports are reserved , In this environment, DS cannot obtain information such as the start and stop of the application job on YARN ### 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/11072
https://github.com/apache/dolphinscheduler/pull/11127
7ed1e7cd742f0e62f41329467e91e7bf1c20cfa1
6f0a609793f6a157711dd8a5710107b9070788ed
2022-07-20T12:16:19Z
java
2022-07-25T15:21:42Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/LocalServerHttpUtilsTest.java
result = HttpUtils.get("http://localhost:" + server.getServerPort()+ "/test.json"); Assert.assertNotNull(result); ObjectNode jsonObject = JSONUtils.parseObject(result); Assert.assertEquals("Github",jsonObject.path("name").asText()); result = HttpUtils.get("http://123.333.111.33/ccc"); Assert.assertNull(result); } public void testGetResponseContentString() { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet("http://localhost:" +server.getServerPort()+"/test.json"); RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(Constants.HTTP_CONNECT_TIMEOUT) .setConnectionRequestTimeout(Constants.HTTP_CONNECTION_REQUEST_TIMEOUT) .setSocketTimeout(Constants.SOCKET_TIMEOUT).setRedirectsEnabled(true).build(); httpget.setConfig(requestConfig); String responseContent = null; responseContent = HttpUtils.getResponseContentString(httpget, httpclient); Assert.assertNotNull(responseContent); responseContent = HttpUtils.getResponseContentString(null, httpclient); Assert.assertNull(responseContent); responseContent = HttpUtils.getResponseContentString(httpget, null); Assert.assertNull(responseContent); } public void testGetHttpClient() { CloseableHttpClient httpClient1 = HttpUtils.getInstance(); CloseableHttpClient httpClient2 = HttpUtils.getInstance(); Assert.assertEquals(httpClient1, httpClient2); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.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 static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_LIST; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_BATCH_COPY; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_CREATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_EXPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_EXPORT;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_IMPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_ONLINE_OFFLINE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import static org.apache.dolphinscheduler.common.Constants.EMPTY_STRING; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMPLEX_TASK_TYPES; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SQL; import org.apache.dolphinscheduler.api.dto.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.ScheduleParam; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.service.WorkFlowLineageService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; 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.ConditionType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; 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.thread.Stopper; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskMainInfo; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; /** * process definition service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String RELEASESTATE = "releaseState"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private UserMapper userMapper; @Autowired private ProcessDefinitionLogMapper processDefinitionLogMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private ProcessTaskRelationLogMapper processTaskRelationLogMapper; @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private TenantMapper tenantMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired private TaskPluginManager taskPluginManager; @Autowired private WorkFlowLineageService workFlowLineageService; /** * create process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param description description * @param globalParams global params
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ @Override @Transactional public Map<String, Object> createProcessDefinition(User loginUser, long projectCode, String name, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson, String otherParamsJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { return checkTaskDefinitions; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } long processDefinitionCode; try { processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); } catch (CodeGenerateException e) { putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); return result; } ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
globalParams, locations, timeout, loginUser.getId(), tenantId); processDefinition.setExecutionType(executionType); return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson); } protected Map<String, Object> createDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion == 0) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} saveOtherRelation(loginUser, processDefinition, result, otherParamsJson); return result; } private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) { Map<String, Object> result = new HashMap<>(); try { if (taskDefinitionLogs.isEmpty()) { logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); return result; } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinitionLog.getTaskType()) .taskParams(taskDefinitionLog.getTaskParams()) .dependence(taskDefinitionLog.getDependence()) .build())) { logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); return result; } } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) { Map<String, Object> result = new HashMap<>(); try { if (taskRelationList == null || taskRelationList.isEmpty()) { logger.error("task relation list is null"); putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson); return result; } List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream() .map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class)) .collect(Collectors.toList()); List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs); if (taskNodeList.size() != taskRelationList.size()) { Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet()); Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet()); Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); if (CollectionUtils.isNotEmpty(codes)) { logger.error("the task code is not exist"); putMsg(result, Status.TASK_DEFINE_NOT_EXIST, org.apache.commons.lang.StringUtils.join(codes, Constants.COMMA)); return result; } } if (graphHasCycle(taskNodeList)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPostTaskCode() == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.error("the post_task_code or post_task_version can't be zero"); putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR); return result; } } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * query process definition list * * @param loginUser login user * @param projectCode project code * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } /** * query process definition simple list * * @param loginUser login user * @param projectCode project code * @return definition simple list */ @Override public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); ArrayNode arrayNode = JSONUtils.createArrayNode(); for (ProcessDefinition processDefinition : processDefinitions) { ObjectNode processDefinitionNode = JSONUtils.createObjectNode(); processDefinitionNode.put("id", processDefinition.getId()); processDefinitionNode.put("code", processDefinition.getCode()); processDefinitionNode.put("name", processDefinition.getName()); processDefinitionNode.put("projectCode", processDefinition.getProjectCode()); arrayNode.add(processDefinitionNode); } result.put(Constants.DATA_LIST, arrayNode); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } /** * query process definition list paging * * @param loginUser login user * @param projectCode project code * @param searchVal search value * @param userId user id * @param pageNo page number * @param pageSize page size * @return process definition page */ @Override public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, String otherParamsJson, Integer userId, Integer pageNo, Integer pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging( page, searchVal, userId, project.getCode(), isAdmin(loginUser)); List<ProcessDefinition> records = processDefinitionIPage.getRecords(); for (ProcessDefinition pd : records) { ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
User user = userMapper.selectById(processDefinitionLog.getOperator()); pd.setModifyBy(user.getUserName()); } processDefinitionIPage.setRecords(records); PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) processDefinitionIPage.getTotal()); pageInfo.setTotalList(processDefinitionIPage.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query detail of process definition * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return process definition detail */ @Override public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} else { Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId()); if (tenant != null) { processDefinition.setTenantCode(tenant.getTenantCode()); } DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name); } else { DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* update process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param code process definition code * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @param otherParamsJson otherParamsJson handle other params * @return update result code */ @Override @Transactional public Map<String, Object> updateProcessDefinition(User loginUser, long projectCode, String name, long code, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson, String otherParamsJson,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_UPDATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson); if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) { return checkTaskDefinitions; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); return result; } if (!name.equals(processDefinition.getName())) { ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } } ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId); processDefinition.setExecutionType(executionType); return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs, otherParamsJson); } /** * Task want to delete whether used in other task, should throw exception when have be used. * * This function avoid delete task already dependencies by other tasks by accident. * * @param processDefinition ProcessDefinition you change task definition and task relation * @param taskRelationList All the latest task relation list from process definition */ private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition, List<ProcessTaskRelationLog> taskRelationList) { List<ProcessTaskRelation> oldProcessTaskRelationList = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Set<ProcessTaskRelationLog> oldProcessTaskRelationSet = oldProcessTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toSet()); StringBuilder sb = new StringBuilder(); for (ProcessTaskRelationLog oldProcessTaskRelation: oldProcessTaskRelationSet) { boolean oldTaskExists = taskRelationList.stream().anyMatch(relation -> oldProcessTaskRelation.getPostTaskCode() == relation.getPostTaskCode()); if (!oldTaskExists) { Optional<String> taskDepMsg = workFlowLineageService.taskDepOnTaskMsg( processDefinition.getProjectCode(), oldProcessTaskRelation.getProcessDefinitionCode(), oldProcessTaskRelation.getPostTaskCode()); taskDepMsg.ifPresent(sb::append); } if (sb.length() != 0) { throw new ServiceException(sb.toString()); } } } protected Map<String, Object> updateDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, ProcessDefinition processDefinitionDeepCopy, List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); } boolean isChange = false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinition.equals(processDefinitionDeepCopy) && saveTaskResult == Constants.EXIT_CODE_SUCCESS) { List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); if (taskRelationList.size() == processTaskRelationLogList.size()) { Set<ProcessTaskRelationLog> taskRelationSet = taskRelationList.stream().collect(Collectors.toSet()); Set<ProcessTaskRelationLog> processTaskRelationLogSet = processTaskRelationLogList.stream().collect(Collectors.toSet()); if (taskRelationSet.size() == processTaskRelationLogSet.size()) { taskRelationSet.removeAll(processTaskRelationLogSet); if (!taskRelationSet.isEmpty()) { isChange = true; } } else { isChange = true; } } else { isChange = true; } } else { isChange = true; } if (isChange) { processDefinition.setUpdateTime(new Date()); int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion <= 0) { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } taskUsedInOtherTaskValid(processDefinition, taskRelationList); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } saveOtherRelation(loginUser, processDefinition, result, otherParamsJson); } else { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectCode project code * @param name name * @return true if process definition name not exists, otherwise false */ @Override public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinition == null) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim()); } return result; } /** * Process definition want to delete whether used in other task, should throw exception when have be used. * * This function avoid delete process definition already dependencies by other tasks by accident. * * @param processDefinition ProcessDefinition you change task definition and task relation */ private void processDefinitionUsedInOtherTaskValid(ProcessDefinition processDefinition) { if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { throw new ServiceException(Status.PROCESS_DEFINE_STATE_ONLINE, processDefinition.getName()); } List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_EXECUTING_FAIL, processInstances.size()); } Set<TaskMainInfo> taskDepOnProcess = workFlowLineageService.queryTaskDepOnProcess(processDefinition.getProjectCode(), processDefinition.getCode()); if (CollectionUtils.isNotEmpty(taskDepOnProcess)) { String taskDepDetail = taskDepOnProcess.stream() .map(task -> String.format(Constants.FORMAT_S_S_COLON, task.getProcessDefinitionName(), task.getTaskName())) .collect(Collectors.joining(Constants.COMMA));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL, taskDepDetail); } } /** * delete process definition by code * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return delete result code */ @Override @Transactional public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION_DELETE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefinitionUsedInOtherTaskValid(processDefinition); Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code); if (scheduleObj != null) { if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) { int delete = scheduleMapper.deleteById(scheduleObj.getId()); if (delete == 0) { putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); } } if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId()); return result; } } int delete = processDefinitionMapper.deleteById(processDefinition.getId()); if (delete == 0) { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); if (deleteRelation == 0) { logger.warn("The process definition has not relation, it will be delete successfully"); } deleteOtherRelation(project, result, processDefinition); putMsg(result, Status.SUCCESS); return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* release process definition: online / offline * * @param loginUser login user * @param projectCode project code * @param code process definition code * @param releaseState release state * @return release result code */ @Override @Transactional public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_ONLINE_OFFLINE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) { case ONLINE: List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (CollectionUtils.isEmpty(relationList)) { putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } processDefinition.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(releaseState); int updateProcess = processDefinitionMapper.updateById(processDefinition); Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code); if (updateProcess > 0 && schedule != null) { logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, schedule.getId(), code); schedule.setReleaseState(releaseState); int updateSchedule = scheduleMapper.updateById(schedule); if (updateSchedule == 0) { putMsg(result, Status.OFFLINE_SCHEDULE_ERROR); throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR); } schedulerService.deleteSchedule(project.getId(), schedule.getId()); } break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * batch export process definition by codes */ @Override public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) { if (org.apache.commons.lang.StringUtils.isEmpty(codes)) { return; } Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION_EXPORT); if (result.get(Constants.STATUS) != Status.SUCCESS) { return; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); if (CollectionUtils.isEmpty(processDefinitionList)) { return; } List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream().filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList()); List<DagDataSchedule> dagDataSchedules = processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(dagDataSchedules)) { downloadProcessDefinitionFile(response, dagDataSchedules); } } /** * download the process definition file */ protected void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { logger.warn("export process fail", e); } finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("export process buffer not close", e); } } if (null != out) { try { out.close(); } catch (Exception e) { logger.warn("export process output stream not close", e); } } } } /** * get export process dag data
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* * @param processDefinition process definition * @return DagDataSchedule */ public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode()); DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition)); if (scheduleObj != null) { scheduleObj.setReleaseState(ReleaseState.OFFLINE); dagDataSchedule.setSchedule(scheduleObj); } return dagDataSchedule; } /** * import process definition * * @param loginUser login user * @param projectCode project code * @param file process metadata json file * @return import process */ @Override @Transactional public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result = new HashMap<>(); String dagDataScheduleJson = FileUtils.file2String(file); List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_EXPORT); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } if (CollectionUtils.isEmpty(dagDataScheduleList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for (DagDataSchedule dagDataSchedule : dagDataScheduleList) { if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule, EMPTY_STRING)) { return result; } } return result; } @Override @Transactional public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_IMPORT); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename(); int index = processDefinitionName.lastIndexOf("."); if (index > 0) { processDefinitionName = processDefinitionName.substring(0, index); } processDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(); ProcessDefinition processDefinition;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>(); List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>(); final int THRESHOLD_ENTRIES = 10000; final int THRESHOLD_SIZE = 1000000000; final double THRESHOLD_RATIO = 10; int totalEntryArchive = 0; int totalSizeEntry = 0; Map<String, DataSource> dataSourceCache = new HashMap<>(1); Map<String, Long> taskNameToCode = new HashMap<>(16); Map<String, List<String>> taskNameToUpstream = new HashMap<>(16); try (ZipInputStream zIn = new ZipInputStream(file.getInputStream()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) { processDefinition = new ProcessDefinition(projectCode, processDefinitionName, CodeGenerateUtils.getInstance().genCode(), "", "[]", null, 0, loginUser.getId(), loginUser.getTenantId()); ZipEntry entry; while ((entry = zIn.getNextEntry()) != null) { totalEntryArchive++; int totalSizeArchive = 0; if (!entry.isDirectory()) { StringBuilder sql = new StringBuilder(); String taskName = null; String datasourceName = null; List<String> upstreams = Collections.emptyList();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
String line; while ((line = bufferedReader.readLine()) != null) { int nBytes = line.getBytes(StandardCharsets.UTF_8).length; totalSizeEntry += nBytes; totalSizeArchive += nBytes; long compressionRatio = totalSizeEntry / entry.getCompressedSize(); if (compressionRatio > THRESHOLD_RATIO) { throw new IllegalStateException("ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack"); } int commentIndex = line.indexOf("-- "); if (commentIndex >= 0) { int colonIndex = line.indexOf(":", commentIndex); if (colonIndex > 0) { String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase(); String value = line.substring(colonIndex + 1).trim(); switch (key) { case "name": taskName = value; line = line.substring(0, commentIndex); break; case "upstream": upstreams = Arrays.stream(value.split(",")).map(String::trim) .filter(s -> !"".equals(s)).collect(Collectors.toList()); line = line.substring(0, commentIndex); break; case "datasource": datasourceName = value; line = line.substring(0, commentIndex); break; default:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
break; } } } if (!"".equals(line)) { sql.append(line).append("\n"); } } if (taskName == null) { taskName = entry.getName(); index = taskName.indexOf("/"); if (index > 0) { taskName = taskName.substring(index + 1); } index = taskName.lastIndexOf("."); if (index > 0) { taskName = taskName.substring(0, index); } } DataSource dataSource = dataSourceCache.get(datasourceName); if (dataSource == null) { dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser); } if (dataSource == null) { putMsg(result, Status.DATASOURCE_NAME_ILLEGAL); return result; } dataSourceCache.put(datasourceName, dataSource); TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
taskDefinitionList.add(taskDefinition); taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode()); taskNameToUpstream.put(taskDefinition.getName(), upstreams); } if (totalSizeArchive > THRESHOLD_SIZE) { throw new IllegalStateException("the uncompressed data size is too much for the application resource capacity"); } if (totalEntryArchive > THRESHOLD_ENTRIES) { throw new IllegalStateException("too much entries in this archive, can lead to inodes exhaustion of the system"); } } } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return result; } for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) { List<String> upstreams = taskNameToUpstream.get(entry.getKey()); if (CollectionUtils.isEmpty(upstreams) || (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue()); processTaskRelationList.add(processTaskRelation); continue; } for (String upstream : upstreams) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue()); processTaskRelationList.add(processTaskRelation); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING); } private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) { ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog(); processTaskRelation.setPreTaskCode(preTaskCode); processTaskRelation.setPreTaskVersion(0); processTaskRelation.setPostTaskCode(postTaskCode); processTaskRelation.setPostTaskVersion(0); processTaskRelation.setConditionType(ConditionType.NONE); processTaskRelation.setName(""); return processTaskRelation; } private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) { if (isAdmin(loginUser)) { List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName); if (CollectionUtils.isNotEmpty(dataSources)) { return dataSources.get(0); } } else { return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName); } return null; } private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException { TaskDefinitionLog taskDefinition = new TaskDefinitionLog(); taskDefinition.setName(taskName); taskDefinition.setFlag(Flag.YES); SqlParameters sqlParameters = new SqlParameters(); sqlParameters.setType(dataSource.getType().name()); sqlParameters.setDatasource(dataSource.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
sqlParameters.setSql(sql.substring(0, sql.length() - 1)); sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal()); sqlParameters.setLocalParams(Collections.emptyList()); taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters)); taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); taskDefinition.setTaskType(TASK_TYPE_SQL); taskDefinition.setFailRetryTimes(0); taskDefinition.setFailRetryInterval(0); taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE); taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP); taskDefinition.setTaskPriority(Priority.MEDIUM); taskDefinition.setEnvironmentCode(-1); taskDefinition.setTimeout(0); taskDefinition.setDelayTime(0); taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN); taskDefinition.setVersion(0); taskDefinition.setResourceIds(""); return taskDefinition; } /** * check and import */ protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) { if (!checkImportanceParams(dagDataSchedule, result)) { return false; } ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
String importProcessDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(); Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName); if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } processDefinition.setName(importProcessDefinitionName); processDefinition.setId(0); processDefinition.setProjectCode(projectCode); processDefinition.setUserId(loginUser.getId()); try { processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); return false; } List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList(); Map<Long, Long> taskCodeMap = new HashMap<>(); Date now = new Date(); List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); for (TaskDefinition taskDefinition : taskDefinitionList) { TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition); taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp()); taskDefinitionLog.setProjectCode(projectCode); taskDefinitionLog.setUserId(loginUser.getId()); taskDefinitionLog.setVersion(Constants.VERSION_FIRST); taskDefinitionLog.setCreateTime(now);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
taskDefinitionLog.setUpdateTime(now); taskDefinitionLog.setOperator(loginUser.getId()); taskDefinitionLog.setOperateTime(now); try { long code = CodeGenerateUtils.getInstance().genCode(); taskCodeMap.put(taskDefinitionLog.getCode(), code); taskDefinitionLog.setCode(code); } catch (CodeGenerateException e) { logger.error("Task code get error, ", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); return false; } taskDefinitionLogList.add(taskDefinitionLog); } int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList); int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList); if ((logInsert & insert) == 0) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>(); for (ProcessTaskRelation processTaskRelation : taskRelationList) { ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation); if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); } if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) { processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST); processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); taskRelationLogList.add(processTaskRelationLog); } if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) { ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations()); ArrayNode newArrayNode = JSONUtils.createArrayNode(); for (int i = 0; i < arrayNode.size(); i++) { ObjectNode newObjectNode = newArrayNode.addObject(); JsonNode jsonNode = arrayNode.get(i); Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong()); if (Objects.nonNull(taskCode)) { newObjectNode.put("taskCode", taskCode); newObjectNode.set("x", jsonNode.get("x")); newObjectNode.set("y", jsonNode.get("y")); } } processDefinition.setLocations(newArrayNode.toString()); } processDefinition.setCreateTime(new Date()); processDefinition.setUpdateTime(new Date()); Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList(), otherParamsJson); if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) { putMsg(createDagResult, Status.SUCCESS); } else { result.putAll(createDagResult); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } Schedule schedule = dagDataSchedule.getSchedule(); if (null != schedule) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode()); schedule.setProcessDefinitionCode(newProcessDefinition.getCode()); schedule.setUserId(loginUser.getId()); schedule.setCreateTime(now); schedule.setUpdateTime(now); int scheduleInsert = scheduleMapper.insert(schedule); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } } return true; } /** * check importance params */ private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) { if (dagDataSchedule.getProcessDefinition() == null) { putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) { putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) { putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList"); return false; } return true;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) { ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); if (processDefinition != null) { if (num > 1) { String str = processDefinitionName.substring(0, processDefinitionName.length() - 3); processDefinitionName = str + "(" + num + ")"; } else { processDefinitionName = processDefinition.getName() + "(" + num + ")"; } } else { return processDefinitionName; } return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1); } /** * check the process task relation json * * @param processTaskRelationJson process task relation json * @return check result code */ @Override public Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogsList) { Map<String, Object> result = new HashMap<>(); try { if (processTaskRelationJson == null) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class); List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList); if (CollectionUtils.isEmpty(taskNodes)) { logger.error("process node info is empty"); putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } if (graphHasCycle(taskNodes)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (TaskNode taskNode : taskNodes) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskNode.getType()) .taskParams(taskNode.getTaskParams()) .dependence(taskNode.getDependence()) .switchResult(taskNode.getSwitchResult()) .build())) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} catch (Exception e) { result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage()); logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e); } return result; } /** * get task node details based on process definition * * @param loginUser loginUser * @param projectCode project code * @param code process definition code * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } DagData dagData = processService.genDagData(processDefinition);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList()); putMsg(result, Status.SUCCESS); return result; } /** * get task node details map based on process definition * * @param loginUser loginUser * @param projectCode project code * @param codes define codes * @return task node list */ @Override public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.info("process definition not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result; } HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE); projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId()) .forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream() .filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(processDefinitionListInProject)) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result; } Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>(); for (ProcessDefinition processDefinition : processDefinitionListInProject) { DagData dagData = processService.genDagData(processDefinition); taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList()); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project code * * @param loginUser loginUser * @param projectCode project code * @return process definitions in the project */ @Override public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list by project code * * @param projectCode project code * @return process definition list in the project */ @Override public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) { Map<String, Object> result = new HashMap<>(); List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null); result.put(Constants.DATA_LIST, processDefinitions); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list by process definition code * * @param projectCode project code * @param processDefinitionCode process definition code * @return task definition list in the process definition */ @Override public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = new HashMap<>(); Set<Long> definitionCodesSet = new HashSet<>(); definitionCodesSet.add(processDefinitionCode); List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode( processDefinitions.get(0).getCode(), processDefinitions.get(0).getVersion()); List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations); List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) { DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition(); dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode()); dependentSimplifyDefinition.setName(taskDefinitionLog.getName()); dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion()); taskDefinitionList.add(dependentSimplifyDefinition); } result.put(Constants.DATA_LIST, taskDefinitionList); putMsg(result, Status.SUCCESS); return result; } /** * Encapsulates the TreeView structure * * @param projectCode project code * @param code process definition code * @param limit limit * @return tree view json data */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@Override public Map<String, Object> viewTree(User loginUser,long projectCode, long code, Integer limit) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_TREE_VIEW); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (null == processDefinition || projectCode != processDefinition.getProjectCode()) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition); Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>(); Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit); processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()))); List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode())); Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream() .collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); parentTreeViewDto.setCode(0L); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(), "", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (Stopper.isRunning()) { Set<String> postNodeList; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeCode = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); TaskNode taskNode = dag.getNode(nodeCode); treeViewDto.setType(taskNode.getType()); treeViewDto.setCode(taskNode.getCode()); treeViewDto.setName(taskNode.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode)); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); long subProcessCode = 0L; if (taskInstance.isSubProcess()) { TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode()); subProcessCode = Long.parseLong(JSONUtils.parseObject( taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(), taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode)); } } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeCode); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeCode : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode); if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList); } } runningNodeMap.remove(nodeCode); } if (waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>(); for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (TaskNode taskNodeResponse : taskNodeResponseList) { List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) { if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) { return true; } } } } return graph.hasCycle(); } /** * batch copy process definition * * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override public Map<String, Object> batchCopyProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,WORKFLOW_BATCH_COPY); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,604
[Feature][Api] Task name in the copied workflow without copy suffix
### 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 In most cases, the task name does not need to be changed in copied workflow , task name do not need add copy suffix ### Use case copied task name without copy suffix <img width="549" alt="image" src="https://user-images.githubusercontent.com/13765310/175551021-a2f13221-592e-4441-85ff-4042e3d9f7c6.png"> ### 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/10604
https://github.com/apache/dolphinscheduler/pull/10607
c7789bf0499f5893810d93e144250544a528caa4
5ebd53893cce180e1af9fa6b067ca6c58d22a5d4
2022-06-24T13:57:15Z
java
2022-07-26T07:21:33Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true); if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) { return result; } checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true); return result; } /** * batch move process definition * Will be deleted * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override @Transactional public Map<String, Object> batchMoveProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,TASK_DEFINITION_MOVE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (projectCode == targetProjectCode) { return result; } List<String> failedProcessList = new ArrayList<>();