You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/02/17 05:37:22 UTC

[GitHub] [incubator-inlong] LvJiancheng opened a new pull request #2547: [Agent] agent pull task (binlog,file) from manager

LvJiancheng opened a new pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547


   ### Title Name: [INLONG-XYZ][component] Title of the pull request
   
   where *XYZ* should be replaced by the actual issue number.
   
   Fixes #<xyz>
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve.*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   *(Please pick either of the following options)*
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   *(or)*
   
   This change is already covered by existing tests, such as *(please describe tests)*.
   
   *(or)*
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] LvJiancheng commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
LvJiancheng commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r810828435



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/JobProfileDto.java
##########
@@ -130,11 +219,21 @@ public static TriggerProfile convertToTriggerProfile(DataConfig dataConfigs) {
         if (!dataConfigs.isValid()) {
             throw new IllegalArgumentException("input dataConfig" + dataConfigs + "is invalid please check");
         }
+        TaskTypeEnum taskType=TaskTypeEnum.getTaskType(dataConfigs.getTaskType());
         JobProfileDto profileDto = new JobProfileDto();
         Proxy proxy = getProxy(dataConfigs);
-        Job job = getJob(dataConfigs);
+        switch (taskType) {
+            case SQL:
+            case BINLOG:
+                BinlogJob binlogJob = getBinlogJob(dataConfigs);
+                profileDto.setBinlogJob(binlogJob);
+            case FILE:
+                FileJob job = getFileJob(dataConfigs);

Review comment:
       done

##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/JobProfileDto.java
##########
@@ -58,24 +62,73 @@
     }
 
     @Data
-    public static class Job {
+    public static class FileJob {
 
-        private Dir dir;
-        private String trigger;
-        private int id;
-        private Thread thread;
+        private String op;
         private String name;
         private String source;
         private String sink;
         private String channel;
+        private String trigger;
+        private String deliveryTime;
+
+
+        private Dir dir;
+        private int id;
+        private Thread thread;
         private String pattern;
-        private String op;
         private String cycleUnit;
         private String timeOffset;
-        private String deliveryTime;
         private String addictiveString;
     }
 
+    @Data
+    public static class FileJobTaskConfig {
+
+        private String dataName;
+        private String path;
+        private int taskId;
+        private Thread thread;
+        private String pattern;
+        private String cycleUnit;
+        private String timeOffset;
+        private String additionalAttr;
+    }
+
+    @Data
+    public static class BinlogJob {
+
+        private String op;
+        private String trigger;
+        private String name;
+        private String source;
+        private String sink;
+        private String channel;
+        private String deliveryTime;
+
+        private  String job_database_user;

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] EMsnap commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
EMsnap commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r809942307



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/JobProfileDto.java
##########
@@ -130,11 +219,21 @@ public static TriggerProfile convertToTriggerProfile(DataConfig dataConfigs) {
         if (!dataConfigs.isValid()) {
             throw new IllegalArgumentException("input dataConfig" + dataConfigs + "is invalid please check");
         }
+        TaskTypeEnum taskType=TaskTypeEnum.getTaskType(dataConfigs.getTaskType());
         JobProfileDto profileDto = new JobProfileDto();
         Proxy proxy = getProxy(dataConfigs);
-        Job job = getJob(dataConfigs);
+        switch (taskType) {
+            case SQL:
+            case BINLOG:
+                BinlogJob binlogJob = getBinlogJob(dataConfigs);
+                profileDto.setBinlogJob(binlogJob);
+            case FILE:
+                FileJob job = getFileJob(dataConfigs);

Review comment:
       The name of fileJob should be job since the Jobprofile use job.propertise to get property from profile

##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/JobProfileDto.java
##########
@@ -91,27 +144,63 @@
         private Manager manager;
     }
 
-    private static Job getJob(DataConfig dataConfigs) {
-        Job job = new Job();
+    private static BinlogJob getBinlogJob(DataConfig dataConfigs) {
+
+        BinlogJob binlogJob = new BinlogJob();
+        BinlogJobTaskConfig binlogJobTaskConfig =new BinlogJobTaskConfig();
+        Gson gson = new Gson();
+        binlogJobTaskConfig=gson.fromJson(dataConfigs.getTaskConfig(),BinlogJobTaskConfig.class);
+
+
+        binlogJob.setTrigger(DEFAULT_TRIGGER);
+        binlogJob.setChannel(DEFAULT_CHANNEL);
+        binlogJob.setName(MANAGER_JOB);
+        binlogJob.setSource(DEFAULT_SOURCE);
+        binlogJob.setSink(DEFAULT_DATAPROXY_SINK);
+        binlogJob.setOp(dataConfigs.getOp());
+        binlogJob.setDeliveryTime(dataConfigs.getDeliveryTime());
+
+        binlogJob.setJob_database_hostname(binlogJobTaskConfig.getJob_database_hostname());

Review comment:
       Camel-Case pls

##########
File path: inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/enums/ManagerOpEnum.java
##########
@@ -0,0 +1,60 @@
+/*
+ * 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.inlong.agent.enums;
+
+import static java.util.Objects.requireNonNull;
+
+public enum ManagerOpEnum {

Review comment:
       PLS extract to inlong common 

##########
File path: inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/enums/TaskTypeEnum.java
##########
@@ -0,0 +1,50 @@
+/*
+ * 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.inlong.agent.enums;
+
+import static java.util.Objects.requireNonNull;
+
+public enum TaskTypeEnum {

Review comment:
       Pls extract to inlong common

##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/JobProfileDto.java
##########
@@ -58,24 +62,73 @@
     }
 
     @Data
-    public static class Job {
+    public static class FileJob {
 
-        private Dir dir;
-        private String trigger;
-        private int id;
-        private Thread thread;
+        private String op;
         private String name;
         private String source;
         private String sink;
         private String channel;
+        private String trigger;
+        private String deliveryTime;
+
+
+        private Dir dir;
+        private int id;
+        private Thread thread;
         private String pattern;
-        private String op;
         private String cycleUnit;
         private String timeOffset;
-        private String deliveryTime;
         private String addictiveString;
     }
 
+    @Data
+    public static class FileJobTaskConfig {
+
+        private String dataName;
+        private String path;
+        private int taskId;
+        private Thread thread;
+        private String pattern;
+        private String cycleUnit;
+        private String timeOffset;
+        private String additionalAttr;
+    }
+
+    @Data
+    public static class BinlogJob {
+
+        private String op;
+        private String trigger;
+        private String name;
+        private String source;
+        private String sink;
+        private String channel;
+        private String deliveryTime;
+
+        private  String job_database_user;

Review comment:
       camel case 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] LvJiancheng commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
LvJiancheng commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r811726037



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/BinlogJob.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.inlong.agent.plugin.fetcher.dtos;
+
+import lombok.Data;
+
+@Data
+public class BinlogJob {

Review comment:
       good idea,fix it later




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] aloyszhang merged pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
aloyszhang merged pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] LvJiancheng commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
LvJiancheng commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r811767122



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/BinlogJob.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.inlong.agent.plugin.fetcher.dtos;
+
+import lombok.Data;
+
+@Data
+public class BinlogJob {

Review comment:
       done
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] EMsnap commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
EMsnap commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r810838115



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/FileJob.java
##########
@@ -0,0 +1,79 @@
+/*
+ * 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.inlong.agent.plugin.fetcher.dtos;
+
+import lombok.Data;
+
+@Data
+public class FileJob {
+
+    private String trigger;
+    private String name;
+    private String source;
+    private String sink;
+    private String channel;
+
+    private String deliveryTime;
+    private String op;
+
+    private Dir dir;
+    private Thread thread;
+    private int id;
+    private String pattern;
+    private String cycleUnit;
+    private String timeOffset;
+    private String addictiveString;
+
+    @Data
+    public static class Dir {
+
+        private String path;
+        private String pattern;
+    }
+
+    @Data
+    public static class Running {
+
+        private String core;
+    }
+
+    @Data
+    public static class Thread {
+
+        private Running running;
+    }
+
+    @Data
+    public static class FileJobTaskConfig {

Review comment:
       when change to FileJob, the properties in JobConstants should be job.filejob.file.read.wait




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-inlong] aloyszhang commented on a change in pull request #2547: [INLONG-2545][Agent] agent pull task (binlog,file) from manager

Posted by GitBox <gi...@apache.org>.
aloyszhang commented on a change in pull request #2547:
URL: https://github.com/apache/incubator-inlong/pull/2547#discussion_r810810018



##########
File path: inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/fetcher/dtos/BinlogJob.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.inlong.agent.plugin.fetcher.dtos;
+
+import lombok.Data;
+
+@Data
+public class BinlogJob {

Review comment:
       Why not abstract an interface for Job?

##########
File path: inlong-common/pom.xml
##########
@@ -63,11 +63,30 @@
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
-            <version>1.18.12</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sleepycat</groupId>
+            <artifactId>je</artifactId>
+            <version>7.3.7</version>

Review comment:
       version for dependency should be specified in `properties`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org