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

Add Protocol Errors #441

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Add Protocol Errors #441

wants to merge 13 commits into from

Conversation

jthorton
Copy link
Contributor

@jthorton jthorton commented Dec 10, 2024

Fixes #385 by adding specific protocol execution and results errors.

Tips

  • Comment "pre-commit.ci autofix" to have pre-commit.ci atomically format your PR.
    Since this will create a commit, it is best to make this comment when you are finished with your work.

Checklist

  • Added a news entry

Developers certificate of origin

@jthorton jthorton marked this pull request as draft December 10, 2024 13:36
@jthorton
Copy link
Contributor Author

pre-commit.ci autofix

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.51%. Comparing base (703f151) to head (26031c3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #441   +/-   ##
=======================================
  Coverage   98.50%   98.51%           
=======================================
  Files          37       38    +1     
  Lines        2147     2156    +9     
=======================================
+ Hits         2115     2124    +9     
  Misses         32       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Couple of comments, otherwise it looks good to me!

gufe/protocols/errors.py Outdated Show resolved Hide resolved


# Protocol Results Errors
class MissingProtocolUnitError(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean a missing UnitResult?



# Protocol Errors
class ProtocolValidationError(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

Should we be subclassing out of a "BaseGufeException" type? I'm thinking it might be useful to have a catch-all that isn't a Exception in some cases.

For example - it might be good for execute_DAG to capture all of these and prevent trying to restart the DAG (i.e. if these are known deterministic failures, then we should assume they will happen over and over again).

@jthorton jthorton marked this pull request as ready for review December 12, 2024 14:52
@jthorton
Copy link
Contributor Author

pre-commit.ci autofix

@ijpulidos ijpulidos self-requested a review December 16, 2024 19:18
Copy link
Member

@dotsdl dotsdl left a comment

Choose a reason for hiding this comment

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

This is a great start @jthorton! Thank you for getting us going on more specific error modes for protocols!

# For details, see https://github.com/OpenFreeEnergy/gufe


class BaseGufeError(Exception):
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps change this one to ProtocolError, since it is the undifferentiated base class for all gufe.protocol errors?

Comment on lines +14 to +23
class ProtocolSetupError(BaseGufeError):
"""Error when executing the setup unit of the protocol."""


class ProtocolExecutionError(BaseGufeError):
"""Error when executing the production unit of the protocol."""


class ProtocolAnalysisError(BaseGufeError):
"""Error when trying to perform some analyses after the protocol has been executed."""
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps replace these with a single ProtocolUnitError, since different protocols may feature structure that don't map directly onto these 3 categories?

MissingUnitResultError:
if there are no results for that protocol unit
ProtocolUnitFailureError:
if all units failed
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if all units failed
if there are only failures for that protocol unit


# Protocol Results Errors
class MissingUnitResultError(BaseGufeError):
"""Error when a ProtocolDAGResult is missing a unit result."""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Error when a ProtocolDAGResult is missing a unit result."""
"""Error when a ProtocolDAGResult has no ProtocolUnitResult(s) for a given ProtocolUnit."""



class ProtocolUnitFailureError(BaseGufeError):
"""Error when a ProtocolDAGResult contains a failed protocol unit."""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""Error when a ProtocolDAGResult contains a failed protocol unit."""
"""Error when a ProtocolDAGResult has only ProtocolUnitFailure(s) for a given ProtocolUnit."""

class ProtocolAnalysisError(BaseGufeError):
"""Error when trying to perform some analyses after the protocol has been executed."""


Copy link
Member

Choose a reason for hiding this comment

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

May make sense to make a ProtocolDAGResultError(ProtocolError) class, and make the exceptions below subclass it?

@dotsdl
Copy link
Member

dotsdl commented Dec 19, 2024

@ijpulidos since this PR addresses #385, would you be willing to offer your feedback on this one?

@dotsdl
Copy link
Member

dotsdl commented Dec 19, 2024

@hannahbaumann since you're working in detail on protocols, would you be willing to offer feedback on our choices here?

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.

Have custom errors specific for protocols
3 participants