Fix 39c serverless example: bind mock server inside __main__ - #513
Open
nthmost-orkes wants to merge 1 commit into
Open
nthmost-orkes wants to merge 1 commit into
nthmost-orkes wants to merge 1 commit into
Conversation
The mock execution server was bound to port 9753 at module level. AgentRuntime re-imports the example in its worker process, so the worker hit the same bind and failed with "Address already in use", killing the worker. Move the bind inside the __main__ guard so the worker's re-import skips it. The Agent definition stays at module level (it only holds config and binds nothing), so the worker still gets what it needs. Fixes #512
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
39c_serverless_code_execution.pyexample bound its mock execution server to port 9753 at module level:AgentRuntimere-imports the example file in its worker process. On re-import the worker hit that same line, tried to bind port 9753 a second time, and died withAddress already in use— so the example never completed.Fix
Move the bind inside the
if __name__ == "__main__":guard. The worker's re-import evaluates the module but skips__main__, so it never re-binds. TheAgentdefinition stays at module level (it only holds config and binds nothing), so the worker still imports everything it needs.User impact
Running the serverless code-execution example would crash the moment the agent worker spun up (
Address already in use), so it never produced a result. Now the port is bound once in the main process and the worker runs cleanly against it.Fixes #512