Extract 'Messenger' from 'Context' and use directly

Summary

  • job: only pass Messenger to child, not all Context
  • Refactor, use context.messenger directly
  • Refactor: message handlers take 'is_silenced'
  • _context:extract _messenger.Messenger from Context
  • _context: rm stray break in comment block
  • _context: remove unused self._directory

This change depends on !1443 (merged)

Description

Separate out the responsibility of messaging from the rest of the Context object.

Update some comments to refer to the "Messenger API" instead of the "Context API" in the moved code.

Fixup the arg documentation to timed_activity() while we're there.

Remove the need to pass the Context object to message handlers, by passing what is usually requested from the context instead.

Instead of having methods in Context forward calls on to the Messenger, have folks call the Messenger directly.

Reduce the amount of context shared with some child jobs, by only sending the messenger portion of it rather than the whole thing. Also send the logdir.

This also means that we will need to pickle less stuff when using the 'spawn' method of multi-processing, as opposed to the 'fork' method.

Edited by Angelos Evripiotis

Merge request reports

Loading