FEAT: Support for non docker executor#91
Draft
mberz wants to merge 2 commits intoengd_project_2026from
Draft
Conversation
…side a docker container. Now the local version also works (for debugging the CHORAS backend).
597e5eb to
504e2dd
Compare
There was a problem hiding this comment.
Pull request overview
Adds runtime-environment detection and more robust Docker mount-path translation to support running the backend both inside a container and directly on a developer machine.
Changes:
- Added
_is_running_in_container()and updatedget_host_path_for_container_path()to return paths unchanged when running locally. - Refactored container lookup into
_get_current_container()to improve container identification behavior. - Improved mount matching to select the most specific mount (supports nested/partial path matches).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| # |
| return client.containers.get(hostname) | ||
| except docker.errors.NotFound: | ||
| for container in client.containers.list(all=True): | ||
| if hostname == container.name or hostname in container.id: |
Comment on lines
+76
to
+81
| # For local debugging, we assume the container_path is directly accessible on the host | ||
| if not _is_running_in_container(): | ||
| logger.warning( | ||
| f"Running locally (not in container). Returning container_path as-is: {container_path}" | ||
| ) | ||
| return container_path |
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.
Description
Proposed changes.
_is_running_in_containerto reliably detect if the code is running inside a container, allowing the path resolution logic to adapt accordingly.get_host_path_for_container_pathto return the input path as-is with a warning when running locally, improving developer experience during local debugging._get_current_containerhelper, improving code clarity and error handling.get_host_path_for_container_pathto handle nested mounts and partial path matches, ensuring the most specific mount is used for path translation.Authored by @SilvinWillemsen