Merge branch 'apache:dev' into dev

This commit is contained in:
FalconSL 2024-04-29 14:29:55 +08:00 committed by GitHub
commit 35f0aaccee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 126 additions and 96 deletions

View File

@ -49,4 +49,4 @@ github:
- "Mergeable: milestone-label-check"
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 1
required_approving_review_count: 2

View File

@ -183,11 +183,10 @@ public class OSUtils {
*
* @param userName user name
*/
public static void createUserIfAbsent(String userName) {
public static synchronized void createUserIfAbsent(String userName) {
// if not exists this user, then create
if (!getUserList().contains(userName)) {
boolean isSuccess = createUser(userName);
log.info("create user {} {}", userName, isSuccess ? "success" : "fail");
createUser(userName);
}
}
@ -197,13 +196,12 @@ public class OSUtils {
* @param userName user name
* @return true if creation was successful, otherwise false
*/
public static boolean createUser(String userName) {
public static void createUser(String userName) {
try {
String userGroup = getGroup();
if (StringUtils.isEmpty(userGroup)) {
String errorLog = String.format("%s group does not exist for this operating system.", userGroup);
log.error(errorLog);
return false;
throw new UnsupportedOperationException(
"There is no userGroup exist cannot create tenant, please create userGroupFirst");
}
if (SystemUtils.IS_OS_MAC) {
createMacUser(userName, userGroup);
@ -212,18 +210,17 @@ public class OSUtils {
} else {
createLinuxUser(userName, userGroup);
}
return true;
log.info("Create tenant {} under userGroup: {} success", userName, userGroup);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException("Create tenant: {} failed", e);
}
return false;
}
/**
* create linux user
*
* @param userName user name
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
@ -237,7 +234,7 @@ public class OSUtils {
/**
* create mac user (Supports Mac OSX 10.10+)
*
* @param userName user name
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
@ -256,7 +253,7 @@ public class OSUtils {
/**
* create windows user
*
* @param userName user name
* @param userName user name
* @param userGroup user group
* @throws IOException in case of an I/O error
*/
@ -304,7 +301,7 @@ public class OSUtils {
* get sudo command
*
* @param tenantCode tenantCode
* @param command command
* @param command command
* @return result of sudo execute command
*/
public static String getSudoCmd(String tenantCode, String command) {

View File

@ -118,7 +118,7 @@ public abstract class AbstractDataSourceProcessor implements DataSourceProcessor
@Override
public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam;
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getDescp(), baseConnectionParam.getUser(),
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getName(), baseConnectionParam.getUser(),
PasswordUtils.encodePassword(baseConnectionParam.getPassword()), baseConnectionParam.getJdbcUrl());
}

View File

@ -69,9 +69,9 @@ public class DataSourceClientProvider {
String datasourceUniqueId = DataSourceUtils.getDatasourceUniqueId(baseConnectionParam, dbType);
return POOLED_DATASOURCE_CLIENT_CACHE.get(datasourceUniqueId, () -> {
Map<String, DataSourceChannel> dataSourceChannelMap = dataSourcePluginManager.getDataSourceChannelMap();
DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getDescp());
DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getName());
if (null == dataSourceChannel) {
throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getDescp()));
throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getName()));
}
return dataSourceChannel.createPooledDataSourceClient(baseConnectionParam, dbType);
});
@ -85,9 +85,9 @@ public class DataSourceClientProvider {
public static AdHocDataSourceClient getAdHocDataSourceClient(DbType dbType, ConnectionParam connectionParam) {
BaseConnectionParam baseConnectionParam = (BaseConnectionParam) connectionParam;
Map<String, DataSourceChannel> dataSourceChannelMap = dataSourcePluginManager.getDataSourceChannelMap();
DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getDescp());
DataSourceChannel dataSourceChannel = dataSourceChannelMap.get(dbType.getName());
if (null == dataSourceChannel) {
throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getDescp()));
throw new RuntimeException(String.format("datasource plugin '%s' is not found", dbType.getName()));
}
return dataSourceChannel.createAdHocDataSourceClient(baseConnectionParam, dbType);
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.athena;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -32,6 +33,6 @@ public class AthenaDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return "athena";
return DbType.ATHENA.getName();
}
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.azuresql;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class AzureSQLDataSourceChannelFactory implements DataSourceChannelFactor
@Override
public String getName() {
return "azuresql";
return DbType.AZURESQL.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.clickhouse;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class ClickHouseDataSourceChannelFactory implements DataSourceChannelFact
@Override
public String getName() {
return "clickhouse";
return DbType.CLICKHOUSE.getName();
}
@Override

View File

@ -28,7 +28,7 @@ public class DamengDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return DbType.DAMENG.getDescp();
return DbType.DAMENG.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.databend;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class DatabendDataSourceChannelFactory implements DataSourceChannelFactor
@Override
public String getName() {
return "databend";
return DbType.DATABEND.getName();
}
@Override

View File

@ -151,7 +151,7 @@ public class DatabendDataSourceProcessorTest {
@Test
public void testDbType() {
Assertions.assertEquals(19, DbType.DATABEND.getCode());
Assertions.assertEquals("databend", DbType.DATABEND.getDescp());
Assertions.assertEquals("databend", DbType.DATABEND.getName());
Assertions.assertEquals(DbType.DATABEND, DbType.of(19));
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.db2;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class DB2DataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "db2";
return DbType.DB2.getName();
}
@Override

View File

@ -32,6 +32,6 @@ public class DorisDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return DbType.DORIS.getDescp();
return DbType.DORIS.getName();
}
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.hana;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class HanaDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "hana";
return DbType.HANA.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.hive;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class HiveDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "hive";
return DbType.HIVE.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.k8s;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -32,7 +33,7 @@ public class K8sDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "k8s";
return DbType.K8S.getName();
}
}

