Skip to content

Commit

Permalink
Hydrate secrets in parallel during Sandbox.exec (#2801)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaskom authored Jan 23, 2025
1 parent e642cb1 commit f715781
Showing 1 changed file with 3 additions and 4 deletions.
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

0 comments on commit f715781

Please sign in to comment.