Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rq retry #120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Rq retry #120

wants to merge 2 commits into from

Conversation

amks1
Copy link

@amks1 amks1 commented Feb 20, 2022

Added support for the Retry() class of RQ. Tested working.

@liqb
Copy link

liqb commented Oct 20, 2022

@amks1
It's great that you have retry added. I tried the retry branch and found that it does not support try with interval argument.

retry=Retry(max=3, interval=10)

I checked rq docs and found that --with-scheduler parameter should be used when start a worker, so I suggest you add it to worker command. Thanks.

@mllife
Copy link

mllife commented Nov 23, 2023

Not working for me with redis. I added
retry=Retry(max=3, interval=[1, 1, 1]) to enqueue method

My 'on_failure' method is something like this;
on_failure=report_failure,

def report_failure(job, connection, type, value, traceback):
    # 'value' is the error msg. thrown by the error function
    logger.info("entered report_failure")
    logger.info(f"{job.retries_left=}")
    logger.info(f"{value=}")
    if job.retries_left:
        # redo
        logger.info("inside if")
        logger.info(
            f"{job.retries_left} retries left. Debug msg. '{value}'",
            extra={"clp_fields": {
                "chainId": job.id,
                "meta": job.meta,
                "process": "worker"
            }},
        )
        return
    # last try
    logger.info("outside if")
    logger.info(f"{job.args[0]['input']=}")
    # log final error
    logger.error(
        f"All retries failed. Error msg. '{value}'",
        extra={"clp_fields": {
            "chainId": job.id,
            "meta": job.meta,
            "process": "worker",
        }},
    )

The code only enters the report_failure 1 time and then don't do anything after that, it is supposed to call the retry worker method automatically. This was working with python rq library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants