How to use the huey.MemoryHuey function in huey

To help you get started, we’ve selected a few huey examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scoutapp / scout_apm_python / tests / integration / test_huey.py View on Github external
def app_with_scout(scout_config=None):
    """
    Context manager that configures a Huey app with Scout installed.
    """
    # Enable Scout by default in tests.
    if scout_config is None:
        scout_config = {}
    scout_config.setdefault("monitor", True)
    scout_config["core_agent_launch"] = False

    huey = MemoryHuey(immediate=True)

    @huey.task()
    @huey.lock_task("hello")
    def hello():
        return "Hello World!"

    @huey.task()
    def retry_once():
        if not retry_once._did_retry:
            retry_once._did_retry = True
            raise RetryTask()
        return "Done."

    retry_once._did_retry = False

    @huey.task()