@@ -51,27 +51,46 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
51
51
return wrapper
52
52
53
53
54
- def ray_remote (function : Callable [..., Any ] ) -> Callable [..., Any ]:
54
+ def ray_remote (** options : Any ) -> Callable [..., Any ]:
55
55
"""
56
- Decorate callable to wrap within ray.remote.
56
+ Decorate with @ ray.remote providing .options() .
57
57
58
58
Parameters
59
59
----------
60
- function : Callable[..., Any]
61
- Callable as input to ray. remote.
60
+ options : Any
61
+ Ray remote options
62
62
63
63
Returns
64
64
-------
65
65
Callable[..., Any]
66
66
"""
67
- # Access the source function if it exists
68
- function = getattr (function , "_source_func" , function )
69
67
70
- @ wraps (function )
71
- def wrapper ( * args : Any , ** kwargs : Any ) -> Any :
72
- return ray . remote ( ray_logger ( function )). remote ( * args , ** kwargs ) # type: ignore
68
+ def remote_decorator (function : Callable [..., Any ]) -> Callable [..., Any ]:
69
+ """
70
+ Decorate callable to wrap within ray.remote.
73
71
74
- return wrapper
72
+ Parameters
73
+ ----------
74
+ function : Callable[..., Any]
75
+ Callable as input to ray.remote.
76
+
77
+ Returns
78
+ -------
79
+ Callable[..., Any]
80
+ """
81
+ # Access the source function if it exists
82
+ function = getattr (function , "_source_func" , function )
83
+
84
+ @wraps (function )
85
+ def wrapper (* args : Any , ** kwargs : Any ) -> Any :
86
+ remote_fn = ray .remote (ray_logger (function ))
87
+ if options :
88
+ remote_fn = remote_fn .options (** options )
89
+ return remote_fn .remote (* args , ** kwargs ) # type: ignore
90
+
91
+ return wrapper
92
+
93
+ return remote_decorator
75
94
76
95
77
96
def ray_get (futures : Union ["ray.ObjectRef[Any]" , List ["ray.ObjectRef[Any]" ]]) -> Any :
0 commit comments