From e2783dae942441421abe1134c3076fc73f4794cb Mon Sep 17 00:00:00 2001 From: "Mr.James Wong" Date: Sat, 11 May 2024 19:34:19 +0800 Subject: [PATCH] fix: log conf & fmt --- .../execution/engine/AbstractScriptEngine.java | 4 ++-- .../rengine/executor/minio/MinioManager.java | 12 +++++++----- executor/src/main/resources/application.yaml | 18 +++++++++--------- .../job/AbstractFlinkStreamingBase.java | 16 ++++++++-------- service/src/main/resources/logback-spring.xml | 3 ++- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/executor/src/main/java/com/wl4g/rengine/executor/execution/engine/AbstractScriptEngine.java b/executor/src/main/java/com/wl4g/rengine/executor/execution/engine/AbstractScriptEngine.java index b1738ac6..5259a3b1 100644 --- a/executor/src/main/java/com/wl4g/rengine/executor/execution/engine/AbstractScriptEngine.java +++ b/executor/src/main/java/com/wl4g/rengine/executor/execution/engine/AbstractScriptEngine.java @@ -141,7 +141,7 @@ protected List loadScriptResources( boolean usingCache) { notNullOf(workflowId, "workflowId"); notNullOf(rule, "rule"); - log.debug("Loading script {} by workflowId: {}, ruleId: {}", workflowId, rule.getId()); + log.debug("Loading script by workflowId: {}, ruleId: {}", workflowId, rule.getId()); // Add upload object script dependencies all by scenes.workflow.rules final var ruleScript = rule.getEffectiveLatestScript(); @@ -164,7 +164,7 @@ protected List loadScriptResources( // Notice: According to the graal context eval mechanism, if there is a // function with the same name, the latter will overwrite the previous // eval function, so make sure that the main script is the last one. - Collections.sort(scriptObjects, (o1, o2) -> o1.getUploadId() == ruleScript.getEntrypointUploadId() ? 1 : -1); + scriptObjects.sort((o1, o2) -> o1.getUploadId() == ruleScript.getEntrypointUploadId() ? 1 : -1); return scriptObjects; } diff --git a/executor/src/main/java/com/wl4g/rengine/executor/minio/MinioManager.java b/executor/src/main/java/com/wl4g/rengine/executor/minio/MinioManager.java index 7e42b6b4..9de57b8a 100644 --- a/executor/src/main/java/com/wl4g/rengine/executor/minio/MinioManager.java +++ b/executor/src/main/java/com/wl4g/rengine/executor/minio/MinioManager.java @@ -40,6 +40,7 @@ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; +import java.util.List; import java.util.concurrent.TimeUnit; import javax.enterprise.event.Observes; @@ -106,14 +107,14 @@ void onStart(@Observes StartupEvent event) { .connectTimeout(httpClient.connectTimeout().toMillis(), TimeUnit.MILLISECONDS) .writeTimeout(config.httpClient().readTimeout().toMillis(), TimeUnit.MILLISECONDS) .readTimeout(config.httpClient().writeTimeout().toMillis(), TimeUnit.MILLISECONDS) - .protocols(Arrays.asList(Protocol.HTTP_1_1)) + .protocols(List.of(Protocol.HTTP_1_1)) .proxy(proxy) .build()); if (isBlank(config.region())) { builder.region(config.region()); } this.minioClient = builder.build(); - log.info("Initializated Minio Client: {}", minioClient); + log.info("Initialized Minio Client: {}", minioClient); } public ObjectResource loadObject( @@ -139,7 +140,7 @@ public ObjectResource loadObject( if ((currentTimeMillis() - localFile.lastModified()) < objectCacheExpireMs) { return new ObjectResource(uploadId, objectPrefix, binary, localFile, safeLongToInt(localFile.length())); } - // Expired and clearup + // Expired and clear-up if (!localFile.delete()) { log.warn("Unable to remove expired script cached of {}", localFile); } @@ -234,9 +235,10 @@ public static class ObjectResource { private @NotNull File localFile; private int available; + @SuppressWarnings("all") public byte[] readToBytes() throws IOException { - isTrue(available <= DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT, "Maximum file object readable limit exceeded: %s", - DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT); + isTrue(available <= DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT, + "Maximum file object readable limit exceeded: %s", DEFAULT_EXECUTOR_S3_OBJECT_MAX_LIMIT); return Resources.toByteArray(localFile.toURI().toURL()); } diff --git a/executor/src/main/resources/application.yaml b/executor/src/main/resources/application.yaml index 077702c7..b876e874 100644 --- a/executor/src/main/resources/application.yaml +++ b/executor/src/main/resources/application.yaml @@ -30,7 +30,7 @@ quarkus: ssl-port: 28012 test-ssl-port: 28022 root-path: / - insecure-requests: enabled ## enabled|redirect|disabled + insecure-requests: enabled # enabled|redirect|disabled cors: false tls: trust-all: false @@ -93,7 +93,7 @@ quarkus: enable: true format: '%d{yyyy-dd-mm HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n' ## see: script/executor-env.sh#L71 - path: /var/log/${quarkus.application.name}/${quarkus.application.name}.log + path: /tmp/log/${quarkus.application.name}/${quarkus.application.name}.log async: false #queue-length: 128 #overflow: block # block,discard @@ -279,10 +279,10 @@ quarkus: - redis://localhost:7380 - redis://localhost:7381 timeout: 10s - password: 'zzx!@#$%' - max-pool-size: 512 ## Default by 6 - max-pool-waiting: 512 ## Default by 24 - max-waiting-handlers: 2048 ## Default by 2048 + password: 'bitnami' + max-pool-size: 512 # Default by 6 + max-pool-waiting: 512 # Default by 24 + max-waiting-handlers: 2048 # Default by 2048 max-nested-arrays: 32 pool-cleaner-interval: 30m pool-recycle-timeout: 15s @@ -300,7 +300,7 @@ quarkus: lables: {} annotations: {} -## Rengine evaluator configuration. +## Rengine executor configuration. rengine: executor: services: @@ -329,7 +329,7 @@ rengine: per-executor-thread-pools: 2 minio: - endpoint: http://localhost:9000 + endpoint: http://localhost:19000 region: us-east-1 bucket: rengine access-key: rengine @@ -341,4 +341,4 @@ minio: proxy: type: DIRECT address: 127.0.0.1 - port: 8118 + port: 8118 \ No newline at end of file diff --git a/job/src/main/java/com/wl4g/rengine/job/AbstractFlinkStreamingBase.java b/job/src/main/java/com/wl4g/rengine/job/AbstractFlinkStreamingBase.java index 0bd6adc2..975d7074 100644 --- a/job/src/main/java/com/wl4g/rengine/job/AbstractFlinkStreamingBase.java +++ b/job/src/main/java/com/wl4g/rengine/job/AbstractFlinkStreamingBase.java @@ -59,7 +59,7 @@ /** * {@link AbstractFlinkStreamingBase} - * + * * @author James Wong <wanglsir@gmail.com, 983708408@qq.com> * @date 2022-06-07 v3.0.0 * @since v1.0.0 @@ -161,7 +161,7 @@ protected AbstractFlinkStreamingBase() { /** * Parsing command arguments to {@link CommandLineFacade}. - * + * * @param args * @return * @throws ParseException @@ -204,7 +204,7 @@ protected AbstractFlinkStreamingBase parse(String[] args) throws ParseException /** * Configuring custom FLINK environment details. - * + * * @return */ protected void customProps(Map props) { @@ -212,14 +212,14 @@ protected void customProps(Map props) { /** * Create FLINK source. - * + * * @return */ protected abstract Source createSource(); /** * Configuring custom FLINK data stream. - * + * * @return */ protected DataStream customStream(DataStream dataStreamSource) { @@ -232,14 +232,14 @@ protected DataStream customStream(DataStream dataStreamSource) /** * Create FLINK sink. - * + * * @return */ protected abstract Serializable createSink(); /** * Handling job execution result. - * + * * @param result */ protected void handleJobExecutionResult(JobExecutionResult result) { @@ -248,7 +248,7 @@ protected void handleJobExecutionResult(JobExecutionResult result) { @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void run() { - notNull(line, errmsg -> new IllegalStateException(errmsg), + notNull(line, IllegalStateException::new, "Parse arguments are not initialized, must call #parse() before"); // Custom details. diff --git a/service/src/main/resources/logback-spring.xml b/service/src/main/resources/logback-spring.xml index d5239fde..7deb33db 100644 --- a/service/src/main/resources/logback-spring.xml +++ b/service/src/main/resources/logback-spring.xml @@ -21,7 +21,8 @@ - /var/log/${appName}/${appName}.log + + /tmp/log/${appName}/${appName}.log ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz false