File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ def format(self, record: logging.LogRecord) -> str:
107107
108108CACHE_VOLUME_NAME = os .environ .get ("CACHE_VOLUME_NAME" , "" ) or None
109109
110+ MODAL_REGION = os .environ .get ("MODAL_REGION" , "" ) or None
111+
110112
111113def _get_gpu_config (gpu_key : str ):
112114 attr_name = GPU_LABEL_TO_ATTR .get (gpu_key )
@@ -676,10 +678,7 @@ async def github_webhook(request: Request):
676678 " && exec ./run.sh --jitconfig $GHA_JIT_CONFIG"
677679 )
678680
679- sandbox = modal .Sandbox .create (
680- "bash" ,
681- "-c" ,
682- cmd ,
681+ sandbox_kwargs = dict (
683682 image = runner_image ,
684683 app = app ,
685684 timeout = TIMEOUT_SECONDS ,
@@ -690,6 +689,15 @@ async def github_webhook(request: Request):
690689 volumes = sandbox_volumes ,
691690 experimental_options = {"enable_docker" : True },
692691 )
692+ if MODAL_REGION :
693+ sandbox_kwargs ["region" ] = MODAL_REGION
694+
695+ sandbox = modal .Sandbox .create (
696+ "bash" ,
697+ "-c" ,
698+ cmd ,
699+ ** sandbox_kwargs ,
700+ )
693701
694702 sandbox .set_tags ({"job_id" : str (job_id )})
695703
You can’t perform that action at this time.
0 commit comments