-
Notifications
You must be signed in to change notification settings - Fork 12
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
Update groups metadata #51
Conversation
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.
Nice, some minor fixes and we're 💯 and
asclepias_broker/admin.py
Outdated
update_metadata_form = UpdateMetadataForm() | ||
message = None | ||
if update_metadata_form.validate_on_submit(): | ||
dir_path = request.form['dir_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.
The issue with this is that the path that is passed might not be available on the server (this is especially true for e.g. OpenShift applications which are just running in a docker container), unless it's some kind of network mount which would always be there consistently.
What would rather make sense is uploading a zip/tar, though this might complicate things a bit for this admin view.
I would say let's create an issue for the Admin-UI where we can keep track of this and other useful views we can add in the future.
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.
You're right, I didn't think about it!
I created an issue here: #53
asclepias_broker/cli.py
Outdated
EventAPI.handle_event(event, no_index=True, delayed=False) | ||
except ValueError: | ||
pass | ||
update_group_metadata(identifiers[0], data.get('Object')) |
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 think you have to do a db.session.commit()
at the end of this function to seal the deal (this might also be the reason why the single-payload-update you mentioned didn't work).
@@ -64,6 +65,80 @@ def off_test_simple_id_group_merge(db): | |||
assert Identifier2Group.query.count() == 5 | |||
|
|||
|
|||
def test_update_groups(db): |
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 test might be a better fit for test_metadata.py
(or test_cli.py
). We'll have to restructure tests in general though, so let's make an issue instead.
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 created this issue: #52
fb19d25
to
aa5a335
Compare
asclepias_broker/api/ingestion.py
Outdated
@@ -452,3 +452,11 @@ def update_metadata(relationship: Relationship, payload): | |||
rel_metadata.update( | |||
{k: v for k, v in payload.items() | |||
if k in ('LinkPublicationDate', 'LinkProvider')}) | |||
|
|||
|
|||
def update_group_metadata(identifier, payload): |
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's better to use simple/primitive values as parameters to functions, and in this case identifiers
is a dictionary with a specific format, which means that you would have to document it.
Maybe it's better to have something like def update_group_metadata(id_value, id_scheme, payload):
No description provided.