MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / wrapper

Function wrapper

verl/verl/utils/ray_utils.py:106–120  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

104
105 @functools.wraps(func)
106 def wrapper(*args, **kwargs):
107 coro = func(*args, **kwargs)
108
109 if not inspect.iscoroutine(coro):
110 return coro
111
112 try:
113 loop = asyncio.get_running_loop()
114 except RuntimeError:
115 loop = None
116
117 if loop and loop.is_running():
118 return coro
119 else:
120 return asyncio.run(coro)
121
122 return wrapper

Callers

nothing calls this directly

Calls 2

funcFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected