LinkΒΆ

For entity relationships with typing, use Link.

Tree in conf:

worker:
  cls: mymodule.MyWorker
  storage: .storages.my_subdir.subdir

storages:
  cls: aioworkers.storage.filesystem.FileSystemStorage
  path: /tmp/
from aioworkers.core.base import link
from aioworkers.storage.filesystem import FileSystemStorage

class MyWorker(aioworkers.worker.base.Worker):
   storage: FileSystemStorage = link()

   async def run(*args, **kwargs):
       await self.storage.set('key', 'val')

Thus self.storage is property link to .storages.my_subdir.subdir

aioworkers

Navigation

  • Configuration
  • Entity
  • Link
  • Context
  • Command line interface
  • Queue
  • Plugin

Related Topics

  • Documentation overview
    • Previous: Entity
    • Next: Context

Quick search

©2016, Alexander Malev. | Powered by Sphinx 1.8.6 & Alabaster 0.7.12 | Page source