Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Documentation correction from PR review.
  • Loading branch information
gusmith committed Nov 12, 2019
commit 6a68f18e92478ebf664edd6d24ae97cd99ce45f0
4 changes: 3 additions & 1 deletion backend/entityservice/database/insertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_created_runs_and_queue(db, project_id):
def is_dataprovider_allowed_to_upload_and_lock(db, dp_id):
"""
This method returns true if the dataprovider is allowed to upload her clks.
A data provider is allowed to upload clks if they have not yet been uploaded or if the upload is already in progress.
A dataprovider is not allowed to upload clks if she has already uploaded them, or if the upload is in progress.
This method will lock the resource by setting the upload state to `in_progress` and returning `true`.
Note that the upload state can be `error`, in which case we are allowing the dataprovider to re-try uploading
her clks not to block a project if a failure occurred.
Expand All @@ -282,5 +282,7 @@ def is_dataprovider_allowed_to_upload_and_lock(db, dp_id):
if length < 1:
return False
elif length > 1:
logger.error("{} rows in the table `dataproviders` are associated to the same dataprovider id {}, while each"
" dataprovider id should be unique.".format(length, dp_id))
raise ValueError("Houston, we have a problem!!! This dataprovider can upload multiple times her clks.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

it would be good to write a message to the logger at high severity level as well here.

return True