ContextΒΆ

Context is instance witch contains links to entities to access on path.

await self.context.workers.worker1.stop(force=False)
await self.context.storages.tmp_disk.set(k, v)

Create instance Context with tree entities specified in conf

Tree in conf:

workers:
  worker1:
    cls: aioworkers.worker.base.Worker
    run: mymodule.mycoro

storages:
  tmp_disk:
    cls: aioworkers.storage.filesystem.HashFileSystemStorage
    path: /tmp/
from aioworkers.core.context import Context

context = Context(conf, loop=loop)

Initialize context

await context.init()

Set signals

context.on_start.append(self.start)
context.on_stop.append(self.stop)

Run context tree

await context.start()

Stop context tree

await context.stop()