diff --git a/nvflare/fuel/flare_api/api_spec.py b/nvflare/fuel/flare_api/api_spec.py index d11e526c3b..35190e9840 100644 --- a/nvflare/fuel/flare_api/api_spec.py +++ b/nvflare/fuel/flare_api/api_spec.py @@ -197,6 +197,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 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.