Pass max_count to troupe decorator dynamically
See original GitHub issueI am struggling to be able to pass a max_count value to the troupe decorator dynamically. I am calling like this:
from thespian.troupe import troupe
from thespain.actors import *
count = 30
decorated_actor= troupe(max_count=count)(Actor)
But when I pass the decorated_actor to the actor system it behaves as if its not decorated. What am I doing wrong here?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to configure a decorator in Python - Stack Overflow
Time passes c = input("Max count: ") Calculation = troupe(max_count=int(c), idle_count=2)(Calculation). (or, simply wait until you do have c ...
Read more >How to Dynamically Add Behaviors With Decorator Pattern
The Decorator Pattern is a structural design pattern that allows you to dynamically add behavior to a class without making changes to that ......
Read more >Primer on Python Decorators
In this introductory tutorial, we'll look at what Python decorators are and how to create and use them.
Read more >Dynamic Row Level Security with Manager Level Access in ...
I have written while ago, about how to implement a dynamic row level security in Power BI. This post is an addition to...
Read more >SQL Query with dynamic number of columns - Ask TOM
SQL Query with dynamic number of columns Hi Tom,I have a table like thiscreate table temp1(f_name ... 16 l_query := l_query || '...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The limit is mostly that imposed by your OS, not Thespian. There are various OS limits like the number of processes, number of open file descriptors, etc. that will probably be what you will encounter. I do not think 50 is likely to be an issue.
In addition, the troupe decorator will only create actors on-demand: if all existing actors are handling work and a new work message arrives, a new actor will be created (subject to the limit), but if there is an idle actor the work will be given to that actor instead. There is also an idle limit count for the troupe decorator, so if you do something like:
Then normally there will only be 4 MyActor instances running (the leader plus the 3 workers) but it will create up to 50 workers as needed.
Hi @kquick
Yes I am still using Thespian. That’s brilliant news! Thanks Kevin. Will be very handy to be able to do that. Will take a look at the latest update and give it a try.