Skip to content

Commit

Permalink
Minor Modal improvements (#375)
Browse files Browse the repository at this point in the history
* Add CUBED_MODAL_FORCE_BUILD env var to force container build on Modal

* Print the region that tasks are running in for Modal
  • Loading branch information
tomwhite authored Feb 11, 2024
1 parent 9cf7037 commit 47cb826
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cubed/runtime/executors/modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cubed.spec import Spec

RUNTIME_MEMORY_MIB = 2000
FORCE_BUILD = os.getenv("CUBED_MODAL_FORCE_BUILD") is not None

stub = modal.Stub("cubed-stub")

Expand All @@ -35,7 +36,8 @@
"tenacity",
"toolz",
"zarr",
]
],
force_build=FORCE_BUILD,
)
gcp_image = modal.Image.debian_slim().pip_install(
[
Expand All @@ -48,7 +50,8 @@
"tenacity",
"toolz",
"zarr",
]
],
force_build=FORCE_BUILD,
)


Expand All @@ -70,7 +73,7 @@ def check_runtime_memory(spec):
cloud="aws",
)
def run_remotely(input, func=None, config=None):
print(f"running remotely on {input}")
print(f"running remotely on {input} in {os.getenv('MODAL_REGION')}")
# note we can't use the execution_stat decorator since it doesn't work with modal decorators
result, stats = execute_with_stats(func, input, config=config)
return result, stats
Expand All @@ -94,7 +97,7 @@ def __enter__(self):

@modal.method()
def run_remotely(self, input, func=None, config=None):
print(f"running remotely on {input}")
print(f"running remotely on {input} in {os.getenv('MODAL_REGION')}")
# note we can't use the execution_stat decorator since it doesn't work with modal decorators
result, stats = execute_with_stats(func, input, config=config)
return result, stats
Expand Down

0 comments on commit 47cb826

Please sign in to comment.