View File

@ -58,7 +58,7 @@ public class K8sDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
K8sConnectionParam baseConnectionParam = (K8sConnectionParam) connectionParam;
return MessageFormat.format("{0}@{1}@{2}", dbType.getDescp(),
return MessageFormat.format("{0}@{1}@{2}", dbType.getName(),
PasswordUtils.encodePassword(baseConnectionParam.getKubeConfig()), baseConnectionParam.getNamespace());
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.kyuubi;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class KyuubiDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return "kyuubi";
return DbType.KYUUBI.getName();
}
@Override

View File

@ -143,7 +143,7 @@ public class KyuubiDataSourceProcessorTest {
@Test
public void testDbType() {
Assertions.assertEquals(18, DbType.KYUUBI.getCode());
Assertions.assertEquals("kyuubi", DbType.KYUUBI.getDescp());
Assertions.assertEquals("kyuubi", DbType.KYUUBI.getName());
Assertions.assertEquals(DbType.KYUUBI, DbType.of(18));
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.mysql;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class MySQLDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "mysql";
return DbType.MYSQL.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.oceanbase;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class OceanBaseDataSourceChannelFactory implements DataSourceChannelFacto
@Override
public String getName() {
return "oceanbase";
return DbType.OCEANBASE.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.oracle;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class OracleDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return "oracle";
return DbType.ORACLE.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.postgresql;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class PostgreSQLDataSourceChannelFactory implements DataSourceChannelFact
@Override
public String getName() {
return "postgresql";
return DbType.POSTGRESQL.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.presto;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class PrestoDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return "presto";
return DbType.PRESTO.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.redshift;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -32,6 +33,6 @@ public class RedshiftDataSourceChannelFactory implements DataSourceChannelFactor
@Override
public String getName() {
return "redshift";
return DbType.REDSHIFT.getName();
}
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.sagemaker;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -32,7 +33,7 @@ public class SagemakerDataSourceChannelFactory implements DataSourceChannelFacto
@Override
public String getName() {
return "sagemaker";
return DbType.SAGEMAKER.getName();
}
}

View File

@ -57,7 +57,7 @@ public class SagemakerDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
SagemakerConnectionParam baseConnectionParam = (SagemakerConnectionParam) connectionParam;
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getDescp(),
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getName(),
PasswordUtils.encodePassword(baseConnectionParam.getUserName()),
PasswordUtils.encodePassword(baseConnectionParam.getPassword()),
PasswordUtils.encodePassword(baseConnectionParam.getAwsRegion()));

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.snowflake;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class SnowflakeDataSourceChannelFactory implements DataSourceChannelFacto
@Override
public String getName() {
return "snowflake";
return DbType.SNOWFLAKE.getName();
}
@Override

View File

@ -169,7 +169,7 @@ public class SnowflakeDataSourceProcessorTest {
@Test
public void testDbType() {
Assertions.assertEquals(20, DbType.SNOWFLAKE.getCode());
Assertions.assertEquals("snowflake", DbType.SNOWFLAKE.getDescp());
Assertions.assertEquals("snowflake", DbType.SNOWFLAKE.getName());
Assertions.assertEquals(DbType.of(20), DbType.SNOWFLAKE);
Assertions.assertEquals(DbType.ofName("SNOWFLAKE"), DbType.SNOWFLAKE);
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.spark;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class SparkDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "spark";
return DbType.SPARK.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.sqlserver;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class SQLServerDataSourceChannelFactory implements DataSourceChannelFacto
@Override
public String getName() {
return "sqlserver";
return DbType.SQLSERVER.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.ssh;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class SSHDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "ssh";
return DbType.SSH.getName();
}
@Override

View File

@ -55,7 +55,7 @@ public class SSHDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
SSHConnectionParam baseConnectionParam = (SSHConnectionParam) connectionParam;
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getDescp(), baseConnectionParam.getHost(),
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getName(), baseConnectionParam.getHost(),
baseConnectionParam.getUser(),
PasswordUtils.encodePassword(baseConnectionParam.getPassword()));
}

View File

@ -33,6 +33,6 @@ public class StarRocksDataSourceChannelFactory implements DataSourceChannelFacto
@Override
public String getName() {
return DbType.STARROCKS.getDescp();
return DbType.STARROCKS.getName();
}
}

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.trino;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class TrinoDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "trino";
return DbType.TRINO.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -27,7 +28,7 @@ public class VerticaDataSourceChannelFactory implements DataSourceChannelFactory
@Override
public String getName() {
return "vertica";
return DbType.VERTICA.getName();
}
@Override

View File

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.zeppelin;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import org.apache.dolphinscheduler.spi.enums.DbType;
import com.google.auto.service.AutoService;
@ -32,7 +33,7 @@ public class ZeppelinDataSourceChannelFactory implements DataSourceChannelFactor
@Override
public String getName() {
return "zeppelin";
return DbType.ZEPPELIN.getName();
}
}

