addu390 commented on code in PR #709:
URL: https://github.com/apache/flink-agents/pull/709#discussion_r3315593576


##########
plan/src/main/java/org/apache/flink/agents/plan/AgentPlan.java:
##########
@@ -228,20 +228,30 @@ private void extractActionsFromAgent(Agent agent) throws 
Exception {
         // Scan the agent class for methods annotated with @Action
         Class<?> agentClass = agent.getClass();
         for (Method method : agentClass.getDeclaredMethods()) {
-            if 
(method.isAnnotationPresent(org.apache.flink.agents.api.annotation.Action.class))
 {
-                org.apache.flink.agents.api.annotation.Action actionAnnotation 
=
-                        
method.getAnnotation(org.apache.flink.agents.api.annotation.Action.class);
-
-                String[] listenEventTypeStrings =
-                        
Objects.requireNonNull(actionAnnotation).listenEventTypes();
-
-                org.apache.flink.agents.plan.JavaFunction javaFunction =
+            if 
(!method.isAnnotationPresent(org.apache.flink.agents.api.annotation.Action.class))
 {
+                continue;
+            }
+            org.apache.flink.agents.api.annotation.Action actionAnnotation =
+                    Objects.requireNonNull(
+                            method.getAnnotation(
+                                    
org.apache.flink.agents.api.annotation.Action.class));
+            String[] listenEventTypeStrings = 
actionAnnotation.listenEventTypes();
+            org.apache.flink.agents.api.annotation.PythonFunction target =
+                    actionAnnotation.target();
+
+            org.apache.flink.agents.plan.Function execFunction;
+            if (target.module().isEmpty()) {

Review Comment:
   Agreed. Validation in `AgentPlan` now checks both fields: both empty is 
Java, both set is Python, anything in between throws with the action name. Same 
check on the Python decorator for both `PythonFunction` and `JavaFunction` 
targets. Also added tests for the reject cases on both sides.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to