-
Notifications
You must be signed in to change notification settings - Fork 18
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 less state-full design for collecting metrics #102
Comments
@Calvin-L @izgzhen I have several questions:
|
Ultimately the design is up to you, but:
It doesn't really matter, as long as it is documented. I would probably do something lightweight, like "a dictionary whose keys are method names and whose values are lists of the timestamps of when improvements were made".
That would be an example of shared mutable state, so I'm opposed to it. It would be much better for each job to collect its own local statistics and to aggregate them at the end. If you use the dictionary I proposed, each job would store a list and the aggregation would just arrange them into a dictionary by job name.
This can be done by the loop in How comfortable are you with generators (sometimes called "coroutines") in Python? def generate():
i = 0
while i < 100:
print("yielding...")
yield i
i += 1
for value in generate():
print("got {}".format(value)) In the example, the generator The You may want to alter
Actually it doesn't! The reason you were messing with If you intend the limit to be global rather than per-job, then instead you should modify the top-level loop that collects results to call |
discussion started in #93
The text was updated successfully, but these errors were encountered: