This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 9095e3e4f0 [INLONG-9712][Agent] Adjust task configuration verification 
logic (#9713)
9095e3e4f0 is described below

commit 9095e3e4f08a98f1966cee9a6810587dd0d6160c
Author: justinwwhuang <[email protected]>
AuthorDate: Wed Feb 21 11:48:51 2024 +0800

    [INLONG-9712][Agent] Adjust task configuration verification logic (#9713)
---
 .../src/main/java/org/apache/inlong/agent/conf/TaskProfile.java   | 4 +---
 .../org/apache/inlong/agent/plugin/task/file/LogFileTask.java     | 8 ++++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/conf/TaskProfile.java
 
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/conf/TaskProfile.java
index 0da4a8d349..ed96536a32 100644
--- 
a/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/conf/TaskProfile.java
+++ 
b/inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/conf/TaskProfile.java
@@ -121,9 +121,7 @@ public class TaskProfile extends AbstractConfiguration {
     public boolean allRequiredKeyExist() {
         return hasKey(TaskConstants.TASK_ID) && 
hasKey(TaskConstants.TASK_SOURCE)
                 && hasKey(TaskConstants.TASK_SINK) && 
hasKey(TaskConstants.TASK_CHANNEL)
-                && hasKey(TaskConstants.TASK_GROUP_ID) && 
hasKey(TaskConstants.TASK_STREAM_ID)
-                && hasKey(TaskConstants.TASK_CYCLE_UNIT)
-                && hasKey(TaskConstants.TASK_FILE_TIME_ZONE);
+                && hasKey(TaskConstants.TASK_GROUP_ID) && 
hasKey(TaskConstants.TASK_STREAM_ID);
     }
 
     public String toJsonStr() {
diff --git 
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/LogFileTask.java
 
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/LogFileTask.java
index 28a9a798b5..03f1baab7e 100644
--- 
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/LogFileTask.java
+++ 
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/file/LogFileTask.java
@@ -134,6 +134,14 @@ public class LogFileTask extends Task {
             LOGGER.error("task profile needs all required key");
             return false;
         }
+        if (!profile.hasKey(TaskConstants.TASK_CYCLE_UNIT)) {
+            LOGGER.error("task profile needs cycle unit");
+            return false;
+        }
+        if (!profile.hasKey(TaskConstants.TASK_FILE_TIME_ZONE)) {
+            LOGGER.error("task profile needs time zone");
+            return false;
+        }
         boolean ret =
                 profile.hasKey(TaskConstants.FILE_DIR_FILTER_PATTERNS)
                         && profile.hasKey(TaskConstants.FILE_MAX_NUM);

Reply via email to