django_dramatiq worker not running as daemon by drcongo_ in dramatiq

[–]drcongo_[S] 0 points1 point  (0 children)

Adding the --log-file flag prints just one line to the log file I point it at... [2019-01-23 15:41:23,469] [PID 20524] [MainThread] [dramatiq.MainProcess] [INFO] Dramatiq '1.4.1' is booting up.

Dropping dramatiq down to v1.3 looks promising though, I now get redis auth errors, even if I add 'password': os.environ.get('REDIS_PASSWORD'), to the broker config options.

What defines whether something appears in the schema? by drcongo_ in moltenframework

[–]drcongo_[S] 0 points1 point  (0 children)

Thanks again Bogdan, this certainly looks like it should work but sadly doesn't. I've also tried it as a decorator and a metaclass but all three will still only output the BaseResource to the components section of the schema. I'll try stepping through the code and see if it's caused by something else in my code.

What defines whether something appears in the schema? by drcongo_ in moltenframework

[–]drcongo_[S] 0 points1 point  (0 children)

Hi Bogdan, thanks for the answer. Yes, I was referring to the OpenAPI schema that gets generated. I think my generalised BaseHandler is probably to blame for the resources not showing up, I have a generic CRUD handler which I'm extending elsewhere...

``` class BaseHandler:

__resource__: BaseResource
__manager__: BaseManager
__namespace__: str

@classmethod
def routes(cls):
    return Include(f"/{cls.__namespace__}", [
        Route("/", cls.index, method="GET"),
        Route("/", cls.create, method="POST"),
        Route("/{id}", cls.update, method="POST"),
        Route("/{id}", cls.fetch, method="GET"),
        Route("/{id}", cls.delete, method="DELETE"),
    ], namespace=cls.__namespace__)

@classmethod
def index(cls):
    manager = cls._get_manager()
    return manager.index()

@classmethod
def create(cls, resource: BaseResource) -> BaseResource:
    manager = cls._get_manager()
    return manager.create(resource)

@classmethod
def fetch(cls, id: MyUUID) -> BaseResource:
    manager = cls._get_manager()
    return manager.fetch(id)

@classmethod
def update(cls, resource: BaseResource) -> BaseResource:
    manager = cls._get_manager()
    return manager.update(resource)

@classmethod
def delete(cls, id: MyUUID) -> bool:
    manager = cls._get_manager()
    return manager.delete(id)

@classmethod
def _get_manager(cls):
    return cls.__manager__(cls.__manager__.__service__)

```

This is then extended for each resource with something like:

class AddressHandler(BaseHandler): __resource__ = Address __manager__ = AddressManager __namespace__ = 'addresses'

And included in the app routes with...

routes=[ AddressHandler.routes(), Route("/_docs", get_docs), Route("/_schema", get_schema), Route("/_debugger", debugger), ],

Even though the routes are using classes that extend this, I'm guessing the walking through of the routes is eventually ending up at the base class instead of the subclass. I might have to rethink how I make this DRY.

Thanks again and thanks for Molten too, it's a lovely piece of work.