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

adjusted TimeElapsed for interruptions #33

Merged
merged 3 commits into from Sep 28, 2015
Merged

Conversation

msoelch
Copy link
Contributor

@msoelch msoelch commented Sep 1, 2015

previously, TimeElapsed would simply calculate time from its
instantiation, which is problematic if the experiment is interrupted thereafter. Now it can read out the info dict which can hold a more
meaningful runtime value.

@@ -147,7 +147,7 @@ def __init__(self, sec):
self.start = time.time()

def __call__(self, info):
return time.time() - self.start > self.sec
return getattr(info, 'time', time.time()) - self.start > self.sec
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if info is a dictionary, it won't ever have that attribute, it should be info.get('time', time.time()) to check for a key instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. My bad. Thanks.

@msoelch msoelch closed this Sep 1, 2015
previously, TimeElapsed would simply calculate time from its
instantiation, which is problematic if the experiment is interrupted
thereafter. Now it can read out the info dict which can hold a more
meaningful runtime value.
@msoelch
Copy link
Contributor Author

msoelch commented Sep 26, 2015

Should be good now.

bayerj added a commit that referenced this pull request Sep 28, 2015
adjusted TimeElapsed for interruptions
@bayerj bayerj merged commit 72282e9 into BRML:master Sep 28, 2015
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

Successfully merging this pull request may close these issues.

None yet

3 participants