-
Notifications
You must be signed in to change notification settings - Fork 37
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
Feature/hooks track operation #739
Conversation
…tzerlab/signac-flow into feature/hooks-TrackOperation
for more information, see https://pre-commit.ci
…tzerlab/signac-flow into feature/hooks-TrackOperation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #739 +/- ##
==========================================
+ Coverage 69.08% 69.41% +0.32%
==========================================
Files 45 48 +3
Lines 4348 4407 +59
Branches 890 1065 +175
==========================================
+ Hits 3004 3059 +55
- Misses 1138 1140 +2
- Partials 206 208 +2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback attached.
flow/hooks/track_operations.py
Outdated
Examples | ||
-------- | ||
The following example will install :class:`~.TrackOperations` at the operation level. | ||
Where the log will be stored in the job document. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is meant here. Is this a complete sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah need to fix.
tests/test_project.py
Outdated
): | ||
assert metadata["stage"] == expected_stage | ||
# When running on MacOS CI a private/ is prepended to job.project.path | ||
# seemingly indeterminetly. If metadata["project"]["path"] is checked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# seemingly indeterminetly. If metadata["project"]["path"] is checked | |
# seemingly indeterminately. If metadata["project"]["path"] is checked |
tests/test_project.py
Outdated
repo, | ||
): | ||
assert metadata["stage"] == expected_stage | ||
# When running on MacOS CI a private/ is prepended to job.project.path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rather surprising behavior. I would encourage finding a way to have deterministic tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this a bit more. I would xfail or skip this test on macOS rather than introduce a lot of workarounds in the testing code.
tests/test_project.py
Outdated
else: | ||
if self.error_on_no_git: | ||
# Should not happen in actual testing, here for developers. | ||
assert False, "Expected gitpython for test." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right. What is "actual testing"? Do you mean CI is "actual testing" but local runs of the test suite are not? It is okay to require that developers have gitpython installed to run the test suite, or you can edit tests requiring gitpython to call pytest.importorskip
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can assume that the git package is present during testing since we skip the tests on the import error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't testing in any case. It is there to ensure we never reach this point. It should be impossible to get here. If that isn't the case there is an error in the test.
Co-authored-by: Bradley Dice <[email protected]>
Co-authored-by: Bradley Dice <[email protected]>
Doesn't use pytest.xfail or skip since only one check fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the tiny errors I found in the documentation, but otherwise it looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last round of suggestions, but approving. Please merge when you're ready, but I don't think I can offer more feedback based on the time I've invested here already.
@b-butler Do you think you will be able to merge this soon? |
Also fix documentation errors. Co-authored-by: Bradley Dice <[email protected]>
Implemented builtin
TrackOperations
hooks.TrackOperations
keeps detailed metadata records about the project directory and operations as a log file, optionally in conjunction withgit
(#637).Description
Added
TrackOperations
utilities tosignac-flow
hooks and added tests. Some of these tests requiregitpython
. We made this an optional dependency for testing since there are no other tests insignac-flow
which requiregitpython
.In the original implementation of
TrackOperations
(#189), operation directives were recorded in the metadata. However, our current implementation ofhooks
takes inoperation
as a string andjob
assignac.job.Job
. Does anyone know how we could access directives in the current implementation of hooks?Motivation and Context
TrackOperations
are a useful way to track the state of your code when a specific job operation is executed.Checklist: