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

Use the correct rq connection in get_queues_status #5491

Merged
merged 1 commit into from
May 14, 2021

Conversation

Jawshua
Copy link
Contributor

@Jawshua Jawshua commented May 6, 2021

This fixes rq throwing a NoRedisConnectionException exception when configured with a non-local redis instance.

What type of PR is this? (check all applicable)

  • Bug Fix

Description

If you have an external redis instance configured then the status CLI will spit out a trace that looks something like this:

$ /app/manage.py status
Traceback (most recent call last):
  File "/app/manage.py", line 9, in <module>
    manager()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/app/redash/cli/__init__.py", line 47, in status
    print(simplejson.dumps(get_status(), indent=2))
  File "/app/redash/monitor.py", line 57, in get_status
    status["manager"]["queues"] = get_queues_status()
  File "/app/redash/monitor.py", line 33, in get_queues_status
    return {queue.name: {"size": len(queue)} for queue in Queue.all()}
  File "/usr/local/lib/python3.7/site-packages/rq/queue.py", line 34, in all
    connection = resolve_connection(connection)
  File "/usr/local/lib/python3.7/site-packages/rq/connections.py", line 69, in resolve_connection
    raise NoRedisConnectionException('Could not resolve a Redis connection')
rq.connections.NoRedisConnectionException: Could not resolve a Redis connection

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

This fixes rq throwing a NoRedisConnectionException
exception when configured with a non-local redis instance.
@arikfr arikfr requested a review from rauchy May 14, 2021 13:39
Copy link
Contributor

@rauchy rauchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@rauchy rauchy merged commit 8cac6b5 into getredash:master May 14, 2021
lotreal added a commit to lotreal/redash that referenced this pull request Jun 22, 2021
* master:
  remove redundant fields from slack alert destination (getredash#5514)
  README.md: Add TiDB to the Supported Data Sources (getredash#5477)
  Refine Dockerfile caching (getredash#5484)
  fix big_query.py google api import error (getredash#5482)
  Use the correct rq connection in `get_queues_status` (getredash#5491)
  Fixing failure report rendering (getredash#5492)
  SFS-001: Adding support for the optional host connection property (getredash#5490)
  Expire sessions after 6 hours of inactivity (getredash#5159)
  use ptpython instead of standard python shell (getredash#5483)
  Adds rate limit to /forgot. (getredash#5425)
  Athena: skip tables with no StorageDescriptor (getredash#5447)
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.

2 participants