codenohup commented on code in PR #80:
URL: https://github.com/apache/flink-agents/pull/80#discussion_r2250359039
##########
python/flink_agents/runtime/local_runner.py:
##########
@@ -128,6 +128,23 @@ def get_action_metric_group(self) -> MetricGroup:
err_msg = "Metric mechanism is not supported for local agent execution
yet."
raise NotImplementedError(err_msg)
+ def execute_async(
+ self,
+ func: Callable[[Any], Any],
+ *args: Tuple[Any, ...],
+ **kwargs: Dict[str, Any],
+ ) -> Any:
+ """Asynchronously execute the provided function. Access to memory
+ is prohibited within the function.
+ """
+ logger.warning(
+ "Local runner does not support asynchronous execution; falling
back to synchronous execution."
+ )
+ func_result = func(*args, **kwargs)
+ yield func_result
+ return func_result
Review Comment:
> Should not need this `return` statement.
Since the action needs to obtain the result of the asynchronous function via
`yield from runner_context.execute_async(...)`, it is necessary to return the
value here. It should be modified as follows:
```python
func_result = func(*args, **kwargs)
yield
return func_result
```
--
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]