modal.method
def method(
_warn_parentheses_missing=None,
*,
# Set this to True if it's a non-generator function returning
# a [sync/async] generator object
is_generator: Optional[bool] = None,
keep_warm: Optional[int] = None, # Deprecated: Use keep_warm on @app.cls() instead
) -> _MethodDecoratorType:
# TODO(elias): fix support for coroutine type unwrapping for methods (static typing)
Decorator for methods that should be transformed into a Modal Function registered against this class’s app.
Usage:
@app.cls(cpu=8)
class MyCls:
@modal.method()
def f(self):
...