Skip to content

Commit 7a9cfd0

Browse files
committed
Internal
PiperOrigin-RevId: 761862902 Change-Id: I1a54be43c50d6aa229689fda01c186dabaddca7c GitOrigin-RevId: 5321f94c3aa076cb8fe559ea7f7417ddd2a1c6b5
1 parent 69d137a commit 7a9cfd0

1 file changed

Lines changed: 0 additions & 17 deletions

File tree

‎xmanager/xm/core.py‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,6 @@ def _apply_args(job_type: job_blocks.JobType, args: Mapping[str, Any]) -> None:
9292
# pytype: enable=attribute-error
9393

9494

95-
def get_contextvar_value_by_name(name: str) -> Any | None:
96-
ctx = contextvars.copy_context()
97-
# Note: returns None when the var is unset, even if the ContextVar is defined
98-
# with a non-None `default` kwarg.
99-
for k, v in ctx.items():
100-
if k.name == name:
101-
return v
102-
return None
103-
104-
105-
def get_xid_from_context() -> int:
106-
"""Returns the XID from the context. Returns -1 if not found."""
107-
if experiment := get_contextvar_value_by_name('_xm_current_experiment'):
108-
return experiment.experiment_id
109-
return -1
110-
111-
11295
def _is_coro_context() -> bool:
11396
"""Returns whether we are currently running in a coroutine context."""
11497
is_coro_context = False

0 commit comments

Comments
 (0)