Skip to content

Commit

Permalink
Merge branch '2.5' into remove_ha_ci_25
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanTingHsieh authored Jan 27, 2025
2 parents bf59547 + 379f1d6 commit 9d3c5c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
31 changes: 19 additions & 12 deletions nvflare/fuel/utils/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,29 @@ def format(self, record):
message = record.getMessage()
fl_ctx_match = re.search(r"\[(.*?)\]: ", message)
if fl_ctx_match:
fl_ctx_pairs = {
pair.split("=", 1)[0]: pair.split("=", 1)[1] for pair in fl_ctx_match.group(1).split(", ")
}
record.fl_ctx = fl_ctx_match[0][:-2]
record.identity = fl_ctx_pairs["identity"] # TODO add more values as attributes?
record.msg = message.replace(fl_ctx_match[0], "")
self._style._fmt = self.fmt
try:
fl_ctx_pairs = {
pair.split("=", 1)[0]: pair.split("=", 1)[1] for pair in fl_ctx_match.group(1).split(", ")
}
record.fl_ctx = fl_ctx_match[0][:-2]
record.identity = fl_ctx_pairs["identity"] # TODO add more values as attributes?
record.msg = message.replace(fl_ctx_match[0], "")
self._style._fmt = self.fmt
except:
# found brackets pattern, but invalid fl_ctx
self.remove_empty_placeholders()
else:
for placeholder in [
" %(fl_ctx)s -",
" %(identity)s -",
]: # TODO generalize this or add default values?
self._style._fmt = self._style._fmt.replace(placeholder, "")
self.remove_empty_placeholders()

return super().format(record)

def remove_empty_placeholders(self):
for placeholder in [
" %(fl_ctx)s -",
" %(identity)s -",
]: # TODO generalize this or add default values?
self._style._fmt = self._style._fmt.replace(placeholder, "")


class ColorFormatter(BaseFormatter):
def __init__(
Expand Down
1 change: 0 additions & 1 deletion nvflare/job_config/script_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def add_to_fed_job(self, job: FedJob, ctx, **kwargs):
launcher_id=launcher_id,
params_exchange_format=self._params_exchange_format,
params_transfer_type=self._params_transfer_type,
heartbeat_timeout=0,
)
)
job.add_executor(executor, tasks=tasks, ctx=ctx)
Expand Down

0 comments on commit 9d3c5c7

Please sign in to comment.