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

Task sychronization func decorator #54

Open
goodboy opened this issue Jan 20, 2019 · 3 comments
Open

Task sychronization func decorator #54

goodboy opened this issue Jan 20, 2019 · 3 comments
Labels
api help wanted Extra attention is needed question Further information is requested

Comments

@goodboy
Copy link
Owner

goodboy commented Jan 20, 2019

After working on the built-in pubsub system I've realized it may be useful to have a (set of) synchronization decorator(s) for limiting multi-task access to user defined functions.
This would make it easy to allow for multiple actors to make calls to a common actor that defines functions which don't want more then some finite number of tasks executing its body at a given time.

Need to think about it a little more.

@goodboy goodboy added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Jan 20, 2019
@gc-ss
Copy link

gc-ss commented May 13, 2021

which don't want more then some finite number of tasks executing its body at a given time.

Example?

@goodboy
Copy link
Owner Author

goodboy commented May 13, 2021

See the test here, though this was a pretty old example at this point and taking a much different approach then we can now with the stuff from #209.

@tractor.msg.pub(tasks=['one', 'two'])
async def multilock_pubber(get_topics):
    yield {'doggy': 10}

The basic idea was you could call (Portal.run()) this target func multiple times but in the "server" actor only one task would ever run the number of tasks specified (possibly by name?). I'm not sure if this makes sense any more at all since the func can just be defined to use trio.Locks and the like (trio.CapacityLimiter?).

This may have been a chewing the fat issues 😂

@goodboy
Copy link
Owner Author

goodboy commented May 13, 2021

Yah so I think the basic idea was having multiple tasks which were seeded differently maybe?

We might be able to just kill this one for now.

@goodboy goodboy added api and removed enhancement New feature or request labels May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants