oceanos
5 years ago
321 changed files with 12704 additions and 5855 deletions
@ -0,0 +1,52 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!-- |
||||||
|
~ Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
~ contributor license agreements. See the NOTICE file distributed with |
||||||
|
~ this work for additional information regarding copyright ownership. |
||||||
|
~ The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
~ (the "License"); you may not use this file except in compliance with |
||||||
|
~ the License. You may obtain a copy of the License at |
||||||
|
~ |
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
~ |
||||||
|
~ Unless required by applicable law or agreed to in writing, software |
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
~ See the License for the specific language governing permissions and |
||||||
|
~ limitations under the License. |
||||||
|
--> |
||||||
|
|
||||||
|
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> |
||||||
|
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> |
||||||
|
|
||||||
|
<property name="log.base" value="logs"/> |
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||||
|
<encoder> |
||||||
|
<pattern> |
||||||
|
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
||||||
|
</pattern> |
||||||
|
<charset>UTF-8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<appender name="ALERTLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||||
|
<file>${log.base}/dolphinscheduler-alert.log</file> |
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||||
|
<fileNamePattern>${log.base}/dolphinscheduler-alert.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||||
|
<maxHistory>20</maxHistory> |
||||||
|
<maxFileSize>64MB</maxFileSize> |
||||||
|
</rollingPolicy> |
||||||
|
<encoder> |
||||||
|
<pattern> |
||||||
|
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
||||||
|
</pattern> |
||||||
|
<charset>UTF-8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<root level="INFO"> |
||||||
|
<appender-ref ref="STDOUT"/> |
||||||
|
<appender-ref ref="APILOGFILE"/> |
||||||
|
</root> |
||||||
|
|
||||||
|
</configuration> |
@ -0,0 +1,34 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.apache.dolphinscheduler.api.exceptions; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.api.enums.Status; |
||||||
|
|
||||||
|
import java.lang.annotation.Retention; |
||||||
|
import java.lang.annotation.Target; |
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.METHOD; |
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME; |
||||||
|
|
||||||
|
/** |
||||||
|
* controller exception annotation |
||||||
|
*/ |
||||||
|
@Retention(RUNTIME) |
||||||
|
@Target(METHOD) |
||||||
|
public @interface ApiException { |
||||||
|
Status value(); |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.apache.dolphinscheduler.api.exceptions; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.api.enums.Status; |
||||||
|
import org.apache.dolphinscheduler.api.utils.Result; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice; |
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
import org.springframework.web.method.HandlerMethod; |
||||||
|
|
||||||
|
/** |
||||||
|
* Exception Handler |
||||||
|
*/ |
||||||
|
@ControllerAdvice |
||||||
|
@ResponseBody |
||||||
|
public class ApiExceptionHandler { |
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ApiExceptionHandler.class); |
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class) |
||||||
|
public Result exceptionHandler(Exception e, HandlerMethod hm) { |
||||||
|
logger.error(e.getMessage(), e); |
||||||
|
ApiException ce = hm.getMethodAnnotation(ApiException.class); |
||||||
|
if (ce == null) { |
||||||
|
return Result.errorWithArgs(Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage()); |
||||||
|
} |
||||||
|
Status st = ce.value(); |
||||||
|
return Result.error(st); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!-- |
||||||
|
~ Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
~ contributor license agreements. See the NOTICE file distributed with |
||||||
|
~ this work for additional information regarding copyright ownership. |
||||||
|
~ The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
~ (the "License"); you may not use this file except in compliance with |
||||||
|
~ the License. You may obtain a copy of the License at |
||||||
|
~ |
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0 |
||||||
|
~ |
||||||
|
~ Unless required by applicable law or agreed to in writing, software |
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
~ See the License for the specific language governing permissions and |
||||||
|
~ limitations under the License. |
||||||
|
--> |
||||||
|
|
||||||
|
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> |
||||||
|
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> |
||||||
|
|
||||||
|
<property name="log.base" value="logs"/> |
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||||
|
<encoder> |
||||||
|
<pattern> |
||||||
|
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
||||||
|
</pattern> |
||||||
|
<charset>UTF-8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
|
||||||
|
<!-- api server logback config start --> |
||||||
|
<appender name="APILOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||||
|
<file>${log.base}/dolphinscheduler-api-server.log</file> |
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||||
|
<level>INFO</level> |
||||||
|
</filter> |
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||||
|
<fileNamePattern>${log.base}/dolphinscheduler-api-server.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
||||||
|
<maxHistory>168</maxHistory> |
||||||
|
<maxFileSize>64MB</maxFileSize> |
||||||
|
</rollingPolicy> |
||||||
|
<encoder> |
||||||
|
<pattern> |
||||||
|
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
||||||
|
</pattern> |
||||||
|
<charset>UTF-8</charset> |
||||||
|
</encoder> |
||||||
|
</appender> |
||||||
|
<!-- api server logback config end --> |
||||||
|
|
||||||
|
<logger name="org.apache.zookeeper" level="WARN"/> |
||||||
|
<logger name="org.apache.hbase" level="WARN"/> |
||||||
|
<logger name="org.apache.hadoop" level="WARN"/> |
||||||
|
|
||||||
|
|
||||||
|
<root level="INFO"> |
||||||
|
<appender-ref ref="STDOUT"/> |
||||||
|
<appender-ref ref="APILOGFILE"/> |
||||||
|
</root> |
||||||
|
|
||||||
|
</configuration> |
@ -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.api.exceptions; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.api.controller.AccessTokenController; |
||||||
|
import org.apache.dolphinscheduler.api.enums.Status; |
||||||
|
import org.apache.dolphinscheduler.api.utils.Result; |
||||||
|
import org.apache.dolphinscheduler.dao.entity.User; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.springframework.web.method.HandlerMethod; |
||||||
|
|
||||||
|
import java.lang.reflect.Method; |
||||||
|
|
||||||
|
import static org.junit.Assert.*; |
||||||
|
|
||||||
|
public class ApiExceptionHandlerTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void exceptionHandler() throws NoSuchMethodException { |
||||||
|
ApiExceptionHandler handler = new ApiExceptionHandler(); |
||||||
|
AccessTokenController controller = new AccessTokenController(); |
||||||
|
Method method = controller.getClass().getMethod("createToken", User.class, int.class, String.class, String.class); |
||||||
|
HandlerMethod hm = new HandlerMethod(controller, method); |
||||||
|
Result result = handler.exceptionHandler(new RuntimeException("test exception"), hm); |
||||||
|
Assert.assertEquals(Status.CREATE_ACCESS_TOKEN_ERROR.getCode(),result.getCode().intValue()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.apache.dolphinscheduler.api.utils; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.api.enums.Status; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
|
||||||
|
import static org.junit.Assert.*; |
||||||
|
|
||||||
|
public class ResultTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void success() { |
||||||
|
HashMap<String, String> map = new HashMap<>(); |
||||||
|
map.put("testdata", "test"); |
||||||
|
Result ret = Result.success(map); |
||||||
|
Assert.assertEquals(Status.SUCCESS.getCode(), ret.getCode().intValue()); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void error() { |
||||||
|
Result ret = Result.error(Status.ACCESS_TOKEN_NOT_EXIST); |
||||||
|
Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST.getCode(), ret.getCode().intValue()); |
||||||
|
} |
||||||
|
|
||||||
|
@Test |
||||||
|
public void errorWithArgs() { |
||||||
|
Result ret = Result.errorWithArgs(Status.INTERNAL_SERVER_ERROR_ARGS, "test internal server error"); |
||||||
|
Assert.assertEquals(Status.INTERNAL_SERVER_ERROR_ARGS.getCode(), ret.getCode().intValue()); |
||||||
|
} |
||||||
|
} |
File diff suppressed because one or more lines are too long
@ -1,169 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
~ Licensed to the Apache Software Foundation (ASF) under one or more |
|
||||||
~ contributor license agreements. See the NOTICE file distributed with |
|
||||||
~ this work for additional information regarding copyright ownership. |
|
||||||
~ The ASF licenses this file to You under the Apache License, Version 2.0 |
|
||||||
~ (the "License"); you may not use this file except in compliance with |
|
||||||
~ the License. You may obtain a copy of the License at |
|
||||||
~ |
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
~ |
|
||||||
~ Unless required by applicable law or agreed to in writing, software |
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
~ See the License for the specific language governing permissions and |
|
||||||
~ limitations under the License. |
|
||||||
--> |
|
||||||
|
|
||||||
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> |
|
||||||
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> |
|
||||||
|
|
||||||
<property name="log.base" value="logs"/> |
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
</appender> |
|
||||||
|
|
||||||
|
|
||||||
<!-- master server logback config start --> |
|
||||||
<appender name="MASTERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||||
<file>${log.base}/dolphinscheduler-master.log</file> |
|
||||||
<!--<filter class="org.apache.dolphinscheduler.common.log.MasterLogFilter"> |
|
||||||
<level>INFO</level> |
|
||||||
</filter>--> |
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||||
<fileNamePattern>${log.base}/dolphinscheduler-master.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
|
||||||
<maxHistory>168</maxHistory> |
|
||||||
<maxFileSize>200MB</maxFileSize> |
|
||||||
</rollingPolicy> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
</appender> |
|
||||||
<!-- master server logback config end --> |
|
||||||
|
|
||||||
|
|
||||||
<!-- worker server logback config start --> |
|
||||||
<conversionRule conversionWord="messsage" |
|
||||||
converterClass="org.apache.dolphinscheduler.common.log.SensitiveDataConverter"/> |
|
||||||
<appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender"> |
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|
||||||
<level>INFO</level> |
|
||||||
</filter> |
|
||||||
<filter class="org.apache.dolphinscheduler.common.log.TaskLogFilter"/> |
|
||||||
<Discriminator class="org.apache.dolphinscheduler.common.log.TaskLogDiscriminator"> |
|
||||||
<key>taskAppId</key> |
|
||||||
<logBase>${log.base}</logBase> |
|
||||||
</Discriminator> |
|
||||||
<sift> |
|
||||||
<appender name="FILE-${taskAppId}" class="ch.qos.logback.core.FileAppender"> |
|
||||||
<file>${log.base}/${taskAppId}.log</file> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
<append>true</append> |
|
||||||
</appender> |
|
||||||
</sift> |
|
||||||
</appender> |
|
||||||
<appender name="WORKERLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||||
<file>${log.base}/dolphinscheduler-worker.log</file> |
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|
||||||
<level>INFO</level> |
|
||||||
</filter> |
|
||||||
<filter class="org.apache.dolphinscheduler.common.log.WorkerLogFilter"/> |
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||||
<fileNamePattern>${log.base}/dolphinscheduler-worker.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
|
||||||
<maxHistory>168</maxHistory> |
|
||||||
<maxFileSize>200MB</maxFileSize> |
|
||||||
</rollingPolicy> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
</appender> |
|
||||||
<!-- worker server logback config end --> |
|
||||||
|
|
||||||
|
|
||||||
<!-- alert server logback config start --> |
|
||||||
<appender name="ALERTLOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||||
<file>${log.base}/dolphinscheduler-alert.log</file> |
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||||
<fileNamePattern>${log.base}/dolphinscheduler-alert.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
|
||||||
<maxHistory>20</maxHistory> |
|
||||||
<maxFileSize>64MB</maxFileSize> |
|
||||||
</rollingPolicy> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
</appender> |
|
||||||
<!-- alert server logback config end --> |
|
||||||
|
|
||||||
|
|
||||||
<!-- api server logback config start --> |
|
||||||
<appender name="APILOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|
||||||
<file>${log.base}/dolphinscheduler-api-server.log</file> |
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
|
||||||
<level>INFO</level> |
|
||||||
</filter> |
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
|
||||||
<fileNamePattern>${log.base}/dolphinscheduler-api-server.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern> |
|
||||||
<maxHistory>168</maxHistory> |
|
||||||
<maxFileSize>64MB</maxFileSize> |
|
||||||
</rollingPolicy> |
|
||||||
<encoder> |
|
||||||
<pattern> |
|
||||||
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n |
|
||||||
</pattern> |
|
||||||
<charset>UTF-8</charset> |
|
||||||
</encoder> |
|
||||||
</appender> |
|
||||||
<!-- api server logback config end --> |
|
||||||
|
|
||||||
<logger name="org.apache.zookeeper" level="WARN"/> |
|
||||||
<logger name="org.apache.hbase" level="WARN"/> |
|
||||||
<logger name="org.apache.hadoop" level="WARN"/> |
|
||||||
|
|
||||||
|
|
||||||
<root level="INFO"> |
|
||||||
<appender-ref ref="STDOUT"/> |
|
||||||
|
|
||||||
<if condition='p("server").contains("master-server")'> |
|
||||||
<then> |
|
||||||
<appender-ref ref="MASTERLOGFILE"/> |
|
||||||
</then> |
|
||||||
</if> |
|
||||||
<if condition='p("server").contains("worker-server")'> |
|
||||||
<then> |
|
||||||
<appender-ref ref="TASKLOGFILE"/> |
|
||||||
<appender-ref ref="WORKERLOGFILE"/> |
|
||||||
</then> |
|
||||||
</if> |
|
||||||
<if condition='p("server").contains("alert-server")'> |
|
||||||
<then> |
|
||||||
<appender-ref ref="ALERTLOGFILE"/> |
|
||||||
</then> |
|
||||||
</if> |
|
||||||
<if condition='p("server").contains("api-server")'> |
|
||||||
<then> |
|
||||||
<appender-ref ref="APILOGFILE"/> |
|
||||||
</then> |
|
||||||
</if> |
|
||||||
</root> |
|
||||||
|
|
||||||
</configuration> |
|
@ -0,0 +1,61 @@ |
|||||||
|
/* |
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||||
|
* contributor license agreements. See the NOTICE file distributed with |
||||||
|
* this work for additional information regarding copyright ownership. |
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||||
|
* (the "License"); you may not use this file except in compliance with |
||||||
|
* the License. You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package org.apache.dolphinscheduler.dao.utils; |
||||||
|
|
||||||
|
import org.apache.dolphinscheduler.common.utils.CollectionUtils; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* resource process definition utils |
||||||
|
*/ |
||||||
|
public class ResourceProcessDefinitionUtils { |
||||||
|
/** |
||||||
|
* get resource process map key is resource id,value is the set of process definition |
||||||
|
* @param list the map key is process definition id and value is resource_ids |
||||||
|
* @return resource process definition map |
||||||
|
*/ |
||||||
|
public static Map<Integer, Set<Integer>> getResourceProcessDefinitionMap(List<Map<String, Object>> list) { |
||||||
|
Map<Integer, String> map = new HashMap<>(); |
||||||
|
Map<Integer, Set<Integer>> result = new HashMap<>(); |
||||||
|
if (CollectionUtils.isNotEmpty(list)) { |
||||||
|
for (Map<String, Object> tempMap : list) { |
||||||
|
|
||||||
|
map.put((Integer) tempMap.get("id"), (String)tempMap.get("resource_ids")); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
for (Map.Entry<Integer, String> entry : map.entrySet()) { |
||||||
|
Integer mapKey = entry.getKey(); |
||||||
|
String[] arr = entry.getValue().split(","); |
||||||
|
Set<Integer> mapValues = Arrays.stream(arr).map(Integer::parseInt).collect(Collectors.toSet()); |
||||||
|
for (Integer value : mapValues) { |
||||||
|
if (result.containsKey(value)) { |
||||||
|
Set<Integer> set = result.get(value); |
||||||
|
set.add(mapKey); |
||||||
|
result.put(value, set); |
||||||
|
} else { |
||||||
|
Set<Integer> set = new HashSet<>(); |
||||||
|
set.add(mapKey); |
||||||
|
result.put(value, set); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -1,149 +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. |
|
||||||
# |
|
||||||
|
|
||||||
# base spring data source configuration |
|
||||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
|
||||||
# postgre |
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver |
|
||||||
spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler |
|
||||||
# mysql |
|
||||||
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver |
|
||||||
#spring.datasource.url=jdbc:mysql://localhost:3306/dolphinscheduler?useUnicode=true&characterEncoding=UTF-8 |
|
||||||
# h2 |
|
||||||
#spring.datasource.driver-class-name=org.h2.Driver |
|
||||||
#spring.datasource.url=jdbc:h2:file:../sql/h2;AUTO_SERVER=TRUE |
|
||||||
|
|
||||||
spring.datasource.username=test |
|
||||||
spring.datasource.password=test |
|
||||||
|
|
||||||
# connection configuration |
|
||||||
spring.datasource.initialSize=5 |
|
||||||
# min connection number |
|
||||||
spring.datasource.minIdle=5 |
|
||||||
# max connection number |
|
||||||
spring.datasource.maxActive=50 |
|
||||||
|
|
||||||
# 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. |
|
||||||
spring.datasource.maxWait=60000 |
|
||||||
|
|
||||||
# milliseconds for check to close free connections |
|
||||||
spring.datasource.timeBetweenEvictionRunsMillis=60000 |
|
||||||
|
|
||||||
# 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. |
|
||||||
spring.datasource.timeBetweenConnectErrorMillis=60000 |
|
||||||
|
|
||||||
# the longest time a connection remains idle without being evicted, in milliseconds |
|
||||||
spring.datasource.minEvictableIdleTimeMillis=300000 |
|
||||||
|
|
||||||
#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. |
|
||||||
spring.datasource.validationQuery=SELECT 1 |
|
||||||
|
|
||||||
#check whether the connection is valid for timeout, in seconds |
|
||||||
spring.datasource.validationQueryTimeout=3 |
|
||||||
|
|
||||||
# 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 |
|
||||||
spring.datasource.testWhileIdle=true |
|
||||||
|
|
||||||
#execute validation to check if the connection is valid when applying for a connection |
|
||||||
spring.datasource.testOnBorrow=true |
|
||||||
#execute validation to check if the connection is valid when the connection is returned |
|
||||||
spring.datasource.testOnReturn=false |
|
||||||
spring.datasource.defaultAutoCommit=true |
|
||||||
spring.datasource.keepAlive=true |
|
||||||
|
|
||||||
# open PSCache, specify count PSCache for every connection |
|
||||||
spring.datasource.poolPreparedStatements=true |
|
||||||
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 |
|
||||||
|
|
||||||
spring.datasource.spring.datasource.filters=stat,wall,log4j |
|
||||||
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 |
|
||||||
|
|
||||||
#mybatis |
|
||||||
mybatis-plus.mapper-locations=classpath*:/org.apache.dolphinscheduler.dao.mapper/*.xml |
|
||||||
|
|
||||||
mybatis-plus.typeEnumsPackage=org.apache.dolphinscheduler.*.enums |
|
||||||
|
|
||||||
#Entity scan, where multiple packages are separated by a comma or semicolon |
|
||||||
mybatis-plus.typeAliasesPackage=org.apache.dolphinscheduler.dao.entity |
|
||||||
|
|
||||||
#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"; |
|
||||||
mybatis-plus.global-config.db-config.id-type=AUTO |
|
||||||
|
|
||||||
#Field policy IGNORED:" ignore judgment ",NOT_NULL:" not NULL judgment "),NOT_EMPTY:" not NULL judgment" |
|
||||||
mybatis-plus.global-config.db-config.field-strategy=NOT_NULL |
|
||||||
|
|
||||||
#The hump underline is converted |
|
||||||
mybatis-plus.global-config.db-config.column-underline=true |
|
||||||
mybatis-plus.global-config.db-config.logic-delete-value=-1 |
|
||||||
mybatis-plus.global-config.db-config.logic-not-delete-value=0 |
|
||||||
mybatis-plus.global-config.db-config.banner=false |
|
||||||
#The original configuration |
|
||||||
mybatis-plus.configuration.map-underscore-to-camel-case=true |
|
||||||
mybatis-plus.configuration.cache-enabled=false |
|
||||||
mybatis-plus.configuration.call-setters-on-nulls=true |
|
||||||
mybatis-plus.configuration.jdbc-type-for-null=null |
|
||||||
|
|
||||||
# master settings |
|
||||||
# master execute thread num |
|
||||||
master.exec.threads=100 |
|
||||||
|
|
||||||
# master execute task number in parallel |
|
||||||
master.exec.task.num=20 |
|
||||||
|
|
||||||
# master heartbeat interval |
|
||||||
master.heartbeat.interval=10 |
|
||||||
|
|
||||||
# master commit task retry times |
|
||||||
master.task.commit.retryTimes=5 |
|
||||||
|
|
||||||
# master commit task interval |
|
||||||
master.task.commit.interval=1000 |
|
||||||
|
|
||||||
|
|
||||||
# only less than cpu avg load, master server can work. default value : the number of cpu cores * 2 |
|
||||||
master.max.cpuload.avg=100 |
|
||||||
|
|
||||||
# only larger than reserved memory, master server can work. default value : physical memory * 1/10, unit is G. |
|
||||||
master.reserved.memory=0.1 |
|
||||||
|
|
||||||
# worker settings |
|
||||||
# worker execute thread num |
|
||||||
worker.exec.threads=100 |
|
||||||
|
|
||||||
# worker heartbeat interval |
|
||||||
worker.heartbeat.interval=10 |
|
||||||
|
|
||||||
# submit the number of tasks at a time |
|
||||||
worker.fetch.task.num = 3 |
|
||||||
|
|
||||||
# only less than cpu avg load, worker server can work. default value : the number of cpu cores * 2 |
|
||||||
worker.max.cpuload.avg=100 |
|
||||||
|
|
||||||
# only larger than reserved memory, worker server can work. default value : physical memory * 1/6, unit is G. |
|
||||||
worker.reserved.memory=0.1 |
|
||||||
|
|
||||||
# data quality analysis is not currently in use. please ignore the following configuration |
|
||||||
# task record |
|
||||||
task.record.flag=false |
|
||||||
task.record.datasource.url=jdbc:mysql://192.168.xx.xx:3306/etl?characterEncoding=UTF-8 |
|
||||||
task.record.datasource.username=xx |
|
||||||
task.record.datasource.password=xx |
|
||||||
|
|
||||||
# Logger Config |
|
||||||
#logging.level.org.apache.dolphinscheduler.dao=debug |
|
@ -0,0 +1,70 @@ |
|||||||
|
# |
||||||
|
# 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. |
||||||
|
# |
||||||
|
|
||||||
|
|
||||||
|
# postgre |
||||||
|
#spring.datasource.driver-class-name=org.postgresql.Driver |
||||||
|
#spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler |
||||||
|
# mysql |
||||||
|
spring.datasource.driver-class-name=org.postgresql.Driver |
||||||
|
spring.datasource.url=jdbc:postgresql://localhost:5432/dolphinscheduler |
||||||
|
spring.datasource.username=test |
||||||
|
spring.datasource.password=test |
||||||
|
|
||||||
|
## base spring data source configuration todo need to remove |
||||||
|
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
||||||
|
|
||||||
|
# connection configuration |
||||||
|
#spring.datasource.initialSize=5 |
||||||
|
# min connection number |
||||||
|
#spring.datasource.minIdle=5 |
||||||
|
# max connection number |
||||||
|
#spring.datasource.maxActive=50 |
||||||
|
|
||||||
|
# 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. |
||||||
|
#spring.datasource.maxWait=60000 |
||||||
|
|
||||||
|
# milliseconds for check to close free connections |
||||||
|
#spring.datasource.timeBetweenEvictionRunsMillis=60000 |
||||||
|
|
||||||
|
# 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. |
||||||
|
#spring.datasource.timeBetweenConnectErrorMillis=60000 |
||||||
|
|
||||||
|
# the longest time a connection remains idle without being evicted, in milliseconds |
||||||
|
#spring.datasource.minEvictableIdleTimeMillis=300000 |
||||||
|
|
||||||
|
#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. |
||||||
|
#spring.datasource.validationQuery=SELECT 1 |
||||||
|
|
||||||
|
#check whether the connection is valid for timeout, in seconds |
||||||
|
#spring.datasource.validationQueryTimeout=3 |
||||||
|
|
||||||
|
# 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 |
||||||
|
#spring.datasource.testWhileIdle=true |
||||||
|
|
||||||
|
#execute validation to check if the connection is valid when applying for a connection |
||||||
|
#spring.datasource.testOnBorrow=true |
||||||
|
#execute validation to check if the connection is valid when the connection is returned |
||||||
|
#spring.datasource.testOnReturn=false |
||||||
|
#spring.datasource.defaultAutoCommit=true |
||||||
|
#spring.datasource.keepAlive=true |
||||||
|
|
||||||
|
# open PSCache, specify count PSCache for every connection |
||||||
|
#spring.datasource.poolPreparedStatements=true |
||||||
|
#spring.datasource.maxPoolPreparedStatementPerConnectionSize=20 |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue