Entrypoints
- class q2_sdk.core.entrypoint.BaseEntryPoint[source]
This is largely based off of the way Django organizes its Management Commands.
We do not need the power nor the flexibility that Django provides here, but it’s such a great pattern, it seems a shame to reinvent the wheel.
Basic idea: When running
q2
at the command line, each file in the entrypoints folder of the SDK that ends in .py and does not start with _ is loaded. The parser is built off of what lives in add_arguments, while the action when run is determined by what lives in the handle function.name: The command line parameter to be called (name=inspect means
q2 inspect
) help: Help message at the command line run_forever: If True, the asyncio loop will not exit after completion of handle function- property cache: Q2CacheClient
Instantiates a communication object between this extension and the pymemcache library. Cache can be configured via configuration.settings.CACHE.
- Returns:
Instantiated pymemcache.cache.Client object
- class q2_sdk.core.entrypoint_periodic.PeriodicJobEntryPoint[source]
Same as BaseEntryPoint but specialized for registering with a Cron-like system. Adds more logging and defined success/failure hooks for easier debugging when run overnight, for instance.
- async handle(*args, **kwargs)[source]
The actual logic of the command. Subclasses must implement this method.