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

DDS-1680: AddFailedFiles endpoint to insert files if failed #1472

Merged
merged 89 commits into from
Nov 2, 2023

Conversation

valyo
Copy link
Member

@valyo valyo commented Sep 26, 2023

Read this before submitting the PR

  1. Always create a Draft PR first
  2. Go through sections 1-5 below, fill them in and check all the boxes
  3. Make sure that the branch is updated; if there's an "Update branch" button at the bottom of the PR, rebase or update branch.
  4. When all boxes are checked, information is filled in, and the branch is updated: mark as Ready For Review and tag reviewers (top right)
  5. Once there is a submitted review, implement the suggestions (if reasonable, otherwise discuss) and request an new review.

If there is a field which you are unsure about, enter the edit mode of this description or go to the PR template; There are invisible comments providing descriptions which may be of help.

1. Description / Summary

On data upload, it can happen that some files uploaded to S3 are not added to the DB (due to failed API request or DB lock). In such cases, DDS CLI creates a log file containing the failed files, which is supposed to be passed to the update-uploaded-file flask command for adding the files in the DB. This change creates an endpoint for updating the failed files upon a request from DDS CLI.

Tested manually in the following way:

  • In data_putter.py, def put, line 376 (in the try-except block), I added:
            if "requirements-test" in file_local:
                raise FileNotFoundError
  • In data_putter.py, def add_file_db, line 431 (in the try-except block), I added:
            if "test_account_manager.py" in str(file_info["name"]):
                raise dds_cli.exceptions.DDSCLIException(message="Failed to add file to db")
  • Then I ran dds data put -p [project] -s tests
    • Without --overwrite
    • With --overwrite

2. Jira task / GitHub issue

DDS-1529

3. Type of change

What type of change(s) does the PR contain?

Check the relevant boxes below. For an explanation of the different sections, enter edit mode of this PR description template.

  • New feature
    • Breaking: Why / How? Add info here.
    • Non-breaking Works with #656
  • Database change: Remember the to include a new migration version, or explain here why it's not needed.
  • Bug fix
  • Security Alert fix
  • Documentation
  • Workflow
  • Tests only

4. Additional information

5. Actions / Scans

Check the boxes when the specified checks have passed.

For information on what the different checks do and how to fix it if they're failing, enter edit mode of this description or go to the PR template.

  • Black
  • Prettier
  • Yamllint
  • Tests
  • CodeQL
  • Trivy
  • Snyk

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #1472 (9f67d66) into dev (f32c284) will increase coverage by 0.85%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev    #1472      +/-   ##
==========================================
+ Coverage   90.32%   91.17%   +0.85%     
==========================================
  Files          29       29              
  Lines        4484     4542      +58     
==========================================
+ Hits         4050     4141      +91     
+ Misses        434      401      -33     
Files Coverage Δ
dds_web/api/__init__.py 100.00% <100.00%> (ø)
dds_web/api/files.py 83.75% <100.00%> (+0.47%) ⬆️
dds_web/commands.py 85.62% <100.00%> (+5.35%) ⬆️
dds_web/utils.py 94.65% <100.00%> (+2.04%) ⬆️

@i-oden i-oden marked this pull request as draft October 31, 2023 08:30
tests/test_utils.py Outdated Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
@i-oden i-oden changed the title Add AddFailedFiles endpoint DDS-1680: AddFailedFiles endpoint to insert files if failed Oct 31, 2023
@i-oden i-oden marked this pull request as ready for review October 31, 2023 13:17
@i-oden i-oden requested review from rv0lt and removed request for rv0lt October 31, 2023 13:18
dds_web/utils.py Outdated Show resolved Hide resolved
Copy link
Member

@rv0lt rv0lt left a comment

Choose a reason for hiding this comment

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

The only comment I see is the Garbage collector thing :)

dds_web/utils.py Outdated Show resolved Hide resolved
@i-oden i-oden requested a review from rv0lt November 2, 2023 11:53
@i-oden i-oden self-assigned this Nov 2, 2023
@i-oden i-oden self-requested a review November 2, 2023 12:56
@i-oden i-oden merged commit 90614a2 into dev Nov 2, 2023
14 checks passed
@i-oden i-oden deleted the DDS-1680-endpoint-for-failed-add-to-db-files branch November 2, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants