Skip to content

Commit

Permalink
Add ignore_image_cache config
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom committed Feb 21, 2025
1 parent 4d32b3a commit a267854
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions modal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class _Setting(typing.NamedTuple):
"worker_id": _Setting(), # For internal debugging use.
"restore_state_path": _Setting("/__modal/restore-state.json"),
"force_build": _Setting(False, transform=_to_boolean),
"ignore_image_cache": _Setting(False, transform=_to_boolean),
"traceback": _Setting(False, transform=_to_boolean),
"image_builder_version": _Setting(),
"strict_parameters": _Setting(False, transform=_to_boolean), # For internal/experimental use
Expand Down
1 change: 1 addition & 0 deletions modal/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ async def _load(self: _Image, resolver: Resolver, existing_object_id: Optional[s
# Failsafe mechanism to prevent inadvertant updates to the global images.
# Only admins can publish to the global namespace, but they have to additionally request it.
allow_global_deployment=os.environ.get("MODAL_IMAGE_ALLOW_GLOBAL_DEPLOYMENT", "0") == "1",
ignore_cache=config.get("ignore_image_cache"),
)
resp = await retry_transient_errors(resolver.client.stub.ImageGetOrCreate, req)
image_id = resp.image_id
Expand Down
3 changes: 3 additions & 0 deletions modal_proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,9 @@ message ImageGetOrCreateRequest {
string builder_version = 9;
// Only admins can publish global images, but this provides an extra failsafe
bool allow_global_deployment = 10;
// Include the App ID and version in the image cache key,
// which has the effect of making it look like the cache is being ignored during the build phase
bool ignore_cache = 11;
}

message ImageGetOrCreateResponse {
Expand Down

0 comments on commit a267854

Please sign in to comment.