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

Result retrieval from groups/pipelines only work for the default broker #564

Closed
7 tasks done
DiegoPomares opened this issue Aug 15, 2023 · 1 comment
Closed
7 tasks done

Comments

@DiegoPomares
Copy link
Contributor

Issues

GitHub issues are for bugs. If you have questions, please ask them on the mailing list.

Checklist

  • Does your title concisely summarize the problem?
  • Did you include a minimal, reproducible example?
  • What OS are you using?
  • What version of Dramatiq are you using?
  • What did you do?
  • What did you expect would happen?
  • What happened?

What OS are you using?

Linux Mint 21.2 Victoria

What version of Dramatiq are you using?

1.14.2

What did you do?

Retrieving results with get_results() from a group, where the group was declared with a specific broker, and it isn't using the global/default one.
I modified the groups and pipelines to looks for the result in the backend of the broker they were declared with, with this it works as expected. Here goes the PR with the proposed changes: #563

What did you expect would happen?

I expected that the group retrieved the result from the backend of the broker it was declared with.

What happened?

I get the following error: RuntimeError: The default broker doesn't have a results backend.

Minimal reproducible example

import dramatiq
from dramatiq.brokers.redis import RedisBroker
from dramatiq.results.backends import RedisBackend
from dramatiq.results import Results


@dramatiq.actor
def add(x, y):
    return x + y


REDIS_URL = "redis://127.0.0.1:6379/0"

backend = RedisBackend(url=REDIS_URL)
results = Results(backend=backend, store_results=True)

broker = RedisBroker(url=REDIS_URL)
broker.add_middleware(results)
broker.declare_actor(add)


if __name__ == "__main__":
    group = dramatiq.group(
        broker=broker,
        children=[
            add.send(1, 1),
            add.send(2, 2),
        ]
    )
    group.run()

    results = list(group.get_results(block=True))  # RuntimeError!
    print(results)
@Bogdanp
Copy link
Owner

Bogdanp commented Aug 27, 2023

Closing as fixed by #563. I'll cut a new release in the next couple of weeks.

@Bogdanp Bogdanp closed this as completed Aug 27, 2023
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

No branches or pull requests

2 participants