wenjin272 commented on code in PR #367:
URL: https://github.com/apache/flink-agents/pull/367#discussion_r2579935347


##########
python/flink_agents/e2e_tests/python_event_logging_test.py:
##########
@@ -0,0 +1,119 @@
+################################################################################
+#  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.
+#################################################################################
+import json
+import tempfile
+from pathlib import Path
+
+from pyflink.common import Configuration, WatermarkStrategy
+from pyflink.datastream import (
+    KeySelector,
+    RuntimeExecutionMode,
+    StreamExecutionEnvironment,
+)
+from pyflink.datastream.connectors.file_system import (
+    FileSource,
+    StreamFormat,
+)
+
+from flink_agents.api.agent import Agent
+from flink_agents.api.decorators import action
+from flink_agents.api.events.event import InputEvent, OutputEvent
+from flink_agents.api.execution_environment import AgentsExecutionEnvironment
+from flink_agents.api.runner_context import RunnerContext
+
+
+class InputKeySelector(KeySelector):
+    """Key selector for input data."""
+
+    def get_key(self, value: dict) -> int:
+        """Extract key from input data."""
+        return value.get("id", 0)
+
+
+class PythonEventLoggingAgent(Agent):
+    """Agent for testing PythonEvent logging."""
+
+    @action(InputEvent)
+    @staticmethod
+    def process_input(event: InputEvent, ctx: RunnerContext) -> None:
+        """Process input event and send a PythonEvent."""
+        # Send a PythonEvent that should be logged with readable content
+        input_data = event.input
+        ctx.send_event(
+            OutputEvent(output={"processed_review": f"{input_data['review']}"})
+        )
+
+
+def test_python_event_logging(tmp_path: Path) -> None:

Review Comment:
   `tmp_path` is an internal fixture to provide auto cleaned tmp dir for each 
test case. Since it is not used in this case, maybe we can remove it.



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