View File

@ -56,7 +56,7 @@ public class ZeppelinDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
public String getDatasourceUniqueId(ConnectionParam connectionParam, DbType dbType) {
ZeppelinConnectionParam baseConnectionParam = (ZeppelinConnectionParam) connectionParam;
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getDescp(), baseConnectionParam.getRestEndpoint(),
return MessageFormat.format("{0}@{1}@{2}@{3}", dbType.getName(), baseConnectionParam.getRestEndpoint(),
baseConnectionParam.getUsername(), PasswordUtils.encodePassword(baseConnectionParam.getPassword()));
}

View File

@ -245,7 +245,7 @@ public class ServerNodeManager implements InitializingBean {
}
private void updateWorkerNodes() {
workerGroupWriteLock.lock();
workerNodeInfoWriteLock.lock();
try {
Map<String, String> workerNodeMaps = registryClient.getServerMaps(RegistryNodeType.WORKER);
for (Map.Entry<String, String> entry : workerNodeMaps.entrySet()) {
@ -254,7 +254,7 @@ public class ServerNodeManager implements InitializingBean {
workerNodeInfo.put(nodeAddress, workerHeartBeat);
}
} finally {
workerGroupWriteLock.unlock();
workerNodeInfoWriteLock.unlock();
}
}

View File

@ -28,42 +28,44 @@ import com.google.common.base.Functions;
public enum DbType {
MYSQL(0, "mysql"),
POSTGRESQL(1, "postgresql"),
HIVE(2, "hive"),
SPARK(3, "spark"),
CLICKHOUSE(4, "clickhouse"),
ORACLE(5, "oracle"),
SQLSERVER(6, "sqlserver"),
DB2(7, "db2"),
PRESTO(8, "presto"),
H2(9, "h2"),
REDSHIFT(10, "redshift"),
ATHENA(11, "athena"),
TRINO(12, "trino"),
STARROCKS(13, "starrocks"),
AZURESQL(14, "azuresql"),
DAMENG(15, "dameng"),
OCEANBASE(16, "oceanbase"),
SSH(17, "ssh"),
KYUUBI(18, "kyuubi"),
DATABEND(19, "databend"),
SNOWFLAKE(20, "snowflake"),
VERTICA(21, "vertica"),
HANA(22, "hana"),
DORIS(23, "doris"),
ZEPPELIN(24, "zeppelin"),
SAGEMAKER(25, "sagemaker"),
MYSQL(0, "mysql", "mysql"),
POSTGRESQL(1, "postgresql", "postgresql"),
HIVE(2, "hive", "hive"),
SPARK(3, "spark", "spark"),
CLICKHOUSE(4, "clickhouse", "clickhouse"),
ORACLE(5, "oracle", "oracle"),
SQLSERVER(6, "sqlserver", "sqlserver"),
DB2(7, "db2", "db2"),
PRESTO(8, "presto", "presto"),
H2(9, "h2", "h2"),
REDSHIFT(10, "redshift", "redshift"),
ATHENA(11, "athena", "athena"),
TRINO(12, "trino", "trino"),
STARROCKS(13, "starrocks", "starrocks"),
AZURESQL(14, "azuresql", "azuresql"),
DAMENG(15, "dameng", "dameng"),
OCEANBASE(16, "oceanbase", "oceanbase"),
SSH(17, "ssh", "ssh"),
KYUUBI(18, "kyuubi", "kyuubi"),
DATABEND(19, "databend", "databend"),
SNOWFLAKE(20, "snowflake", "snowflake"),
VERTICA(21, "vertica", "vertica"),
HANA(22, "hana", "hana"),
DORIS(23, "doris", "doris"),
ZEPPELIN(24, "zeppelin", "zeppelin"),
SAGEMAKER(25, "sagemaker", "sagemaker"),
K8S(26, "k8s");
K8S(26, "k8s", "k8s");
private static final Map<Integer, DbType> DB_TYPE_MAP =
Arrays.stream(DbType.values()).collect(toMap(DbType::getCode, Functions.identity()));
@EnumValue
private final int code;
private final String name;
private final String descp;
DbType(int code, String descp) {
DbType(int code, String name, String descp) {
this.code = code;
this.name = name;
this.descp = descp;
}
@ -83,6 +85,10 @@ public enum DbType {
return code;
}
public String getName() {
return name;
}
public String getDescp() {
return descp;
}

View File

@ -249,7 +249,8 @@ export default {
delete_task_validate_dependent_tasks_desc:
'The downstream dependent tasks exists. You can not delete the task.',
warning_delete_scheduler_dependent_tasks_desc:
'The downstream dependent tasks exists. Are you sure to delete the scheduler?'
'The downstream dependent tasks exists. Are you sure to delete the scheduler?',
warning_too_large_parallelism_number: 'The parallelism number is too large. It is better not to be over 10.'
},
task: {
on_line: 'Online',

View File

@ -246,7 +246,8 @@ export default {
delete_task_validate_dependent_tasks_desc:
'下游存在依赖,你不能删除该任务.',
warning_delete_scheduler_dependent_tasks_desc:
'下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?'
'下游存在依赖, 删除定时可能会对下游任务产生影响. 你确定要删除该定时嘛?',
warning_too_large_parallelism_number: '并行度设置太大了, 最好不要超过10.',
},
task: {
on_line: '线上',

View File

@ -44,7 +44,8 @@ import {
NSwitch,
NCheckbox,
NDatePicker,
NRadioButton
NRadioButton,
NInputNumber
} from 'naive-ui'
import {
ArrowDownOutlined,
@ -75,7 +76,6 @@ export default defineComponent({
props,
emits: ['update:show', 'update:row', 'updateList'],
setup(props, ctx) {
const parallelismRef = ref(false)
const { t } = useI18n()
const route = useRoute()
const { startState } = useForm()
@ -296,7 +296,6 @@ export default defineComponent({
return {
t,
showTaskDependType,
parallelismRef,
hideModal,
handleStart,
generalWarningTypeListOptions,
@ -504,17 +503,20 @@ export default defineComponent({
<NFormItem
label={t('project.workflow.parallelism')}
path='expectedParallelismNumber'
feedback={t(
'project.workflow.warning_too_large_parallelism_number'
)}
validationStatus={'warning'}
showFeedback={
parseInt(this.startForm.expectedParallelismNumber) > 10
}
>
<NCheckbox v-model:checked={this.parallelismRef}>
{t('project.workflow.custom_parallelism')}
</NCheckbox>
<NInput
allowInput={this.trim}
disabled={!this.parallelismRef}
<NInputNumber
placeholder={t(
'project.workflow.please_enter_parallelism'
)}
v-model:value={this.startForm.expectedParallelismNumber}
min='1'
/>
</NFormItem>
)}

View File

@ -66,7 +66,7 @@ export const useForm = () => {
tenantCode: 'default',
environmentCode: null,
startParams: null,
expectedParallelismNumber: '',
expectedParallelismNumber: '2',
dryRun: 0,
testFlag: 0,
version: null,

View File

@ -78,7 +78,7 @@ public class TaskExecutionContextUtils {
throw ex;
} catch (Exception ex) {
throw new TaskException(
String.format("TenantCode: %s doesn't exist", taskExecutionContext.getTenantCode()));
String.format("TenantCode: %s doesn't exist", taskExecutionContext.getTenantCode()), ex);
}
}