Set the current context in a remote worker. This is used internally by Dataset to propagate the driver context to remote workers used for parallelization.
(context: Optional["DataContext"])
| 1000 | |
| 1001 | @staticmethod |
| 1002 | def _set_current(context: Optional["DataContext"]) -> Optional["DataContext"]: |
| 1003 | """Set the current context in a remote worker. |
| 1004 | |
| 1005 | This is used internally by Dataset to propagate the driver context to |
| 1006 | remote workers used for parallelization. |
| 1007 | """ |
| 1008 | global _default_context |
| 1009 | if context and ( |
| 1010 | not _default_context |
| 1011 | or _default_context.dataset_logger_id != context.dataset_logger_id |
| 1012 | ): |
| 1013 | update_dataset_logger_for_worker(context.dataset_logger_id) |
| 1014 | |
| 1015 | prev = _default_context |
| 1016 | # Update current context |
| 1017 | _default_context = context |
| 1018 | |
| 1019 | return prev |
| 1020 | |
| 1021 | @property |
| 1022 | def shuffle_strategy(self) -> ShuffleStrategy: |