MCPcopy Create free account
hub / github.com/BioinfoMachineLearning/FlowDock / log

Method log

flowdock/utils/pylogger.py:27–51  ·  view source on GitHub ↗

Delegate a log call to the underlying logger, after prefixing its message with the rank of the process it's being logged from. If `'rank'` is provided, then the log will only occur on that rank/process. :param level: The level to log at. Look at `logging.__init__.py` for mor

(self, level: int, msg: str, rank: Optional[int] = None, *args, **kwargs)

Source from the content-addressed store, hash-verified

25 self.rank_zero_only = rank_zero_only
26
27 def log(self, level: int, msg: str, rank: Optional[int] = None, *args, **kwargs) -> None:
28 """Delegate a log call to the underlying logger, after prefixing its message with the rank
29 of the process it's being logged from. If `'rank'` is provided, then the log will only
30 occur on that rank/process.
31
32 :param level: The level to log at. Look at `logging.__init__.py` for more information.
33 :param msg: The message to log.
34 :param rank: The rank to log at.
35 :param args: Additional args to pass to the underlying logging function.
36 :param kwargs: Any additional keyword args to pass to the underlying logging function.
37 """
38 if self.isEnabledFor(level):
39 msg, kwargs = self.process(msg, kwargs)
40 current_rank = getattr(rank_zero_only, "rank", None)
41 if current_rank is None:
42 raise RuntimeError("The `rank_zero_only.rank` needs to be set before use")
43 msg = rank_prefixed_message(msg, current_rank)
44 if self.rank_zero_only:
45 if current_rank == 0:
46 self.logger.log(level, msg, *args, **kwargs)
47 else:
48 if rank is None:
49 self.logger.log(level, msg, *args, **kwargs)
50 elif current_rank == rank:
51 self.logger.log(level, msg, *args, **kwargs)

Callers 15

segment_argminFunction · 0.80
segment_logsumexpFunction · 0.80
batched_sample_onehotFunction · 0.80
on_train_epoch_endMethod · 0.80
validation_stepMethod · 0.80
test_stepMethod · 0.80
on_test_epoch_endMethod · 0.80
free_energyMethod · 0.80
KL_HMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_stepMethod · 0.64