baoliang
4 years ago
84 changed files with 2801 additions and 960 deletions
Binary file not shown.
@ -1,467 +0,0 @@ |
|||||||
<!-- |
|
||||||
~ 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. |
|
||||||
--> |
|
||||||
<configuration> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.initialSize</name> |
|
||||||
<value>5</value> |
|
||||||
<description> |
|
||||||
Init connection number |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.minIdle</name> |
|
||||||
<value>5</value> |
|
||||||
<description> |
|
||||||
Min connection number |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.maxActive</name> |
|
||||||
<value>50</value> |
|
||||||
<description> |
|
||||||
Max connection number |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.maxWait</name> |
|
||||||
<value>60000</value> |
|
||||||
<description> |
|
||||||
Max wait time for get a connection in milliseconds. |
|
||||||
If configuring maxWait, fair locks are enabled by default and concurrency efficiency decreases. |
|
||||||
If necessary, unfair locks can be used by configuring the useUnfairLock attribute to true. |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.timeBetweenEvictionRunsMillis</name> |
|
||||||
<value>60000</value> |
|
||||||
<description> |
|
||||||
Milliseconds for check to close free connections |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.timeBetweenConnectErrorMillis</name> |
|
||||||
<value>60000</value> |
|
||||||
<description> |
|
||||||
The Destroy thread detects the connection interval and closes the physical connection in milliseconds |
|
||||||
if the connection idle time is greater than or equal to minEvictableIdleTimeMillis. |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.minEvictableIdleTimeMillis</name> |
|
||||||
<value>300000</value> |
|
||||||
<description> |
|
||||||
The longest time a connection remains idle without being evicted, in milliseconds |
|
||||||
</description> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.validationQuery</name> |
|
||||||
<value>SELECT 1</value> |
|
||||||
<description> |
|
||||||
The SQL used to check whether the connection is valid requires a query statement. |
|
||||||
If validation Query is null, testOnBorrow, testOnReturn, and testWhileIdle will not work. |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.validationQueryTimeout</name> |
|
||||||
<value>3</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Check whether the connection is valid for timeout, in seconds |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.testWhileIdle</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
When applying for a connection, |
|
||||||
if it is detected that the connection is idle longer than time Between Eviction Runs Millis, |
|
||||||
validation Query is performed to check whether the connection is valid |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.testOnBorrow</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Execute validation to check if the connection is valid when applying for a connection |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.testOnReturn</name> |
|
||||||
<value>false</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Execute validation to check if the connection is valid when the connection is returned |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.defaultAutoCommit</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.keepAlive</name> |
|
||||||
<value>false</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
|
|
||||||
<property> |
|
||||||
<name>spring.datasource.poolPreparedStatements</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Open PSCache, specify count PSCache for every connection |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.maxPoolPreparedStatementPerConnectionSize</name> |
|
||||||
<value>20</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.spring.datasource.filters</name> |
|
||||||
<value>stat,wall,log4j</value> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>spring.datasource.connectionProperties</name> |
|
||||||
<value>druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000</value> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
|
|
||||||
<property> |
|
||||||
<name>mybatis-plus.mapper-locations</name> |
|
||||||
<value>classpath*:/org.apache.dolphinscheduler.dao.mapper/*.xml</value> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.typeEnumsPackage</name> |
|
||||||
<value>org.apache.dolphinscheduler.*.enums</value> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.typeAliasesPackage</name> |
|
||||||
<value>org.apache.dolphinscheduler.dao.entity</value> |
|
||||||
<description> |
|
||||||
Entity scan, where multiple packages are separated by a comma or semicolon |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.id-type</name> |
|
||||||
<value>AUTO</value> |
|
||||||
<value-attributes> |
|
||||||
<type>value-list</type> |
|
||||||
<entries> |
|
||||||
<entry> |
|
||||||
<value>AUTO</value> |
|
||||||
<label>AUTO</label> |
|
||||||
</entry> |
|
||||||
<entry> |
|
||||||
<value>INPUT</value> |
|
||||||
<label>INPUT</label> |
|
||||||
</entry> |
|
||||||
<entry> |
|
||||||
<value>ID_WORKER</value> |
|
||||||
<label>ID_WORKER</label> |
|
||||||
</entry> |
|
||||||
<entry> |
|
||||||
<value>UUID</value> |
|
||||||
<label>UUID</label> |
|
||||||
</entry> |
|
||||||
</entries> |
|
||||||
<selection-cardinality>1</selection-cardinality> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Primary key type AUTO:" database ID AUTO ", |
|
||||||
INPUT:" user INPUT ID", |
|
||||||
ID_WORKER:" global unique ID (numeric type unique ID)", |
|
||||||
UUID:" global unique ID UUID"; |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.field-strategy</name> |
|
||||||
<value>NOT_NULL</value> |
|
||||||
<value-attributes> |
|
||||||
<type>value-list</type> |
|
||||||
<entries> |
|
||||||
<entry> |
|
||||||
<value>IGNORED</value> |
|
||||||
<label>IGNORED</label> |
|
||||||
</entry> |
|
||||||
<entry> |
|
||||||
<value>NOT_NULL</value> |
|
||||||
<label>NOT_NULL</label> |
|
||||||
</entry> |
|
||||||
<entry> |
|
||||||
<value>NOT_EMPTY</value> |
|
||||||
<label>NOT_EMPTY</label> |
|
||||||
</entry> |
|
||||||
</entries> |
|
||||||
<selection-cardinality>1</selection-cardinality> |
|
||||||
</value-attributes> |
|
||||||
<description> |
|
||||||
Field policy IGNORED:" ignore judgment ", |
|
||||||
NOT_NULL:" not NULL judgment "), |
|
||||||
NOT_EMPTY:" not NULL judgment" |
|
||||||
</description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.column-underline</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.logic-delete-value</name> |
|
||||||
<value>1</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.logic-not-delete-value</name> |
|
||||||
<value>0</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.global-config.db-config.banner</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
|
|
||||||
<property> |
|
||||||
<name>mybatis-plus.configuration.map-underscore-to-camel-case</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.configuration.cache-enabled</name> |
|
||||||
<value>false</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.configuration.call-setters-on-nulls</name> |
|
||||||
<value>true</value> |
|
||||||
<value-attributes> |
|
||||||
<type>boolean</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>mybatis-plus.configuration.jdbc-type-for-null</name> |
|
||||||
<value>null</value> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.exec.threads</name> |
|
||||||
<value>100</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.exec.task.num</name> |
|
||||||
<value>20</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.heartbeat.interval</name> |
|
||||||
<value>10</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.task.commit.retryTimes</name> |
|
||||||
<value>5</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.task.commit.interval</name> |
|
||||||
<value>1000</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.max.cpuload.avg</name> |
|
||||||
<value>100</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>master.reserved.memory</name> |
|
||||||
<value>0.1</value> |
|
||||||
<value-attributes> |
|
||||||
<type>float</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>worker.exec.threads</name> |
|
||||||
<value>100</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>worker.heartbeat.interval</name> |
|
||||||
<value>10</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>worker.fetch.task.num</name> |
|
||||||
<value>3</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>worker.max.cpuload.avg</name> |
|
||||||
<value>100</value> |
|
||||||
<value-attributes> |
|
||||||
<type>int</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
<property> |
|
||||||
<name>worker.reserved.memory</name> |
|
||||||
<value>0.1</value> |
|
||||||
<value-attributes> |
|
||||||
<type>float</type> |
|
||||||
</value-attributes> |
|
||||||
<description></description> |
|
||||||
<on-ambari-upgrade add="true"/> |
|
||||||
</property> |
|
||||||
|
|
||||||
</configuration> |
|
@ -0,0 +1,206 @@ |
|||||||
|
<!-- |
||||||
|
~ 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. |
||||||
|
--> |
||||||
|
<configuration> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.initialSize</name> |
||||||
|
<value>5</value> |
||||||
|
<description> |
||||||
|
Init connection number |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.minIdle</name> |
||||||
|
<value>5</value> |
||||||
|
<description> |
||||||
|
Min connection number |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.maxActive</name> |
||||||
|
<value>50</value> |
||||||
|
<description> |
||||||
|
Max connection number |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.maxWait</name> |
||||||
|
<value>60000</value> |
||||||
|
<description> |
||||||
|
Max wait time for get a connection in milliseconds. |
||||||
|
If configuring maxWait, fair locks are enabled by default and concurrency efficiency decreases. |
||||||
|
If necessary, unfair locks can be used by configuring the useUnfairLock attribute to true. |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.timeBetweenEvictionRunsMillis</name> |
||||||
|
<value>60000</value> |
||||||
|
<description> |
||||||
|
Milliseconds for check to close free connections |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.timeBetweenConnectErrorMillis</name> |
||||||
|
<value>60000</value> |
||||||
|
<description> |
||||||
|
The Destroy thread detects the connection interval and closes the physical connection in milliseconds |
||||||
|
if the connection idle time is greater than or equal to minEvictableIdleTimeMillis. |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.minEvictableIdleTimeMillis</name> |
||||||
|
<value>300000</value> |
||||||
|
<description> |
||||||
|
The longest time a connection remains idle without being evicted, in milliseconds |
||||||
|
</description> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.validationQuery</name> |
||||||
|
<value>SELECT 1</value> |
||||||
|
<description> |
||||||
|
The SQL used to check whether the connection is valid requires a query statement. |
||||||
|
If validation Query is null, testOnBorrow, testOnReturn, and testWhileIdle will not work. |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.validationQueryTimeout</name> |
||||||
|
<value>3</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
Check whether the connection is valid for timeout, in seconds |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.testWhileIdle</name> |
||||||
|
<value>true</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
When applying for a connection, |
||||||
|
if it is detected that the connection is idle longer than time Between Eviction Runs Millis, |
||||||
|
validation Query is performed to check whether the connection is valid |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.testOnBorrow</name> |
||||||
|
<value>true</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
Execute validation to check if the connection is valid when applying for a connection |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.testOnReturn</name> |
||||||
|
<value>false</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
Execute validation to check if the connection is valid when the connection is returned |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.defaultAutoCommit</name> |
||||||
|
<value>true</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.keepAlive</name> |
||||||
|
<value>false</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
|
||||||
|
<property> |
||||||
|
<name>spring.datasource.poolPreparedStatements</name> |
||||||
|
<value>true</value> |
||||||
|
<value-attributes> |
||||||
|
<type>boolean</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
Open PSCache, specify count PSCache for every connection |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.maxPoolPreparedStatementPerConnectionSize</name> |
||||||
|
<value>20</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description></description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.spring.datasource.filters</name> |
||||||
|
<value>stat,wall,log4j</value> |
||||||
|
<description></description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>spring.datasource.connectionProperties</name> |
||||||
|
<value>druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000</value> |
||||||
|
<description></description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
</configuration> |
@ -0,0 +1,88 @@ |
|||||||
|
<!-- |
||||||
|
~ 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. |
||||||
|
--> |
||||||
|
<configuration> |
||||||
|
<property> |
||||||
|
<name>master.exec.threads</name> |
||||||
|
<value>100</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master execute thread num</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.exec.task.num</name> |
||||||
|
<value>20</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master execute task number in parallel</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.heartbeat.interval</name> |
||||||
|
<value>10</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master heartbeat interval</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.task.commit.retryTimes</name> |
||||||
|
<value>5</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master commit task retry times</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.task.commit.interval</name> |
||||||
|
<value>1000</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master commit task interval</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.max.cpuload.avg</name> |
||||||
|
<value>100</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>only less than cpu avg load, master server can work. default value : the number of cpu cores * 2</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>master.reserved.memory</name> |
||||||
|
<value>0.3</value> |
||||||
|
<description>only larger than reserved memory, master server can work. default value : physical memory * 1/10, unit is G.</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
|
||||||
|
<property> |
||||||
|
<name>master.listen.port</name> |
||||||
|
<value>5678</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>master listen port</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
</configuration> |
@ -0,0 +1,67 @@ |
|||||||
|
<!-- |
||||||
|
~ 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. |
||||||
|
--> |
||||||
|
<configuration> |
||||||
|
<property> |
||||||
|
<name>worker.exec.threads</name> |
||||||
|
<value>100</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>worker execute thread num</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>worker.heartbeat.interval</name> |
||||||
|
<value>10</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>worker heartbeat interval</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>worker.max.cpuload.avg</name> |
||||||
|
<value>100</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>worker.reserved.memory</name> |
||||||
|
<value>0.3</value> |
||||||
|
<description>only larger than reserved memory, worker server can work. default value : physical memory * 1/10, unit is G.</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
|
||||||
|
<property> |
||||||
|
<name>worker.listen.port</name> |
||||||
|
<value>1234</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description>worker listen port</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>worker.groups</name> |
||||||
|
<value>default</value> |
||||||
|
<description>default worker group</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
</configuration> |
@ -0,0 +1,76 @@ |
|||||||
|
<!-- |
||||||
|
~ 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. |
||||||
|
--> |
||||||
|
<configuration> |
||||||
|
<property> |
||||||
|
<name>zookeeper.dolphinscheduler.root</name> |
||||||
|
<value>/dolphinscheduler</value> |
||||||
|
<description> |
||||||
|
dolphinscheduler root directory |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>zookeeper.session.timeout</name> |
||||||
|
<value>300</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>zookeeper.connection.timeout</name> |
||||||
|
<value>300</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>zookeeper.retry.base.sleep</name> |
||||||
|
<value>100</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>zookeeper.retry.max.sleep</name> |
||||||
|
<value>30000</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
<property> |
||||||
|
<name>zookeeper.retry.maxtime</name> |
||||||
|
<value>5</value> |
||||||
|
<value-attributes> |
||||||
|
<type>int</type> |
||||||
|
</value-attributes> |
||||||
|
<description> |
||||||
|
</description> |
||||||
|
<on-ambari-upgrade add="true"/> |
||||||
|
</property> |
||||||
|
</configuration> |
@ -0,0 +1,20 @@ |
|||||||
|
# |
||||||
|
# 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. |
||||||
|
# |
||||||
|
|
||||||
|
{% for key, value in dolphin_datasource_map.iteritems() -%} |
||||||
|
{{key}}={{value}} |
||||||
|
{% endfor %} |
@ -0,0 +1,20 @@ |
|||||||
|
# |
||||||
|
# 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. |
||||||
|
# |
||||||
|
|
||||||
|
{% for key, value in dolphin_master_map.iteritems() -%} |
||||||
|
{{key}}={{value}} |
||||||
|
{% endfor %} |
@ -0,0 +1,20 @@ |
|||||||
|
# |
||||||
|
# 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. |
||||||
|
# |
||||||
|
|
||||||
|
{% for key, value in dolphin_worker_map.iteritems() -%} |
||||||
|
{{key}}={{value}} |
||||||
|
{% endfor %} |
@ -0,0 +1,20 @@ |
|||||||
|
# |
||||||
|
# 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. |
||||||
|
# |
||||||
|
|
||||||
|
{% for key, value in dolphin_zookeeper_map.iteritems() -%} |
||||||
|
{{key}}={{value}} |
||||||
|
{% endfor %} |
@ -0,0 +1,23 @@ |
|||||||
|
/* |
||||||
|
* 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.enums; |
||||||
|
|
||||||
|
public enum Event { |
||||||
|
ACK, |
||||||
|
RESULT; |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.dao.upgrade; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.utils.ConnectionUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
import java.sql.Connection; |
||||||
|
import java.sql.PreparedStatement; |
||||||
|
import java.sql.ResultSet; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* resource dao |
||||||
|
*/ |
||||||
|
public class ResourceDao { |
||||||
|
public static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionDao.class); |
||||||
|
|
||||||
|
/** |
||||||
|
* list all resources |
||||||
|
* @param conn connection |
||||||
|
* @return map that key is full_name and value is id |
||||||
|
*/ |
||||||
|
Map<String,Integer> listAllResources(Connection conn){ |
||||||
|
Map<String,Integer> resourceMap = new HashMap<>(); |
||||||
|
|
||||||
|
String sql = String.format("SELECT id,full_name FROM t_ds_resources"); |
||||||
|
ResultSet rs = null; |
||||||
|
PreparedStatement pstmt = null; |
||||||
|
try { |
||||||
|
pstmt = conn.prepareStatement(sql); |
||||||
|
rs = pstmt.executeQuery(); |
||||||
|
|
||||||
|
while (rs.next()){ |
||||||
|
Integer id = rs.getInt(1); |
||||||
|
String fullName = rs.getString(2); |
||||||
|
resourceMap.put(fullName,id); |
||||||
|
} |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
logger.error(e.getMessage(),e); |
||||||
|
throw new RuntimeException("sql: " + sql, e); |
||||||
|
} finally { |
||||||
|
ConnectionUtils.releaseResource(rs, pstmt, conn); |
||||||
|
} |
||||||
|
|
||||||
|
return resourceMap; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,72 @@ |
|||||||
|
/* |
||||||
|
* 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.remote.command; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.remote.utils.FastJsonSerializer; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* db task ack request command |
||||||
|
*/ |
||||||
|
public class DBTaskAckCommand implements Serializable { |
||||||
|
|
||||||
|
private int taskInstanceId; |
||||||
|
private int status; |
||||||
|
|
||||||
|
public DBTaskAckCommand(int status,int taskInstanceId) { |
||||||
|
this.status = status; |
||||||
|
this.taskInstanceId = taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
public int getTaskInstanceId() { |
||||||
|
return taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTaskInstanceId(int taskInstanceId) { |
||||||
|
this.taskInstanceId = taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
public int getStatus() { |
||||||
|
return status; |
||||||
|
} |
||||||
|
|
||||||
|
public void setStatus(int status) { |
||||||
|
this.status = status; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* package response command |
||||||
|
* @return command |
||||||
|
*/ |
||||||
|
public Command convert2Command(){ |
||||||
|
Command command = new Command(); |
||||||
|
command.setType(CommandType.DB_TASK_ACK); |
||||||
|
byte[] body = FastJsonSerializer.serialize(this); |
||||||
|
command.setBody(body); |
||||||
|
return command; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "DBTaskAckCommand{" + |
||||||
|
"taskInstanceId=" + taskInstanceId + |
||||||
|
", status=" + status + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,71 @@ |
|||||||
|
/* |
||||||
|
* 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.remote.command; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.remote.utils.FastJsonSerializer; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* db task final result response command |
||||||
|
*/ |
||||||
|
public class DBTaskResponseCommand implements Serializable { |
||||||
|
|
||||||
|
private int taskInstanceId; |
||||||
|
private int status; |
||||||
|
|
||||||
|
public DBTaskResponseCommand(int status,int taskInstanceId) { |
||||||
|
this.status = status; |
||||||
|
this.taskInstanceId = taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
public int getStatus() { |
||||||
|
return status; |
||||||
|
} |
||||||
|
|
||||||
|
public void setStatus(int status) { |
||||||
|
this.status = status; |
||||||
|
} |
||||||
|
|
||||||
|
public int getTaskInstanceId() { |
||||||
|
return taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setTaskInstanceId(int taskInstanceId) { |
||||||
|
this.taskInstanceId = taskInstanceId; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* package response command |
||||||
|
* @return command |
||||||
|
*/ |
||||||
|
public Command convert2Command(){ |
||||||
|
Command command = new Command(); |
||||||
|
command.setType(CommandType.DB_TASK_RESPONSE); |
||||||
|
byte[] body = FastJsonSerializer.serialize(this); |
||||||
|
command.setBody(body); |
||||||
|
return command; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "DBTaskResponseCommand{" + |
||||||
|
"taskInstanceId=" + taskInstanceId + |
||||||
|
", status=" + status + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.apache.dolphinscheduler.server.log; |
||||||
|
|
||||||
|
import ch.qos.logback.classic.spi.ILoggingEvent; |
||||||
|
import ch.qos.logback.core.FileAppender; |
||||||
|
import org.slf4j.Marker; |
||||||
|
|
||||||
|
import static ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER; |
||||||
|
|
||||||
|
/** |
||||||
|
* Task log appender |
||||||
|
*/ |
||||||
|
public class TaskLogAppender extends FileAppender<ILoggingEvent>{ |
||||||
|
@Override |
||||||
|
protected void append(ILoggingEvent event) { |
||||||
|
Marker marker = event.getMarker(); |
||||||
|
if (marker !=null) { |
||||||
|
if (marker.equals(FINALIZE_SESSION_MARKER)) { |
||||||
|
stop(); |
||||||
|
} |
||||||
|
} |
||||||
|
super.subAppend(event); |
||||||
|
} |
||||||
|
} |
@ -1,162 +0,0 @@ |
|||||||
/* |
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
* contributor license agreements. See the NOTICE file distributed with |
|
||||||
* this work for additional information regarding copyright ownership. |
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
* (the "License"); you may not use this file except in compliance with |
|
||||||
* the License. You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.apache.dolphinscheduler.server.master.runner; |
|
||||||
|
|
||||||
import org.apache.dolphinscheduler.common.Constants; |
|
||||||
import org.apache.dolphinscheduler.common.enums.DependResult; |
|
||||||
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; |
|
||||||
import org.apache.dolphinscheduler.common.model.DependentItem; |
|
||||||
import org.apache.dolphinscheduler.common.model.DependentTaskModel; |
|
||||||
import org.apache.dolphinscheduler.common.task.dependent.DependentParameters; |
|
||||||
import org.apache.dolphinscheduler.common.utils.DependentUtils; |
|
||||||
import org.apache.dolphinscheduler.common.utils.*; |
|
||||||
import org.apache.dolphinscheduler.common.utils.LoggerUtils; |
|
||||||
import org.apache.dolphinscheduler.common.utils.NetUtils; |
|
||||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
|
||||||
import org.apache.dolphinscheduler.server.utils.LogUtils; |
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
import java.util.concurrent.ConcurrentHashMap; |
|
||||||
|
|
||||||
public class ConditionsTaskExecThread extends MasterBaseTaskExecThread { |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* dependent parameters |
|
||||||
*/ |
|
||||||
private DependentParameters dependentParameters; |
|
||||||
|
|
||||||
/** |
|
||||||
* complete task map |
|
||||||
*/ |
|
||||||
private Map<String, ExecutionStatus> completeTaskList = new ConcurrentHashMap<>(); |
|
||||||
|
|
||||||
/** |
|
||||||
* condition result |
|
||||||
*/ |
|
||||||
private DependResult conditionResult; |
|
||||||
|
|
||||||
/** |
|
||||||
* constructor of MasterBaseTaskExecThread |
|
||||||
* |
|
||||||
* @param taskInstance task instance |
|
||||||
*/ |
|
||||||
public ConditionsTaskExecThread(TaskInstance taskInstance) { |
|
||||||
super(taskInstance); |
|
||||||
taskInstance.setStartTime(new Date()); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public Boolean submitWaitComplete() { |
|
||||||
try{ |
|
||||||
this.taskInstance = submit(); |
|
||||||
logger = LoggerFactory.getLogger(LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, |
|
||||||
taskInstance.getProcessDefinitionId(), |
|
||||||
taskInstance.getProcessInstanceId(), |
|
||||||
taskInstance.getId())); |
|
||||||
String threadLoggerInfoName = String.format(Constants.TASK_LOG_INFO_FORMAT, processService.formatTaskAppId(this.taskInstance)); |
|
||||||
Thread.currentThread().setName(threadLoggerInfoName); |
|
||||||
initTaskParameters(); |
|
||||||
logger.info("dependent task start"); |
|
||||||
waitTaskQuit(); |
|
||||||
updateTaskState(); |
|
||||||
}catch (Exception e){ |
|
||||||
logger.error("conditions task run exception" , e); |
|
||||||
} |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
private void waitTaskQuit() { |
|
||||||
List<TaskInstance> taskInstances = processService.findValidTaskListByProcessId( |
|
||||||
taskInstance.getProcessInstanceId() |
|
||||||
); |
|
||||||
for(TaskInstance task : taskInstances){ |
|
||||||
completeTaskList.putIfAbsent(task.getName(), task.getState()); |
|
||||||
} |
|
||||||
|
|
||||||
List<DependResult> modelResultList = new ArrayList<>(); |
|
||||||
for(DependentTaskModel dependentTaskModel : dependentParameters.getDependTaskList()){ |
|
||||||
|
|
||||||
List<DependResult> itemDependResult = new ArrayList<>(); |
|
||||||
for(DependentItem item : dependentTaskModel.getDependItemList()){ |
|
||||||
itemDependResult.add(getDependResultForItem(item)); |
|
||||||
} |
|
||||||
DependResult modelResult = DependentUtils.getDependResultForRelation(dependentTaskModel.getRelation(), itemDependResult); |
|
||||||
modelResultList.add(modelResult); |
|
||||||
} |
|
||||||
conditionResult = DependentUtils.getDependResultForRelation( |
|
||||||
dependentParameters.getRelation(), modelResultList |
|
||||||
); |
|
||||||
logger.info("the conditions task depend result : {}", conditionResult); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
private void updateTaskState() { |
|
||||||
ExecutionStatus status; |
|
||||||
if(this.cancel){ |
|
||||||
status = ExecutionStatus.KILL; |
|
||||||
}else{ |
|
||||||
status = (conditionResult == DependResult.SUCCESS) ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE; |
|
||||||
} |
|
||||||
taskInstance.setState(status); |
|
||||||
taskInstance.setEndTime(new Date()); |
|
||||||
processService.updateTaskInstance(taskInstance); |
|
||||||
} |
|
||||||
|
|
||||||
private void initTaskParameters() { |
|
||||||
this.taskInstance.setLogPath(LogUtils.getTaskLogPath(taskInstance)); |
|
||||||
this.taskInstance.setHost(NetUtils.getHost() + Constants.COLON + masterConfig.getListenPort()); |
|
||||||
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION); |
|
||||||
taskInstance.setStartTime(new Date()); |
|
||||||
this.processService.saveTaskInstance(taskInstance); |
|
||||||
|
|
||||||
this.dependentParameters = JSONUtils.parseObject(this.taskInstance.getDependency(), DependentParameters.class); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* depend result for depend item |
|
||||||
* @param item |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
private DependResult getDependResultForItem(DependentItem item){ |
|
||||||
|
|
||||||
DependResult dependResult = DependResult.SUCCESS; |
|
||||||
if(!completeTaskList.containsKey(item.getDepTasks())){ |
|
||||||
logger.info("depend item: {} have not completed yet.", item.getDepTasks()); |
|
||||||
dependResult = DependResult.FAILED; |
|
||||||
return dependResult; |
|
||||||
} |
|
||||||
ExecutionStatus executionStatus = completeTaskList.get(item.getDepTasks()); |
|
||||||
if(executionStatus != item.getStatus()){ |
|
||||||
logger.info("depend item : {} expect status: {}, actual status: {}" ,item.getDepTasks(), item.getStatus(), executionStatus); |
|
||||||
dependResult = DependResult.FAILED; |
|
||||||
} |
|
||||||
logger.info("dependent item complete {} {},{}", |
|
||||||
Constants.DEPENDENT_SPLIT, item.getDepTasks(), dependResult); |
|
||||||
return dependResult; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,94 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.worker.cache; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.enums.Event; |
||||||
|
import org.apache.dolphinscheduler.remote.command.Command; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* Responce Cache : cache worker send master result |
||||||
|
*/ |
||||||
|
public class ResponceCache { |
||||||
|
|
||||||
|
private static final ResponceCache instance = new ResponceCache(); |
||||||
|
|
||||||
|
private ResponceCache(){} |
||||||
|
|
||||||
|
public static ResponceCache get(){ |
||||||
|
return instance; |
||||||
|
} |
||||||
|
|
||||||
|
private Map<Integer,Command> ackCache = new ConcurrentHashMap<>(); |
||||||
|
private Map<Integer,Command> responseCache = new ConcurrentHashMap<>(); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* cache response |
||||||
|
* @param taskInstanceId taskInstanceId |
||||||
|
* @param command command |
||||||
|
* @param event event ACK/RESULT |
||||||
|
*/ |
||||||
|
public void cache(Integer taskInstanceId, Command command, Event event){ |
||||||
|
switch (event){ |
||||||
|
case ACK: |
||||||
|
ackCache.put(taskInstanceId,command); |
||||||
|
break; |
||||||
|
case RESULT: |
||||||
|
responseCache.put(taskInstanceId,command); |
||||||
|
break; |
||||||
|
default: |
||||||
|
throw new IllegalArgumentException("invalid event type : " + event); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* remove ack cache |
||||||
|
* @param taskInstanceId taskInstanceId |
||||||
|
*/ |
||||||
|
public void removeAckCache(Integer taskInstanceId){ |
||||||
|
ackCache.remove(taskInstanceId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* remove reponse cache |
||||||
|
* @param taskInstanceId taskInstanceId |
||||||
|
*/ |
||||||
|
public void removeResponseCache(Integer taskInstanceId){ |
||||||
|
responseCache.remove(taskInstanceId); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* getAckCache |
||||||
|
* @return getAckCache |
||||||
|
*/ |
||||||
|
public Map<Integer,Command> getAckCache(){ |
||||||
|
return ackCache; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* getResponseCache |
||||||
|
* @return getResponseCache |
||||||
|
*/ |
||||||
|
public Map<Integer,Command> getResponseCache(){ |
||||||
|
return responseCache; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.worker.processor; |
||||||
|
|
||||||
|
import io.netty.channel.Channel; |
||||||
|
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; |
||||||
|
import org.apache.dolphinscheduler.common.utils.Preconditions; |
||||||
|
import org.apache.dolphinscheduler.remote.command.*; |
||||||
|
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; |
||||||
|
import org.apache.dolphinscheduler.remote.utils.JsonSerializer; |
||||||
|
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
/** |
||||||
|
* db task ack processor |
||||||
|
*/ |
||||||
|
public class DBTaskAckProcessor implements NettyRequestProcessor { |
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(DBTaskAckProcessor.class); |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void process(Channel channel, Command command) { |
||||||
|
Preconditions.checkArgument(CommandType.DB_TASK_ACK == command.getType(), |
||||||
|
String.format("invalid command type : %s", command.getType())); |
||||||
|
|
||||||
|
DBTaskAckCommand taskAckCommand = JsonSerializer.deserialize( |
||||||
|
command.getBody(), DBTaskAckCommand.class); |
||||||
|
|
||||||
|
if (taskAckCommand == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if (taskAckCommand.getStatus() == ExecutionStatus.SUCCESS.getCode()){ |
||||||
|
ResponceCache.get().removeAckCache(taskAckCommand.getTaskInstanceId()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,58 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.worker.processor; |
||||||
|
|
||||||
|
import io.netty.channel.Channel; |
||||||
|
import org.apache.dolphinscheduler.common.enums.ExecutionStatus; |
||||||
|
import org.apache.dolphinscheduler.common.utils.Preconditions; |
||||||
|
import org.apache.dolphinscheduler.remote.command.Command; |
||||||
|
import org.apache.dolphinscheduler.remote.command.CommandType; |
||||||
|
import org.apache.dolphinscheduler.remote.command.DBTaskResponseCommand; |
||||||
|
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; |
||||||
|
import org.apache.dolphinscheduler.remote.utils.JsonSerializer; |
||||||
|
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
/** |
||||||
|
* db task response processor |
||||||
|
*/ |
||||||
|
public class DBTaskResponseProcessor implements NettyRequestProcessor { |
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(DBTaskResponseProcessor.class); |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void process(Channel channel, Command command) { |
||||||
|
Preconditions.checkArgument(CommandType.DB_TASK_RESPONSE == command.getType(), |
||||||
|
String.format("invalid command type : %s", command.getType())); |
||||||
|
|
||||||
|
DBTaskResponseCommand taskResponseCommand = JsonSerializer.deserialize( |
||||||
|
command.getBody(), DBTaskResponseCommand.class); |
||||||
|
|
||||||
|
if (taskResponseCommand == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if (taskResponseCommand.getStatus() == ExecutionStatus.SUCCESS.getCode()){ |
||||||
|
ResponceCache.get().removeResponseCache(taskResponseCommand.getTaskInstanceId()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.apache.dolphinscheduler.server.worker.runner; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.thread.Stopper; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.thread.ThreadUtils; |
||||||
|
import org.apache.dolphinscheduler.remote.command.Command; |
||||||
|
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; |
||||||
|
import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; |
||||||
|
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* Retry Report Task Status Thread |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
public class RetryReportTaskStatusThread implements Runnable { |
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(RetryReportTaskStatusThread.class); |
||||||
|
|
||||||
|
/** |
||||||
|
* every 5 minutes |
||||||
|
*/ |
||||||
|
private static long RETRY_REPORT_TASK_STATUS_INTERVAL = 5 * 60 * 1000L; |
||||||
|
/** |
||||||
|
* task callback service |
||||||
|
*/ |
||||||
|
private final TaskCallbackService taskCallbackService; |
||||||
|
|
||||||
|
public void start(){ |
||||||
|
Thread thread = new Thread(this,"RetryReportTaskStatusThread"); |
||||||
|
thread.start(); |
||||||
|
} |
||||||
|
|
||||||
|
public RetryReportTaskStatusThread(){ |
||||||
|
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* retry ack/response |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
ResponceCache responceCache = ResponceCache.get(); |
||||||
|
|
||||||
|
while (Stopper.isRunning()){ |
||||||
|
|
||||||
|
// sleep 5 minutes
|
||||||
|
ThreadUtils.sleep(RETRY_REPORT_TASK_STATUS_INTERVAL); |
||||||
|
|
||||||
|
try { |
||||||
|
if (!responceCache.getAckCache().isEmpty()){ |
||||||
|
Map<Integer,Command> ackCache = responceCache.getAckCache(); |
||||||
|
for (Map.Entry<Integer, Command> entry : ackCache.entrySet()){ |
||||||
|
Integer taskInstanceId = entry.getKey(); |
||||||
|
Command ackCommand = entry.getValue(); |
||||||
|
taskCallbackService.sendAck(taskInstanceId,ackCommand); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!responceCache.getResponseCache().isEmpty()){ |
||||||
|
Map<Integer,Command> responseCache = responceCache.getResponseCache(); |
||||||
|
for (Map.Entry<Integer, Command> entry : responseCache.entrySet()){ |
||||||
|
Integer taskInstanceId = entry.getKey(); |
||||||
|
Command responseCommand = entry.getValue(); |
||||||
|
taskCallbackService.sendResult(taskInstanceId,responseCommand); |
||||||
|
} |
||||||
|
} |
||||||
|
}catch (Exception e){ |
||||||
|
logger.warn("retry report task status error", e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,336 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
<template> |
||||||
|
<m-popup |
||||||
|
ref="popup" |
||||||
|
:ok-text="$t('Upload')" |
||||||
|
:nameText="$t('File Upload')" |
||||||
|
@ok="_ok" |
||||||
|
:disabled="progress === 0 ? false : true"> |
||||||
|
<template slot="content"> |
||||||
|
<form name="files" enctype="multipart/form-data" method="post"> |
||||||
|
<div class="file-update-model" |
||||||
|
@drop.prevent="_onDrop" |
||||||
|
@dragover.prevent="dragOver = true" |
||||||
|
@dragleave.prevent="dragOver = false" |
||||||
|
id="file-update-model"> |
||||||
|
<div class="tooltip-info"> |
||||||
|
<em class="ans ans-icon-warn-solid"></em> |
||||||
|
<span>{{$t('Drag the file into the current upload window')}}</span> |
||||||
|
</div> |
||||||
|
<!--<div class="hide-archive" v-if="progress !== 0" @click="_ckArchive"> |
||||||
|
<em class="fa fa-minus" data-toggle="tooltip" title="关闭窗口 继续上传" data-container="body" ></em> |
||||||
|
</div>--> |
||||||
|
<div class="update-popup" v-if="dragOver"> |
||||||
|
<div class="icon-box"> |
||||||
|
<em class="ans ans-icon-upload"></em> |
||||||
|
</div> |
||||||
|
<p class="p1"> |
||||||
|
<span>{{$t('Drag area upload')}}</span> |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name"><strong>*</strong>{{$t('File Name')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<x-input |
||||||
|
type="input" |
||||||
|
v-model="name" |
||||||
|
:disabled="progress !== 0" |
||||||
|
:placeholder="$t('Please enter name')" |
||||||
|
autocomplete="off"> |
||||||
|
</x-input> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name">{{$t('Description')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<x-input |
||||||
|
type="textarea" |
||||||
|
v-model="description" |
||||||
|
:disabled="progress !== 0" |
||||||
|
:placeholder="$t('Please enter description')" |
||||||
|
autocomplete="off"> |
||||||
|
</x-input> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name"><strong>*</strong>{{$t('Upload Files')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<div class="file-update-box"> |
||||||
|
<template v-if="progress === 0"> |
||||||
|
<input name="file" id="file" type="file" class="file-update"> |
||||||
|
<x-button type="dashed" size="xsmall"> {{$t('Upload')}} </x-button> |
||||||
|
</template> |
||||||
|
<div class="progress-box" v-if="progress !== 0"> |
||||||
|
<m-progress-bar :value="progress" text-placement="left-right"></m-progress-bar> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</template> |
||||||
|
</m-popup> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import io from '@/module/io' |
||||||
|
import i18n from '@/module/i18n' |
||||||
|
import store from '@/conf/home/store' |
||||||
|
import localStore from '@/module/util/localStorage' |
||||||
|
import mPopup from '@/module/components/popup/popup' |
||||||
|
import mListBoxF from '@/module/components/listBoxF/listBoxF' |
||||||
|
import mProgressBar from '@/module/components/progressBar/progressBar' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: 'file-update', |
||||||
|
data () { |
||||||
|
return { |
||||||
|
store, |
||||||
|
// name |
||||||
|
name: '', |
||||||
|
// description |
||||||
|
description: '', |
||||||
|
// progress |
||||||
|
progress: 0, |
||||||
|
// file |
||||||
|
file: null, |
||||||
|
currentDir: localStore.getItem('currentDir'), |
||||||
|
// Whether to drag upload |
||||||
|
dragOver: false |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
props: { |
||||||
|
type: String, |
||||||
|
fileName: String, |
||||||
|
desc: String, |
||||||
|
id: Number |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
/** |
||||||
|
* submit |
||||||
|
*/ |
||||||
|
_ok () { |
||||||
|
this.$refs['popup'].spinnerLoading = true |
||||||
|
if (this._validation()) { |
||||||
|
if(this.fileName===this.name) { |
||||||
|
const isLt1024M = this.file.size / 1024 / 1024 < 1024 |
||||||
|
if(isLt1024M) { |
||||||
|
this._formDataUpdate().then(res => { |
||||||
|
setTimeout(() => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}, 800) |
||||||
|
}).catch(e => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} else { |
||||||
|
this.$message.warning(`${i18n.$t('Upload File Size')}`) |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
} else { |
||||||
|
this.store.dispatch('resource/resourceVerifyName', { |
||||||
|
fullName: this.currentDir+'/'+this.name, |
||||||
|
type: this.type |
||||||
|
}).then(res => { |
||||||
|
const isLt1024M = this.file.size / 1024 / 1024 < 1024 |
||||||
|
if(isLt1024M) { |
||||||
|
this._formDataUpdate().then(res => { |
||||||
|
setTimeout(() => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}, 800) |
||||||
|
}).catch(e => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} else { |
||||||
|
this.$message.warning(`${i18n.$t('Upload File Size')}`) |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
}).catch(e => { |
||||||
|
this.$message.error(e.msg || '') |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} |
||||||
|
} else { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
}, |
||||||
|
/** |
||||||
|
* validation |
||||||
|
*/ |
||||||
|
_validation () { |
||||||
|
if (!this.name) { |
||||||
|
this.$message.warning(`${i18n.$t('Please enter file name')}`) |
||||||
|
return false |
||||||
|
} |
||||||
|
if (!this.file) { |
||||||
|
this.$message.warning(`${i18n.$t('Please select the file to upload')}`) |
||||||
|
return false |
||||||
|
} |
||||||
|
return true |
||||||
|
}, |
||||||
|
/** |
||||||
|
* update file |
||||||
|
*/ |
||||||
|
_formDataUpdate () { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
let self = this |
||||||
|
let formData = new FormData() |
||||||
|
formData.append('file', this.file) |
||||||
|
formData.append('name', this.name) |
||||||
|
formData.append('description', this.description) |
||||||
|
formData.append('id', this.id) |
||||||
|
formData.append('type', this.type) |
||||||
|
io.post(`resources/update`, res => { |
||||||
|
this.$message.success(res.msg) |
||||||
|
resolve() |
||||||
|
self.$emit('onUpdate') |
||||||
|
}, e => { |
||||||
|
reject(e) |
||||||
|
self.$emit('close') |
||||||
|
this.$message.error(e.msg || '') |
||||||
|
}, { |
||||||
|
data: formData, |
||||||
|
emulateJSON: false, |
||||||
|
onUploadProgress (progressEvent) { |
||||||
|
// Size has been uploaded |
||||||
|
let loaded = progressEvent.loaded |
||||||
|
// Total attachment size |
||||||
|
let total = progressEvent.total |
||||||
|
self.progress = Math.floor(100 * loaded / total) |
||||||
|
self.$emit('onProgress', self.progress) |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
/** |
||||||
|
* Archive to the top right corner Continue uploading |
||||||
|
*/ |
||||||
|
_ckArchive () { |
||||||
|
$('.update-file-modal').hide() |
||||||
|
this.$emit('onArchive') |
||||||
|
}, |
||||||
|
/** |
||||||
|
* Drag and drop upload |
||||||
|
*/ |
||||||
|
_onDrop (e) { |
||||||
|
let file = e.dataTransfer.files[0] |
||||||
|
this.file = file |
||||||
|
this.name = file.name |
||||||
|
this.dragOver = false |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted () { |
||||||
|
this.name = this.fileName |
||||||
|
this.description = this.desc |
||||||
|
$('#file').change(() => { |
||||||
|
let file = $('#file')[0].files[0] |
||||||
|
this.file = file |
||||||
|
this.name = file.name |
||||||
|
}) |
||||||
|
}, |
||||||
|
components: { mPopup, mListBoxF, mProgressBar } |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" rel="stylesheet/scss"> |
||||||
|
.file-update-model { |
||||||
|
.tooltip-info { |
||||||
|
position: absolute; |
||||||
|
left: 20px; |
||||||
|
bottom: 26px; |
||||||
|
span { |
||||||
|
font-size: 12px; |
||||||
|
color: #666; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
.fa,.ans { |
||||||
|
color: #0097e0; |
||||||
|
font-size: 14px; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
} |
||||||
|
.hide-archive { |
||||||
|
position: absolute; |
||||||
|
right: 22px; |
||||||
|
top: 17px; |
||||||
|
.fa,.ans{ |
||||||
|
font-size: 16px; |
||||||
|
color: #333; |
||||||
|
font-weight: normal; |
||||||
|
cursor: pointer; |
||||||
|
&:hover { |
||||||
|
color: #0097e0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.file-update-box { |
||||||
|
padding-top: 4px; |
||||||
|
position: relative; |
||||||
|
.file-update { |
||||||
|
width: 70px; |
||||||
|
height: 40px; |
||||||
|
position: absolute; |
||||||
|
left: 0; |
||||||
|
top: 0; |
||||||
|
cursor: pointer; |
||||||
|
filter: alpha(opacity=0); |
||||||
|
-moz-opacity: 0; |
||||||
|
opacity: 0; |
||||||
|
} |
||||||
|
&:hover { |
||||||
|
.v-btn-dashed { |
||||||
|
background-color: transparent; |
||||||
|
border-color: #47c3ff; |
||||||
|
color: #47c3ff; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
} |
||||||
|
.progress-box { |
||||||
|
width: 200px; |
||||||
|
position: absolute; |
||||||
|
left: 70px; |
||||||
|
top: 14px; |
||||||
|
} |
||||||
|
} |
||||||
|
.update-popup { |
||||||
|
width: calc(100% - 20px); |
||||||
|
height: calc(100% - 20px); |
||||||
|
background: rgba(255,253,239,.7); |
||||||
|
position: absolute; |
||||||
|
top: 10px; |
||||||
|
left: 10px; |
||||||
|
border-radius: 3px; |
||||||
|
z-index: 1; |
||||||
|
border: .18rem dashed #cccccc; |
||||||
|
.icon-box { |
||||||
|
text-align: center; |
||||||
|
margin-top: 96px; |
||||||
|
.fa,.ans { |
||||||
|
font-size: 50px; |
||||||
|
color: #2d8cf0; |
||||||
|
} |
||||||
|
} |
||||||
|
.p1 { |
||||||
|
text-align: center; |
||||||
|
font-size: 16px; |
||||||
|
color: #333; |
||||||
|
padding-top: 8px; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,335 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
<template> |
||||||
|
<m-popup |
||||||
|
ref="popup" |
||||||
|
:ok-text="$t('Upload')" |
||||||
|
:nameText="$t('ReUpload File')" |
||||||
|
@ok="_ok" |
||||||
|
:disabled="progress === 0 ? false : true"> |
||||||
|
<template slot="content"> |
||||||
|
<form name="files" enctype="multipart/form-data" method="post"> |
||||||
|
<div class="file-update-model" |
||||||
|
@drop.prevent="_onDrop" |
||||||
|
@dragover.prevent="dragOver = true" |
||||||
|
@dragleave.prevent="dragOver = false" |
||||||
|
id="file-update-model"> |
||||||
|
<div class="tooltip-info"> |
||||||
|
<em class="ans ans-icon-warn-solid"></em> |
||||||
|
<span>{{$t('Drag the file into the current upload window')}}</span> |
||||||
|
</div> |
||||||
|
<!--<div class="hide-archive" v-if="progress !== 0" @click="_ckArchive"> |
||||||
|
<em class="fa fa-minus" data-toggle="tooltip" title="关闭窗口 继续上传" data-container="body" ></em> |
||||||
|
</div>--> |
||||||
|
<div class="update-popup" v-if="dragOver"> |
||||||
|
<div class="icon-box"> |
||||||
|
<em class="ans ans-icon-upload"></em> |
||||||
|
</div> |
||||||
|
<p class="p1"> |
||||||
|
<span>{{$t('Drag area upload')}}</span> |
||||||
|
</p> |
||||||
|
</div> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name"><strong>*</strong>{{$t('File Name')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<x-input |
||||||
|
type="input" |
||||||
|
v-model="name" |
||||||
|
:disabled="progress !== 0" |
||||||
|
:placeholder="$t('Please enter name')" |
||||||
|
autocomplete="off"> |
||||||
|
</x-input> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name">{{$t('Description')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<x-input |
||||||
|
type="textarea" |
||||||
|
v-model="description" |
||||||
|
:disabled="progress !== 0" |
||||||
|
:placeholder="$t('Please enter description')" |
||||||
|
autocomplete="off"> |
||||||
|
</x-input> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
<m-list-box-f> |
||||||
|
<template slot="name"><strong>*</strong>{{$t('Upload Files')}}</template> |
||||||
|
<template slot="content"> |
||||||
|
<div class="file-update-box"> |
||||||
|
<template v-if="progress === 0"> |
||||||
|
<input name="file" id="file" type="file" class="file-update"> |
||||||
|
<x-button type="dashed" size="xsmall"> {{$t('Upload')}} </x-button> |
||||||
|
</template> |
||||||
|
<div class="progress-box" v-if="progress !== 0"> |
||||||
|
<m-progress-bar :value="progress" text-placement="left-right"></m-progress-bar> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
</m-list-box-f> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
</template> |
||||||
|
</m-popup> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import io from '@/module/io' |
||||||
|
import i18n from '@/module/i18n' |
||||||
|
import store from '@/conf/home/store' |
||||||
|
import mPopup from '@/module/components/popup/popup' |
||||||
|
import mListBoxF from '@/module/components/listBoxF/listBoxF' |
||||||
|
import mProgressBar from '@/module/components/progressBar/progressBar' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: 'file-update', |
||||||
|
data () { |
||||||
|
return { |
||||||
|
store, |
||||||
|
// name |
||||||
|
name: '', |
||||||
|
// description |
||||||
|
description: '', |
||||||
|
// progress |
||||||
|
progress: 0, |
||||||
|
// file |
||||||
|
file: null, |
||||||
|
currentDir: '/', |
||||||
|
// Whether to drag upload |
||||||
|
dragOver: false |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
props: { |
||||||
|
type: String, |
||||||
|
fileName: String, |
||||||
|
desc: String, |
||||||
|
id: Number |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
/** |
||||||
|
* submit |
||||||
|
*/ |
||||||
|
_ok () { |
||||||
|
this.$refs['popup'].spinnerLoading = true |
||||||
|
if (this._validation()) { |
||||||
|
if(this.fileName===this.name) { |
||||||
|
const isLt1024M = this.file.size / 1024 / 1024 < 1024 |
||||||
|
if(isLt1024M) { |
||||||
|
this._formDataUpdate().then(res => { |
||||||
|
setTimeout(() => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}, 800) |
||||||
|
}).catch(e => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} else { |
||||||
|
this.$message.warning(`${i18n.$t('Upload File Size')}`) |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
} else { |
||||||
|
this.store.dispatch('resource/resourceVerifyName', { |
||||||
|
fullName: '/'+this.name, |
||||||
|
type: this.type |
||||||
|
}).then(res => { |
||||||
|
const isLt1024M = this.file.size / 1024 / 1024 < 1024 |
||||||
|
if(isLt1024M) { |
||||||
|
this._formDataUpdate().then(res => { |
||||||
|
setTimeout(() => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}, 800) |
||||||
|
}).catch(e => { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} else { |
||||||
|
this.$message.warning(`${i18n.$t('Upload File Size')}`) |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
}).catch(e => { |
||||||
|
this.$message.error(e.msg || '') |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
}) |
||||||
|
} |
||||||
|
} else { |
||||||
|
this.$refs['popup'].spinnerLoading = false |
||||||
|
} |
||||||
|
}, |
||||||
|
/** |
||||||
|
* validation |
||||||
|
*/ |
||||||
|
_validation () { |
||||||
|
if (!this.name) { |
||||||
|
this.$message.warning(`${i18n.$t('Please enter file name')}`) |
||||||
|
return false |
||||||
|
} |
||||||
|
if (!this.file) { |
||||||
|
this.$message.warning(`${i18n.$t('Please select the file to upload')}`) |
||||||
|
return false |
||||||
|
} |
||||||
|
return true |
||||||
|
}, |
||||||
|
/** |
||||||
|
* update file |
||||||
|
*/ |
||||||
|
_formDataUpdate () { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
let self = this |
||||||
|
let formData = new FormData() |
||||||
|
formData.append('file', this.file) |
||||||
|
formData.append('name', this.name) |
||||||
|
formData.append('description', this.description) |
||||||
|
formData.append('id', this.id) |
||||||
|
formData.append('type', this.type) |
||||||
|
io.post(`resources/update`, res => { |
||||||
|
this.$message.success(res.msg) |
||||||
|
resolve() |
||||||
|
self.$emit('onUpdate') |
||||||
|
}, e => { |
||||||
|
reject(e) |
||||||
|
self.$emit('close') |
||||||
|
this.$message.error(e.msg || '') |
||||||
|
}, { |
||||||
|
data: formData, |
||||||
|
emulateJSON: false, |
||||||
|
onUploadProgress (progressEvent) { |
||||||
|
// Size has been uploaded |
||||||
|
let loaded = progressEvent.loaded |
||||||
|
// Total attachment size |
||||||
|
let total = progressEvent.total |
||||||
|
self.progress = Math.floor(100 * loaded / total) |
||||||
|
self.$emit('onProgress', self.progress) |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
}, |
||||||
|
/** |
||||||
|
* Archive to the top right corner Continue uploading |
||||||
|
*/ |
||||||
|
_ckArchive () { |
||||||
|
$('.update-file-modal').hide() |
||||||
|
this.$emit('onArchive') |
||||||
|
}, |
||||||
|
/** |
||||||
|
* Drag and drop upload |
||||||
|
*/ |
||||||
|
_onDrop (e) { |
||||||
|
let file = e.dataTransfer.files[0] |
||||||
|
this.file = file |
||||||
|
this.name = file.name |
||||||
|
this.dragOver = false |
||||||
|
} |
||||||
|
}, |
||||||
|
mounted () { |
||||||
|
this.name = this.fileName |
||||||
|
this.description = this.desc |
||||||
|
$('#file').change(() => { |
||||||
|
let file = $('#file')[0].files[0] |
||||||
|
this.file = file |
||||||
|
this.name = file.name |
||||||
|
}) |
||||||
|
}, |
||||||
|
components: { mPopup, mListBoxF, mProgressBar } |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss" rel="stylesheet/scss"> |
||||||
|
.file-update-model { |
||||||
|
.tooltip-info { |
||||||
|
position: absolute; |
||||||
|
left: 20px; |
||||||
|
bottom: 26px; |
||||||
|
span { |
||||||
|
font-size: 12px; |
||||||
|
color: #666; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
.fa,.ans { |
||||||
|
color: #0097e0; |
||||||
|
font-size: 14px; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
} |
||||||
|
.hide-archive { |
||||||
|
position: absolute; |
||||||
|
right: 22px; |
||||||
|
top: 17px; |
||||||
|
.fa,.ans{ |
||||||
|
font-size: 16px; |
||||||
|
color: #333; |
||||||
|
font-weight: normal; |
||||||
|
cursor: pointer; |
||||||
|
&:hover { |
||||||
|
color: #0097e0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
.file-update-box { |
||||||
|
padding-top: 4px; |
||||||
|
position: relative; |
||||||
|
.file-update { |
||||||
|
width: 70px; |
||||||
|
height: 40px; |
||||||
|
position: absolute; |
||||||
|
left: 0; |
||||||
|
top: 0; |
||||||
|
cursor: pointer; |
||||||
|
filter: alpha(opacity=0); |
||||||
|
-moz-opacity: 0; |
||||||
|
opacity: 0; |
||||||
|
} |
||||||
|
&:hover { |
||||||
|
.v-btn-dashed { |
||||||
|
background-color: transparent; |
||||||
|
border-color: #47c3ff; |
||||||
|
color: #47c3ff; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
} |
||||||
|
.progress-box { |
||||||
|
width: 200px; |
||||||
|
position: absolute; |
||||||
|
left: 70px; |
||||||
|
top: 14px; |
||||||
|
} |
||||||
|
} |
||||||
|
.update-popup { |
||||||
|
width: calc(100% - 20px); |
||||||
|
height: calc(100% - 20px); |
||||||
|
background: rgba(255,253,239,.7); |
||||||
|
position: absolute; |
||||||
|
top: 10px; |
||||||
|
left: 10px; |
||||||
|
border-radius: 3px; |
||||||
|
z-index: 1; |
||||||
|
border: .18rem dashed #cccccc; |
||||||
|
.icon-box { |
||||||
|
text-align: center; |
||||||
|
margin-top: 96px; |
||||||
|
.fa,.ans { |
||||||
|
font-size: 50px; |
||||||
|
color: #2d8cf0; |
||||||
|
} |
||||||
|
} |
||||||
|
.p1 { |
||||||
|
text-align: center; |
||||||
|
font-size: 16px; |
||||||
|
color: #333; |
||||||
|
padding-top: 8px; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* 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.testcase.deleteData; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.base.BaseTest; |
||||||
|
import org.apache.dolphinscheduler.page.project.CreateProjectPage; |
||||||
|
import org.testng.annotations.Test; |
||||||
|
|
||||||
|
public class DeleteProjectTest extends BaseTest { |
||||||
|
private CreateProjectPage createProjectPage; |
||||||
|
|
||||||
|
@Test(groups={"functionTests"},dependsOnGroups = { "login","project"},description = "DeleteProjectTest",priority=7) |
||||||
|
public void testDeleteProject() throws InterruptedException { |
||||||
|
createProjectPage = new CreateProjectPage(driver); |
||||||
|
//jump to project manage page
|
||||||
|
System.out.println("jump to the project manage page to delete project"); |
||||||
|
createProjectPage.jumpProjectManagePage(); |
||||||
|
|
||||||
|
//assert tenant manage page
|
||||||
|
System.out.println("start delete project"); |
||||||
|
assert createProjectPage.deleteProject(); |
||||||
|
System.out.println("end delete project"); |
||||||
|
System.out.println("==================================="); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
/* |
||||||
|
* 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.testcase.deleteData; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.base.BaseTest; |
||||||
|
import org.apache.dolphinscheduler.page.security.TenantManagePage; |
||||||
|
import org.testng.annotations.Test; |
||||||
|
|
||||||
|
public class DeleteTenantTest extends BaseTest { |
||||||
|
private TenantManagePage tenantManagePage; |
||||||
|
|
||||||
|
@Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "DeleteTenantTest",priority=9) |
||||||
|
public void testDeleteTenant() throws InterruptedException { |
||||||
|
tenantManagePage = new TenantManagePage(driver); |
||||||
|
//assert tenant manage page
|
||||||
|
System.out.println("jump to security to delete tenant"); |
||||||
|
tenantManagePage.jumpSecurity(); |
||||||
|
|
||||||
|
System.out.println("start delete tenant"); |
||||||
|
assert tenantManagePage.deleteTenant(); |
||||||
|
System.out.println("end delete tenant"); |
||||||
|
System.out.println("==================================="); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
/* |
||||||
|
* 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.testcase.deleteData; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.base.BaseTest; |
||||||
|
import org.apache.dolphinscheduler.page.security.TenantManagePage; |
||||||
|
import org.apache.dolphinscheduler.page.security.UserManagePage; |
||||||
|
import org.testng.annotations.Test; |
||||||
|
|
||||||
|
public class DeleteUserTest extends BaseTest { |
||||||
|
private UserManagePage userManagePage; |
||||||
|
private TenantManagePage tenantManagePage; |
||||||
|
|
||||||
|
@Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "DeleteUserTest",priority=8) |
||||||
|
public void testDeleteUser() throws InterruptedException { |
||||||
|
tenantManagePage = new TenantManagePage(driver); |
||||||
|
System.out.println("jump to security to delete user"); |
||||||
|
tenantManagePage.jumpSecurity(); |
||||||
|
|
||||||
|
userManagePage = new UserManagePage(driver); |
||||||
|
//assert user manage page
|
||||||
|
System.out.println("start delete user"); |
||||||
|
assert userManagePage.deleteUser(); |
||||||
|
System.out.println("end delete user"); |
||||||
|
System.out.println("==================================="); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,43 @@ |
|||||||
|
/* |
||||||
|
* 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.testcase.deleteData; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.base.BaseTest; |
||||||
|
import org.apache.dolphinscheduler.page.project.CreateProjectPage; |
||||||
|
import org.apache.dolphinscheduler.page.project.CreateWorkflowPage; |
||||||
|
import org.testng.annotations.Test; |
||||||
|
|
||||||
|
public class DeleteWorkflowTest extends BaseTest { |
||||||
|
private CreateWorkflowPage createWorkflowPage; |
||||||
|
private CreateProjectPage createProjectPage; |
||||||
|
|
||||||
|
@Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "DeleteWorkflowTest",priority=6) |
||||||
|
public void testDeleteWorkflow() throws InterruptedException { |
||||||
|
createProjectPage = new CreateProjectPage(driver); |
||||||
|
//jump to project manage page
|
||||||
|
System.out.println("jump to the project manage page to delete workflow"); |
||||||
|
createProjectPage.jumpProjectManagePage(); |
||||||
|
|
||||||
|
createWorkflowPage = new CreateWorkflowPage(driver); |
||||||
|
createWorkflowPage.jumpWorkflowPage(); |
||||||
|
//assert tenant manage page
|
||||||
|
System.out.println("start delete workflow"); |
||||||
|
assert createWorkflowPage.deleteWorkflow(); |
||||||
|
System.out.println("end delete workflow"); |
||||||
|
System.out.println("==================================="); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
/* |
||||||
|
* 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. |
||||||
|
*/ |
||||||
|
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); |
||||||
|
SET FOREIGN_KEY_CHECKS=0; |
||||||
|
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
@ -0,0 +1,17 @@ |
|||||||
|
/* |
||||||
|
* 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. |
||||||
|
*/ |
||||||
|
UPDATE t_ds_user SET phone = '' WHERE phone = 'xx'; |
Loading…
Reference in new issue