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

Fix Modal deprecations #417

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
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: 4 additions & 3 deletions cubed/runtime/executors/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def check_runtime_memory(spec):

@stub.function(
image=aws_image,
secret=modal.Secret.from_name("my-aws-secret"),
secrets=[modal.Secret.from_name("my-aws-secret")],
memory=RUNTIME_MEMORY_MIB,
retries=2,
cloud="aws",
Expand All @@ -85,13 +85,14 @@ def run_remotely(input, func=None, config=None, name=None, compute_id=None):
# For GCP we need to use a class so we can set up credentials by hooking into the container lifecycle
@stub.cls(
image=gcp_image,
secret=modal.Secret.from_name("my-googlecloud-secret"),
secrets=[modal.Secret.from_name("my-googlecloud-secret")],
memory=RUNTIME_MEMORY_MIB,
retries=2,
cloud="gcp",
)
class Container:
def __enter__(self):
@modal.enter()
def set_up_credentials(self):
json = os.environ["SERVICE_ACCOUNT_JSON"]
path = os.path.abspath("application_credentials.json")
with open(path, "w") as f:
Expand Down
14 changes: 11 additions & 3 deletions cubed/tests/runtime/test_modal_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,27 @@


@stub.function(
image=image, secret=modal.Secret.from_name("my-aws-secret"), retries=2, timeout=10
image=image,
secrets=[modal.Secret.from_name("my-aws-secret")],
retries=2,
timeout=10,
)
def deterministic_failure_modal(i, path=None, timing_map=None, *, name=None):
return deterministic_failure(path, timing_map, i, name=name)


@stub.function(image=image, secret=modal.Secret.from_name("my-aws-secret"), timeout=10)
@stub.function(
image=image, secrets=[modal.Secret.from_name("my-aws-secret")], timeout=10
)
def deterministic_failure_modal_no_retries(i, path=None, timing_map=None, *, name=None):
return deterministic_failure(path, timing_map, i, name=name)


@stub.function(
image=image, secret=modal.Secret.from_name("my-aws-secret"), retries=2, timeout=300
image=image,
secrets=[modal.Secret.from_name("my-aws-secret")],
retries=2,
timeout=300,
)
def deterministic_failure_modal_long_timeout(
i, path=None, timing_map=None, *, name=None
Expand Down
Loading