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

Execution hooks (core features) #508

Merged
merged 157 commits into from
Dec 29, 2021
Merged

Execution hooks (core features) #508

merged 157 commits into from
Dec 29, 2021

Conversation

bdice
Copy link
Member

@bdice bdice commented Apr 30, 2021

Description

Extension of #189 that includes only core features. This will make the PR easier to review and finalize. See #189 for details.

To-do:

  • Update test class structure, see comment.
  • Add tests that improve coverage.
  • Discuss API for hooks. What should the signature be? Currently hook(operation_name, error, *jobs) (error only for on_fail).
  • Update docs.

Motivation and Context

Implement core features of execution hooks.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog.

This is a prototype implementation for the API proposed in issue #28.
To avoid the need to implement a class and also avoid forcing of a
specific function name.
This makes it easier to integrate those hook systems with git
tracking.
Instead of storing metadata in the commit message.
No longer needed since the drop of support for Python 2.7.
Also just ignore the hidden signac snapshots directory instead of
all hidden files and directories.
@csadorf
Copy link
Contributor

csadorf commented Nov 17, 2021

1. Should `flow.hooks.Hooks` be public? Should it be documented in our API? It is never user-facing as far as I can tell.

No, the properties on the project that users are expected to use should be public and part of the API IMO.

2. We need to fix the docs for `FlowProject.operation_hooks`. I noticed it wasn't documented at all so I added it to `api.rst` but it's currently broken (shows up as "alias of `flow.project._FlowProjectClass._setup_hook_object.<locals>._HooksRegister`"). I think this used to be an issue with pre/post so a similar fix may be applicable (I can't remember what I did).

What is your suggestion? Should we try to fix this as part of this PR or not?

@bdice
Copy link
Member Author

bdice commented Nov 17, 2021

  1. Should flow.hooks.Hooks be public? Should it be documented in our API? It is never user-facing as far as I can tell.

No, the properties on the project that users are expected to use should be public and part of the API IMO.

I agree. I recommend renaming Hooks to _Hooks and making FlowProject.project_hooks / FlowProject.operation_hook the public documented API.

  1. We need to fix the docs for FlowProject.operation_hooks. I noticed it wasn't documented at all so I added it to api.rst but it's currently broken (shows up as "alias of flow.project._FlowProjectClass._setup_hook_object.<locals>._HooksRegister"). I think this used to be an issue with pre/post so a similar fix may be applicable (I can't remember what I did).

What is your suggestion? Should we try to fix this as part of this PR or not?

I'm fine with fixing the docs in this PR or in a subsequent PR -- just wanted to note the issue for right now. I can revisit this again later in the week but would welcome anyone who has time to work on it sooner.

@b-butler
Copy link
Member

@bdice I couldn't get the documentation quite right but I made it passable I think.

flow/project.py Outdated Show resolved Hide resolved
flow/project.py Outdated Show resolved Hide resolved
Copy link
Member

@b-butler b-butler left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@klywang klywang left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@bdice
Copy link
Member Author

bdice commented Dec 5, 2021

I have resolved conflicts with other recently merged PRs (template reference data was updated). @csadorf If you would like to offer a final review, this is ready. Otherwise I think we can merge this PR.

@bdice bdice merged commit 54c47dd into master Dec 29, 2021
@bdice bdice deleted the feature/hooks-core branch December 29, 2021 14:10
@cbkerr cbkerr added this to the v0.18.0 milestone Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hooks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants