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

adding simple checkpoint to openhtf.util #816

Merged
merged 4 commits into from
Oct 2, 2018
Merged

Conversation

kdsudac
Copy link
Collaborator

@kdsudac kdsudac commented Aug 28, 2018

This change is Reviewable

@kdsudac kdsudac requested a review from Kenadia August 28, 2018 00:44
from openhtf.core import phase_descriptor
from openhtf.core import test_record

def Checkpoint(checkpoint_name=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

that's an odd name? I'd expect a Checkpoint to save my progress and let me restart a test from a checkpoint (like in a Mario or Sonic game), which is something I know was previously requested by one of the internal teams.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You have a pretty narrow definition of checkpoint, from a couple video games. :)

https://en.wikipedia.org/wiki/Checkpoint

I'm using it more in the sense of a place where you are stopped and a check is run to verify certain conditions are meet before you are allowed to proceed.

Open to other naming suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

The name makes sense to me but is a little nonspecific and could be annoying if we end up implementing the other type of checkpoint down the line.

Looks like internally we called this CheckValidOrDie. Another straightforward option that I like is StopTestIfFailed which I think should make things very clear to test operators and others viewing the test results.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm inclined to go with checkpoints.AlreadyFailing(). I have a bit of a pet peeve against function names being too verbose to the point where they are replacing short docstrings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't forget that phase lists are normally read directly, and you want to make sure that the phase name makes sense. AlreadyFailing doesn't say what the response is to it already failing, is it setting a measurement to True if it's already failing? StopIfFailing isn't any longer (I think it's actually shorter) and is clearer in its meaning

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's why we have a docstring and a logging statement.

I'm also still of opinion that checkpoints as a concept should capture the idea of 'stop' if conditions aren't met.

What I'm trying to avoid is this module turning into a bunch of flow control phases. e.g. XifY. I know there are some requests for that, but I'm of the opinion that is less is more. Start with the simplest case and hope that it captures 95% of the the use cases. We can re-examine the remaining 5% ad consider whether they should be added to the framework or are better handled in one-off fashion.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand if this phase is already doing flow control, it might be better to admit it than try to hide it. I'm mostly thinking of operators on the line for whom this could be confusing. They don't have docstrings and in general a single log line passes by very quickly and won't be seen (limitations of the UI design).

Anyway I don't like AlreadyFailing but if you prefer Checkpoint to StopIfFailing I'm fine getting this in and seeing how it goes.

Copy link
Contributor

@Kenadia Kenadia left a comment

Choose a reason for hiding this comment

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

LGTM. If you remember who was interested in using this feature it'd be nice to have them take a quick look as well

from openhtf.core import phase_descriptor
from openhtf.core import test_record

def Checkpoint(checkpoint_name=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

The name makes sense to me but is a little nonspecific and could be annoying if we end up implementing the other type of checkpoint down the line.

Looks like internally we called this CheckValidOrDie. Another straightforward option that I like is StopTestIfFailed which I think should make things very clear to test operators and others viewing the test results.

@fahhem
Copy link
Collaborator

fahhem commented Aug 28, 2018 via email

@kdsudac kdsudac merged commit 5eecb23 into google:master Oct 2, 2018
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.

3 participants