Wraps an ActorMethod with pre-set options for .remote() and .bind(). Defined at module scope to avoid the reference cycle that occurs when a class is defined inside a closure (CPython's implicit __class__ cell keeps the closure alive, which keeps the ActorMethod and its ActorHandle aliv
| 1151 | |
| 1152 | |
| 1153 | class _ActorMethodOptionsWrapper: |
| 1154 | """Wraps an ActorMethod with pre-set options for .remote() and .bind(). |
| 1155 | |
| 1156 | Defined at module scope to avoid the reference cycle that occurs when a |
| 1157 | class is defined inside a closure (CPython's implicit __class__ cell keeps |
| 1158 | the closure alive, which keeps the ActorMethod and its ActorHandle alive). |
| 1159 | See https://github.com/ray-project/ray/issues/61922. |
| 1160 | """ |
| 1161 | |
| 1162 | def __init__(self, actor_method, options): |
| 1163 | self._actor_method = actor_method |
| 1164 | self._options = options |
| 1165 | |
| 1166 | def remote(self, *args, **kwargs): |
| 1167 | return self._actor_method._remote(args=args, kwargs=kwargs, **self._options) |
| 1168 | |
| 1169 | @DeveloperAPI |
| 1170 | def bind(self, *args, **kwargs): |
| 1171 | return self._actor_method._bind(args=args, kwargs=kwargs, **self._options) |
| 1172 | |
| 1173 | |
| 1174 | class _ActorClassMethodMetadata(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…