Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydrate secrets in parallel during Sandbox.exec #2801

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions modal/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ._object import _get_environment_name, _Object
from ._resolver import Resolver
from ._resources import convert_fn_config_to_resources_config
from ._utils.async_utils import synchronize_api
from ._utils.async_utils import TaskContext, synchronize_api
from ._utils.deprecation import deprecation_error
from ._utils.grpc_utils import retry_transient_errors
from ._utils.mount_utils import validate_network_file_systems, validate_volumes
Expand Down Expand Up @@ -517,9 +517,8 @@ async def exec(
raise InvalidError(f"workdir must be an absolute path, got: {workdir}")

# Force secret resolution so we can pass the secret IDs to the backend.
# TODO should we parallelize this?
for secret in secrets:
await secret.hydrate(client=self._client)
secret_coros = [secret.hydrate(client=self._client) for secret in secrets]
await TaskContext.gather(*secret_coros)

task_id = await self._get_task_id()
req = api_pb2.ContainerExecRequest(
Expand Down
Loading