Skip to content

Commit

Permalink
fixes the issue with keys in meta not being str (NVIDIA#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvkevlu authored Apr 8, 2022
1 parent 8ee1a33 commit 198a66f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions nvflare/apis/impl/job_def_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ def create(self, meta: dict, uploaded_content: bytes, fl_ctx: FLContext) -> Dict
# - valid study ...

jid = str(uuid.uuid4())
meta[JobMetaKey.JOB_ID] = jid
meta[JobMetaKey.SUBMIT_TIME] = time.time()
meta[JobMetaKey.SUBMIT_TIME_ISO] = (
meta[JobMetaKey.JOB_ID.value] = jid
meta[JobMetaKey.SUBMIT_TIME.value] = time.time()
meta[JobMetaKey.SUBMIT_TIME_ISO.value] = (
datetime.datetime.fromtimestamp(meta[JobMetaKey.SUBMIT_TIME]).astimezone().isoformat()
)
meta[JobMetaKey.STATUS] = RunStatus.SUBMITTED
meta[JobMetaKey.STATUS.value] = RunStatus.SUBMITTED.value

# write it to the store
store = self._get_job_store(fl_ctx)
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_job(self, jid: str, fl_ctx: FLContext) -> Job:

def set_results_uri(self, jid: str, result_uri: str, fl_ctx: FLContext):
store = self._get_job_store(fl_ctx)
updated_meta = {JobMetaKey.RESULT_LOCATION: result_uri}
updated_meta = {JobMetaKey.RESULT_LOCATION.value: result_uri}
store.update_meta(self.job_uri(jid), updated_meta, replace=False)
return self.get_job(jid, fl_ctx)

Expand Down Expand Up @@ -187,7 +187,7 @@ def get_content(self, jid: str, fl_ctx: FLContext) -> bytes:
return store.get_data(self.job_uri(jid))

def set_status(self, jid: str, status: RunStatus, fl_ctx: FLContext):
meta = {JobMetaKey.STATUS: status}
meta = {JobMetaKey.STATUS.value: status}
store = self._get_job_store(fl_ctx)
store.update_meta(uri=self.job_uri(jid), meta=meta, replace=False)

Expand Down Expand Up @@ -232,9 +232,9 @@ def set_approval(
approvals = meta.get(JobMetaKey.APPROVALS)
if not approvals:
approvals = {}
meta[JobMetaKey.APPROVALS] = approvals
meta[JobMetaKey.APPROVALS.value] = approvals
approvals[reviewer_name] = (approved, note)
updated_meta = {JobMetaKey.APPROVALS: approvals}
updated_meta = {JobMetaKey.APPROVALS.value: approvals}
store = self._get_job_store(fl_ctx)
store.update_meta(self.job_uri(jid), updated_meta, replace=False)
return meta

0 comments on commit 198a66f

Please sign in to comment.