cog
23aac48f - Tag worker events with prediction (#2020)

Commit
1 year ago
Tag worker events with prediction (#2020) * Formatting, moving `Envelope`, and using "tag" * Include tag in Cancel event and clean up TODO comments * Add pydantic v2 support to child worker `_apredict` * Keep a map of thread IDs to tags on _ChildWorker * Use context var to pass tag instead of dict since context vars are meant to be async-safe * don't use the contextvar in sync StreamRedirector * fix StreamPredictor working with tags * fix record_event with tags We were unintentionally dropping the tag from record_event() with sync predictions. This is fixed by introducing a self._current_tag property which Does The Right Thing whether in sync or async context. As part of this, we can also go back to a single _stream_write_hook() implementation. --------- Co-authored-by: Dominic Baggott <dominic.baggott@gmail.com> Co-authored-by: Philip Potter <phil@replicate.com>
Author
Parents
Loading