Repository navigation
feat: ContainerCodeExecutor should support input_files and output_files - #5321
Closed
hamdi-sakly wants to merge 10 commits into
Closed
hamdi-sakly wants to merge 10 commits into
hamdi-sakly wants to merge 10 commits into
Conversation
hamdi-sakly
force-pushed
the
feat/container
branch
from
April 16, 2026 21:45
8933477 to
0c52042
Compare
Contributor
Author
|
Hi @rohityan , I fixed the formatting tell me if you need any more clarifications |
Collaborator
|
Hi @hamdi-sakly , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Can you please fix the failing unit tests before we can proceed with the review. |
Contributor
Author
|
Hi @rohityan the test failing is about importing docker in test environment , so I added docker to test . |
Contributor
Author
|
@rohityan could you please do a review |
|
any updates? |
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 28, 2026
Merge #5321 Fixes #5302 Executions on one ContainerCodeExecutor now run one at a time, since they share one container and its input and output directories. execute_code raises if those directories cannot be emptied, if the read-back of output_dir exceeds 100 MiB, or if an output name starts with `user:`. String input file content must be base64. PiperOrigin-RevId: 1009254901
Collaborator
|
Thank you @hamdi-sakly for your contribution! 🎉 Your changes have been successfully imported and merged via Copybara in commit effd641. Closing this PR as the changes are now in the main branch. |
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.
Problem
ContainerCodeExecutor currently ignores
CodeExecutionInput.input_filesand always returns an emptyoutput_fileslist, making it impossible to:Solution
Implement file I/O support using Docker's archive API:
Input files
Use
container.put_archive()to copy input files into the container before code execution./tmp/inputs/(configurable viainput_dir)Output files
Use
container.get_archive()to retrieve files from the container after execution./tmp/outputs/(configurable viaoutput_dir)Configuration changes
Added configurable parameters:
input_dir(default:/tmp/inputs)output_dir(default:/tmp/outputs)This approach is self-contained and does not require:
Testing Plan
Unit Tests
Added:
tests/unittests/code_executors/test_container_code_executor.pyTest coverage
TestContainerCodeExecutorInit
TestExecuteCode
TestPutInputFiles
put_archivecalls verificationTestGetOutputFiles
TestMimeTypeGuessing
Test Status
Fixes #5302