From c1f83b5a11a3a058ef045a82cafa48d017ace3bf Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 20 Feb 2025 22:46:31 -0500 Subject: [PATCH 1/3] add commands for flare api for the job components --- nvflare/fuel/flare_api/flare_api.py | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/nvflare/fuel/flare_api/flare_api.py b/nvflare/fuel/flare_api/flare_api.py index fbe73cae0b..d2ecbc2ca2 100644 --- a/nvflare/fuel/flare_api/flare_api.py +++ b/nvflare/fuel/flare_api/flare_api.py @@ -370,6 +370,36 @@ def download_job_result(self, job_id: str) -> str: location = meta.get(MetaKey.LOCATION) return location + def list_job_components(self, job_id: str) -> List[str]: + """Get the list of additional job components for the specified job. + + Args: + job_id (str): ID of the job + + Returns: a list of the additional job components + + """ + self._validate_job_id(job_id) + result = self._do_command(AdminCommandNames.LIST_JOB + " " + job_id) + meta = result[ResultKey.META] + job_components_list = meta.get(MetaKey.JOB_COMPONENTS, []) + return job_components_list + + def download_job_components(self, job_id: str) -> str: + """Download additional job components (e.g., ERRORLOG_site-1) for a specified job. + + Args: + job_id (str): ID of the job + + Returns: folder path to the location of the downloaded additional job components + + """ + self._validate_job_id(job_id) + result = self._do_command(AdminCommandNames.DOWNLOAD_JOB_COMPONENTS + " " + job_id) + meta = result[ResultKey.META] + location = meta.get(MetaKey.LOCATION) + return location + def abort_job(self, job_id: str): """Abort the specified job. From 03b2f785dec8ff1a1b7f736afac7ff6ecfcbe469 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 20 Feb 2025 22:56:21 -0500 Subject: [PATCH 2/3] add spec --- nvflare/fuel/flare_api/api_spec.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/nvflare/fuel/flare_api/api_spec.py b/nvflare/fuel/flare_api/api_spec.py index d11e526c3b..108b5c8634 100644 --- a/nvflare/fuel/flare_api/api_spec.py +++ b/nvflare/fuel/flare_api/api_spec.py @@ -17,6 +17,8 @@ from abc import ABC, abstractmethod from typing import List, Optional +from regex import P + class MonitorReturnCode(int, enum.Enum): @@ -197,6 +199,29 @@ def download_job_result(self, job_id: str) -> str: """ pass + @abstractmethod + def list_job_components(self, job_id: str) -> List[str]: + """Get the list of additional job components for the specified job. + + Args: + job_id (str): ID of the job + + Returns: a list of the additional job components + + """ + pass + + def download_job_components(self, job_id: str) -> str: + """Download additional job components (e.g., ERRORLOG_site-1) for a specified job. + + Args: + job_id (str): ID of the job + + Returns: folder path to the location of the downloaded additional job components + + """ + pass + @abstractmethod def abort_job(self, job_id: str): """Abort the specified job From bc9e17c6e3a0bf4b24e5346488bf488ddc6ed745 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 21 Feb 2025 08:46:25 -0500 Subject: [PATCH 3/3] fix extra line added by IDE --- nvflare/fuel/flare_api/api_spec.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/nvflare/fuel/flare_api/api_spec.py b/nvflare/fuel/flare_api/api_spec.py index 108b5c8634..35190e9840 100644 --- a/nvflare/fuel/flare_api/api_spec.py +++ b/nvflare/fuel/flare_api/api_spec.py @@ -17,8 +17,6 @@ from abc import ABC, abstractmethod from typing import List, Optional -from regex import P - class MonitorReturnCode(int, enum.Enum):