Skip to content

Commit 600905f

Browse files
committed
[Deploy] Fix multi sub folder issue during deployment.
1 parent 826efa8 commit 600905f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

python/fedml/computing/scheduler/model_scheduler/worker_job_runner.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def run_impl(self, run_extend_queue_list, sender_message_center,
205205
# Check if the package is already downloaded
206206
unzip_package_path = ""
207207
if os.path.exists(os.path.join(models_root_dir, parent_fd)):
208-
unzip_package_path = self.find_previous_downloaded_pkg(os.path.join(models_root_dir, parent_fd))
208+
unzip_package_path = self.find_previous_downloaded_pkg(os.path.join(models_root_dir, parent_fd), model_name)
209209

210210
# Download the package if not found
211211
if unzip_package_path == "":
@@ -510,7 +510,7 @@ def build_dynamic_constrain_variables(self, run_id, run_config):
510510
pass
511511

512512
@staticmethod
513-
def find_previous_downloaded_pkg(parent_dir) -> str:
513+
def find_previous_downloaded_pkg(parent_dir: str, model_name: str) -> str:
514514
unzip_fd = ""
515515
res = ""
516516

@@ -519,8 +519,17 @@ def find_previous_downloaded_pkg(parent_dir) -> str:
519519
unzip_fd = os.path.join(parent_dir, folder)
520520
break
521521

522+
exact_matched = False
523+
522524
for folder in os.listdir(unzip_fd):
523-
if os.path.isdir(os.path.join(unzip_fd, folder)):
525+
if folder == model_name:
526+
res = os.path.join(unzip_fd, folder)
527+
exact_matched = True
528+
break
529+
530+
if not exact_matched:
531+
# Use the first folder found
532+
for folder in os.listdir(unzip_fd):
524533
res = os.path.join(unzip_fd, folder)
525534
break
526535

0 commit comments

Comments
 (0)