Skip to main content
Version: 1.0.0 (latest)

common.runners.runnable

Runnable Objects

class Runnable(ABC, Generic[TExecutor])

[view_source]

__new__

def __new__(cls: Type["Runnable[TExecutor]"], *args: Any,
**kwargs: Any) -> "Runnable[TExecutor]"

[view_source]

Registers Runnable instance as running for a time when context is active. Used with ~workermethod decorator to pass a class instance to decorator function that must be static thus avoiding pickling such instance.

Arguments:

  • cls Type["Runnable"] - type of class to be instantiated

Returns:

  • Runnable - new class instance

workermethod

def workermethod(f: TFun) -> TFun

[view_source]

Decorator to be used on static method of Runnable to make it behave like instance method. Expects that first parameter to decorated function is an instance id of Runnable that gets translated into Runnable instance. Such instance is then passed as self to decorated function.

Arguments:

  • f TFun - worker function to be decorated

Returns:

  • TFun - wrapped worker function

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.