Skip to content

Commit 85c3ad8

Browse files
Merge pull request #2145 from FedML-AI/raphael/fix-multi-deploy-subfd
[Deploy] Fix multi sub folder issue during deployment.
2 parents 826efa8 + c1e37af commit 85c3ad8

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

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

Lines changed: 15 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,20 @@ 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+
524+
if unzip_fd == "":
525+
return res
526+
522527
for folder in os.listdir(unzip_fd):
523-
if os.path.isdir(os.path.join(unzip_fd, folder)):
528+
if folder == model_name:
529+
res = os.path.join(unzip_fd, folder)
530+
exact_matched = True
531+
break
532+
533+
if not exact_matched:
534+
# Use the first folder found
535+
for folder in os.listdir(unzip_fd):
524536
res = os.path.join(unzip_fd, folder)
525537
break
526538

0 commit comments

Comments
 (0)