-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create SCCS workflow #77
Conversation
Why these changes are being introduced: * Support deposits requested by Scholarly Communications and Collections Strategy (SCCS). How this addresses that need: * Create SCCS workflow and metadata mapping JSON file * Move DemoWorkflow metadata mapping JSON file * Change Workflow.email_recipients to list[str] * Clean up Workflow and SimpleCSV fixtures Side effects of this change: * None Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/IN-1098
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.
Looks great and the organizational changes are excellent!
@@ -35,7 +35,7 @@ def __init__( | |||
self, | |||
collection_handle: str, | |||
batch_id: str, | |||
email_recipients: tuple[str, ...], | |||
email_recipients: list[str], |
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.
If the linting is passing then I guess this is all good!
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.
Left a couple of comments and questions, but approved regardless of answers!
from dsc.workflows import SimpleCSV | ||
|
||
|
||
class SCCS(SimpleCSV): |
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.
When looking at a class this minimal, a couple of thoughts come to mind:
- Nice work on class design and inheritance! Clearly much is shared between workflows.
- What functionality / opinionation, if anything, could this workflow-specific class still provide?
For # 2, the first thing that comes to mind is validation or hooks of some kind. I don't think it's necessary now, but wondering if there might be room in the future for some kind of registration of validation hooks, that could be used to validate items created? reconciliation logic? maybe others? In theory, these could be called -- if defined -- during the normal flow of the base Workflows.
Sketch:
class MyWorkflow(SimpleCSV):
workflow_name = "Mine!"
metadata_mapping_path = "path/to/mapping.json"
# defined as class attributes, lists pointing to methods
reconciliation_hooks = [] # I don't have any reconciliation hooks...
item_creation_hooks = [
"confirm_title_elements" # reference to method defined on class
]
@classmethod
def confirm_title_elements(cls):
# I will check things yielded by Workflow.item_submissions_iter()...
pass
With a little bit of wiring, this might provide a way for a Workflow
class to have some additional validation (or even functional) logic applied to the base flows.
This pattern could also probably be achieved through decorators, which could be even cleaner.
Sketch:
class MyWorkflow(SimpleCSV):
workflow_name = "Mine!"
metadata_mapping_path = "path/to/mapping.json"
@item_creation_hook
def confirm_title_elements(cls):
# I will check things yielded by Workflow.item_submissions_iter()...
pass
# maybe others like @reconciliation_hook
* Make 'delimiter' and 'language' optional configs * Omit null and empty string configs from metadata mapping JSON files
Pull Request Test Coverage Report for Build 12797479564Details
💛 - Coveralls |
Purpose and background context
This PR creates the
SCCS
DSC workflow. Implementation of theSCCS
workflow was amazingly simple as it inherits from theSimpleCSV
base workflow and only required assigning values for theworkflow_name
andmetadata_mapping_path
class attributes. This also introduces a new folder indsc/workflows
to hold metadata mapping JSON files.demo.json
(formerlydemo_metadata_mapping.json
) was moved from thetests/fixtures
folder.sccs.json
is an updated version of the metadata mapping JSON file fromdspace-api-python-scripts
This PR also includes additional changes for cleanup:
DemoWorkflow
->Demo
email_recipients
tolist[str]
Note: @ehanson8 ,
mypy
may have been throwing an error previously if it was assigned an empty list ([]
) (a "mutable default") in the__init__
signature. 🤔TestWorkflow
andTestSimpleCSV
fixturesemail_recipients
andoutput_queue
when creating instances (i.e.,base_workflow_instance
andsimple_csv_workflow_instance
fixtures)How can a reviewer manually see the effects of these changes?
Run
make lint
andmake test
and verify all unit tests are passing.@ehanson8 and I synced up to discuss testing and whether new unit tests were required for the creation of the
SCCS
workflow. In summary:test_<workflow>.py
module should only be created to test functionality of overridden methods."required": true
is missing.Includes new or updated dependencies?
NO
Changes expectations for external applications?
NO
What are the relevant tickets?
Developer
Code Reviewer(s)