pltbkd commented on code in PR #1299:
URL: https://github.com/apache/flink-agents/pull/1299#discussion_r4336207510


##########
runtime/src/main/java/org/apache/flink/agents/runtime/operator/ActionExecutionOperator.java:
##########
@@ -167,6 +172,34 @@ static boolean 
shouldEnableParallelExecutionWithoutCoroutine(
                 && (!usesPythonResource(agentPlan) || supportAsync());
     }
 
+    /**
+     * Rejects a child plan this engine cannot run: a worker cannot execute 
Python, and {@link
+     * #shouldEnableParallelExecutionWithoutCoroutine} screens only the root 
plan's own actions.
+     */
+    static void checkChildPlansRunOnParallelEngine(AgentPlan agentPlan) {
+        for (Map<String, ResourceProvider> providersByName :
+                agentPlan.getResourceProviders().values()) {
+            for (ResourceProvider provider : providersByName.values()) {
+                Optional<AgentPlan> child = 
InternalSubagentPlans.plan(provider);
+                if (!child.isPresent()) {
+                    continue;
+                }
+                for (Action action : child.get().getActions().values()) {
+                    checkState(
+                            action.getExec() instanceof JavaFunction,
+                            "The parallel execution engine runs an internal 
sub-agent's child"
+                                    + " actions on workers that cannot execute 
Python, but action"
+                                    + " %s of scope %s is not a Java action. 
Run this agent on JDK"
+                                    + " 21, or remove that action from the 
scope.",
+                            action.getName(),
+                            provider.getName());
+                }
+                // The plan tree is a DAG because cycles are rejected at 
compile time.
+                checkChildPlansRunOnParallelEngine(child.get());

Review Comment:
   Done — the recursive child-plan walk now screens resources the way the root 
is screened, failing when the operator opens and naming the scope. 



-- 
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