Rewrite resolved container image path via the compute environment#23129
Open
natefoo wants to merge 2 commits into
Open
Rewrite resolved container image path via the compute environment#23129natefoo wants to merge 2 commits into
natefoo wants to merge 2 commits into
Conversation
When a job is dispatched to Pulsar with rewrite_parameters (i.e. a PulsarComputeEnvironment is in use), route the resolved container image path through the same ComputeEnvironment.unstructured_path_rewrite() that already rewrites unstructured tool parameters. This lets a destination `file_actions`/`file_action_config` `rewrite` rule remap the image to a compute-node path. Container resolution runs against the Galaxy-side filesystem (where e.g. /cvmfs exists), but singularity reads the image on the compute node, which may expose CVMFS at a different path (cvmfsexec mountrepo mode). Previously the image path was the only container path not routed through the compute environment (working directory and volumes already are), so it required a bespoke rewrite on the Pulsar server. It is now handled by the same mechanism as every other path. Unmatched unstructured paths resolve to a NoneAction, so this is a no-op unless a matching `rewrite` rule is configured; `rewrite` is a non-staging action, so the image is never uploaded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jmchilton
reviewed
Jul 17, 2026
| """ | ||
| if container is None or compute_environment is None: | ||
| return | ||
| rewritten_container_id = compute_environment.unstructured_path_rewrite(container.container_id) |
Member
There was a problem hiding this comment.
This is not what that is for - we have a lot of structure here and we should leverage it. This should be a new action type I assume if we actually want to use the path rewriter actions. Also I assume we can do better at figuring out if container_id might be a path - is it possible to determine if we expect it to be.
Member
Author
There was a problem hiding this comment.
I need to test it, but does the latest look better?
Address review feedback on galaxyproject#23129: - Instead of routing the resolved container image through `unstructured_path_rewrite` (meant for tool-parameter/tool-data paths), add a first-class `ComputeEnvironment.container_path_rewrite()` backed by the new `container` path type in the Pulsar file action mapper. A destination `file_actions` rule with `path_types: container` remaps the image without sharing a namespace with unstructured tool-parameter rewrites. - Only attempt the rewrite when the container image identifier is actually a filesystem path. Add `Container.image_identifier_is_path` (False for docker/registry references; `os.path.isabs()` for Singularity/Apptainer, so `docker://`, `library://`, `shub://`, `oras://` and registry refs are excluded) and guard on it in the runner. Depends on a pulsar-galaxy-lib release providing the `container` path type. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
natefoo
added a commit
to natefoo/pulsar
that referenced
this pull request
Jul 20, 2026
Introduce a first-class `container` path type in the file action mapper so a resolved container image path (e.g. a Singularity/Apptainer image on CVMFS) can be rewritten for the compute node via a `file_actions` `rewrite` rule with `path_types: container`, rather than overloading the `unstructured` tool-parameter path type. Like `unstructured`, `container` is not an ACTION_DEFAULT_PATH_TYPE, so its default action is `none` (no-op) and it is never staged -- container images live on CVMFS or in a registry. `PathMapper.check_for_container_rewrite()` applies a matching `rewrite` action and is a no-op otherwise. Consumed by Galaxy's PulsarComputeEnvironment.container_path_rewrite (dependent Galaxy PR galaxyproject/galaxy#23129). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
When a job is dispatched to Pulsar with rewrite_parameters (i.e. a PulsarComputeEnvironment is in use), route the resolved container image path through the same ComputeEnvironment.unstructured_path_rewrite() that already rewrites unstructured tool parameters. This lets a destination
file_actions/file_action_configrewriterule remap the image to a compute-node path.Container resolution runs against the Galaxy-side filesystem (where e.g. /cvmfs exists), but singularity reads the image on the compute node, which may expose CVMFS at a different path (cvmfsexec mountrepo mode). Previously the image path was the only container path not routed through the compute environment (working directory and volumes already are), so it required a bespoke rewrite on the Pulsar server. It is now handled by the same mechanism as every other path.
Unmatched unstructured paths resolve to a NoneAction, so this is a no-op unless a matching
rewriterule is configured;rewriteis a non-staging action, so the image is never uploaded.Corresponding Pulsar PR: galaxyproject/pulsar#475
How to test the changes?
(Select all options that apply)
License