conductor-oss / conductor-oss/conductor
Example 39c_serverless_code_execution.py needs to be changed for it to work
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 32.2k
- Forks
- 1k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 41
Description
currently we have start_mock_server not inside main. Moving it to main works
── Agent setup ───────────────────────────────────────────────────────
mock_server = _start_mock_server(port=9753)
serverless_coder = Agent(
name="serverless_coder",
model=settings.llm_model,
code_execution=CodeExecutionConfig(
executor=ServerlessCodeExecutor(
endpoint="http://127.0.0.1:9753/execute",
language="python",
timeout=15,
),
),
instructions=(
"You write Python code that runs on a remote execution service. "
"Use the execute_code tool to run code remotely."
),
)
if name == "main":
### #mock_server = _start_mock_server(port=9753). -> ADD THIS
with AgentRuntime() as runtime:
print("--- Serverless Code Execution ---")
result = runtime.run(
serverless_coder,
"Calculate 2**100 and print the result.",
)
result.print_result()
This was a claude code suggested fix and it works.
Claude's reasoning:
Before: mock_server = _start_mock_server(9753) was outside. You start the script — port 9753 grabbed. Worker starts, re-imports the file, hits that same line, tries to grab 9753 again. Already taken → Address already in use → worker dies.
After: it's inside the if. You start the script — port grabbed once. Worker re-imports, reaches the if, sees it's false, skips it. No second bind. Worker lives.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open 39c_serverless_code_execution.py and start by running the example to reproduce the address-in-use failure. Review the mock server setup and the main entry point; done means the example starts the server once and completes remote execution without the worker failing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100