Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nvkevlu committed Jan 14, 2025
1 parent 7c9a5b7 commit dfaad25
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion nvflare/apis/fl_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class AdminCommandNames(object):
SUBMIT_JOB = "submit_job"
LIST_JOBS = "list_jobs"
GET_JOB_META = "get_job_meta"
LIST_JOB_COMPONENTS = "list_job_components"
LIST_JOB = "list_job"
DOWNLOAD_JOB = "download_job"
DOWNLOAD_JOB_COMPONENTS = "download_job_components"
DOWNLOAD_JOB_FILE = "download_job_file"
Expand Down
4 changes: 2 additions & 2 deletions nvflare/apis/impl/job_def_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ def get_client_data(self, jid: str, client_name: str, data_type: str, fl_ctx: FL
except StorageException:
return None

def list_client_data(self, jid: str, fl_ctx: FLContext):
def list_components(self, jid: str, fl_ctx: FLContext):
store = self._get_job_store(fl_ctx)
self.log_debug(
fl_ctx, f"list_client_data called for {jid}: {store.list_components_of_object(self.job_uri(jid))}"
fl_ctx, f"list_components called for {jid}: {store.list_components_of_object(self.job_uri(jid))}"
)
return store.list_components_of_object(self.job_uri(jid))

Expand Down
6 changes: 3 additions & 3 deletions nvflare/apis/job_def_manager_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ def get_client_data(self, jid: str, client_name: str, data_type: str, fl_ctx: FL
pass

@abstractmethod
def list_client_data(self, jid: str, fl_ctx: FLContext):
"""Get list of all the client data for the specified job.
def list_components(self, jid: str, fl_ctx: FLContext):
"""Get list of all the components for the specified job.
Args:
jid (str): Job ID
fl_ctx (FLContext): FLContext information
Returns:
data content
list of components
"""
pass
Expand Down
17 changes: 8 additions & 9 deletions nvflare/private/fed/server/job_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ def get_spec(self):
authz_func=self.authorize_job,
),
CommandSpec(
name=AdminCommandNames.LIST_JOB_COMPONENTS,
description="get additional components of specified job",
usage=f"{AdminCommandNames.LIST_JOB_COMPONENTS} job_id",
name=AdminCommandNames.LIST_JOB,
description="list additional components of specified job",
usage=f"{AdminCommandNames.LIST_JOB} job_id",
handler_func=self.list_job_components,
authz_func=self.authorize_job,
),
Expand Down Expand Up @@ -448,16 +448,15 @@ def list_job_components(self, conn: Connection, args: List[str]):
f"job_def_manager in engine is not of type JobDefManagerSpec, but got {type(job_def_manager)}"
)
with engine.new_context() as fl_ctx:
list_of_data = job_def_manager.list_client_data(jid=job_id, fl_ctx=fl_ctx)
list_of_data = job_def_manager.list_components(jid=job_id, fl_ctx=fl_ctx)
if list_of_data:
filtered_data = [
item for item in list_of_data if item not in {"workspace", "meta", "scheduled", "data"}
]
system_components = {"workspace", "meta", "scheduled", "data"}
filtered_data = [item for item in list_of_data if item not in system_components]
if filtered_data:
data_str = ", ".join(filtered_data)
conn.append_string(data_str)
else:
conn.append_string("No client error logs found.")
conn.append_string("No additional job components found.")
else:
conn.append_error(
f"job {job_id} does not exist", meta=make_meta(MetaStatusValue.INVALID_JOB_ID, job_id)
Expand Down Expand Up @@ -721,7 +720,7 @@ def download_job_components(self, conn: Connection, args: List[str]):
job_download_dir = self.tx_path(conn, tx_id) # absolute path of the job download dir.
with engine.new_context() as fl_ctx:
try:
list_of_data = job_def_manager.list_client_data(jid=job_id, fl_ctx=fl_ctx)
list_of_data = job_def_manager.list_components(jid=job_id, fl_ctx=fl_ctx)
if list_of_data:
job_components = [
item for item in list_of_data if item not in {"workspace", "meta", "scheduled", "data"}
Expand Down

0 comments on commit dfaad25

Please sign in to comment.