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

Implementation of priority queues/mailboxes #66

Open
julian-r opened this issue Feb 16, 2016 · 2 comments
Open

Implementation of priority queues/mailboxes #66

julian-r opened this issue Feb 16, 2016 · 2 comments

Comments

@julian-r
Copy link

I had the need for a priority mailbox. I implemented priority queues pretty raw with touching the core part as less as possible.

For the tell ask messages it looks like that:

actor_ref.ask({'pykka_priority': 10, 'num': 1})

For proxies it is usable with a small decorator:

class AnProxyActor(ThreadingActorPriorityMailbox):
    def __init__(self):
        ThreadingActorPriorityMailbox.__init__(self)
        self.call_order = []

    @priority(40)
    def important(self):
        time.sleep(0.4)
        self.call_order.append('important')

    @priority(30)
    def more_important(self):
        time.sleep(0.4)
        self.call_order.append('more_important')

Looking forward to your feedback.

Its here:
https://github.com/julian-r/pykka/tree/priority_queue

@jodal jodal added this to the v2.0 milestone Feb 16, 2016
@jodal
Copy link
Owner

jodal commented Feb 16, 2016

Without looking at the code, I find this interesting as a use case for what should be possible to do without altering Pykka itself. Setting this to milestone v2.0 to revisit it later.

@jodal jodal removed this from the v2.0 milestone Jan 22, 2019
@lostcontrol
Copy link

Without looking at the code, I find this interesting as a use case for what should be possible to do without altering Pykka itself. Setting this to milestone v2.0 to revisit it later.

I wonder how it would be possible to do this without altering Pykka at all!? In any case, this is an interesting feature that we could use. In our case, we can have x,x,x,x,x,x in the queue and want y to be served as soon as possible, mainly to interrupt any further processing of x.

@jodal jodal changed the title Implementation of priority queues/maiboxes Implementation of priority queues/mailboxes Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants