class ModelRef, method_name: str)

Bases: object

Represents a method invocation of an instance of ModelRef.

This allows us to:
  1. Customize the place of actual execution of the method (inline, thread/process pool, or remote).

  2. Enrich the way of execution (sync versus async).


If you have an SKL model, you would normally invoke it by skl_ref.predict(df), which has a synchronous API. Within the inference graph, you could invoke await skl_ref.predict.async_run(df), which will automatically run on a thread with an asynchronous interface.


async async_run(*args: Any, **kwargs: Any) Any

Run the method in an asynchronous way. If the method is defined as async, this will simply run it. If not, this will be run in a separate thread.

  • *args – Arguments of the original method.

  • **kwargs – Keyword arguments of the original method.


The result of the original method.