MCPcopy
hub / github.com/ray-project/ray / _set_current

Method _set_current

python/ray/data/context.py:1002–1019  ·  view source on GitHub ↗

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"])

Source from the content-addressed store, hash-verified

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:

Callers 14

currentMethod · 0.80
data_context_overrideFunction · 0.80
restore_data_contextFunction · 0.80
ndarray_to_blockFunction · 0.80
upstream_map_fnFunction · 0.80
upstream_map_fnFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
restore_data_contextFunction · 0.80
setupMethod · 0.80

Calls 1

Tested by 3

data_context_overrideFunction · 0.64
restore_data_contextFunction · 0.64
restore_data_contextFunction · 0.64