From a78c72415ad6c58f28041ea71bf831e7d52c4f56 Mon Sep 17 00:00:00 2001 From: Advay Pal Date: Thu, 5 Sep 2024 12:25:11 -0400 Subject: [PATCH 1/2] move imports within image imports --- run_modal.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run_modal.py b/run_modal.py index 4675c1cb..2d82fdf2 100644 --- a/run_modal.py +++ b/run_modal.py @@ -85,7 +85,9 @@ torch.autograd.set_detect_anomaly(True) import argparse -from toolkit.job import get_job + +with image.imports(): + from toolkit.job import get_job def print_end_message(jobs_completed, jobs_failed): failure_string = f"{jobs_failed} failure{'' if jobs_failed == 1 else 's'}" if jobs_failed > 0 else "" From 7832c4298014ed2701efc121144d8f58dba43249 Mon Sep 17 00:00:00 2001 From: Advay Pal Date: Sun, 8 Sep 2024 10:13:25 -0400 Subject: [PATCH 2/2] Move import within main --- run_modal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/run_modal.py b/run_modal.py index 2d82fdf2..a1243129 100644 --- a/run_modal.py +++ b/run_modal.py @@ -86,9 +86,6 @@ import argparse -with image.imports(): - from toolkit.job import get_job - def print_end_message(jobs_completed, jobs_failed): failure_string = f"{jobs_failed} failure{'' if jobs_failed == 1 else 's'}" if jobs_failed > 0 else "" completed_string = f"{jobs_completed} completed job{'' if jobs_completed == 1 else 's'}" @@ -111,6 +108,7 @@ def print_end_message(jobs_completed, jobs_failed): timeout=7200 # 2 hours, increase or decrease if needed ) def main(config_file_list_str: str, recover: bool = False, name: str = None): + from toolkit.job import get_job # convert the config file list from a string to a list config_file_list = config_file_list_str.split(",")