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-1681: Retry database insert if failed files after upload #656

Merged
merged 100 commits into from
Nov 2, 2023

Conversation

valyo
Copy link
Member

@valyo valyo commented Sep 26, 2023

Before submitting this PR

  1. Description: Adds functionality to 'data_putter' for attempting to update (in DB) files that failed to be added to BD during upload
  2. Jira task / GitHub issue: DDS-1681
  3. How to test: Can be tested with DDS-1680: AddFailedFiles endpoint to insert files if failed dds_web#1472 and by commenting out the lines 481-497, and uncommenting line 498 in 'data_putter'
  4. Type of change: Check the relevant boxes in the section below
  5. Add docstrings and comments to code, even if you personally think it's obvious.

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

  • New feature
    • Breaking: will not work without the new API endpoint
    • Non-breaking
  • Bug fix
    • Breaking: Please describe the reason for the break and how we can fix it.
    • Non-breaking
  • Security Alert fix
  • Documentation
  • Tests (only)
  • Workflow

Checklist

  • Sprintlog
    • Added
    • Not needed (E.g. PR contains only tests)
  • Rebase / Update / Merge from base branch (the branch from which the current is forked)
    • Done
    • Not needed
  • Blocking PRs
    • Merged
    • No blocking PRs
  • PR to master branch

Actions / Scans

  • Black: Python code formatter. Does not execute. Only tests.
    Run black . locally to execute formatting.
    • Passed
  • Pylint: Python code linter. Does not execute. Only tests.
    Fix code producing warnings. Code must get 10/10.
    • Warnings fixed
    • Passed
  • Prettier: General code formatter. Our use case: MD and yaml mainly.
    Run npx prettier --write . locally to execute formatting.
    • Passed
  • Yamllint: Linting of yaml files.
    • Passed
  • Tests: Pytest to verify that functionality works as expected.
    • New tests added
    • No new tests
    • Passed
  • TestPyPi: Build CLI and publish to TestPyPi in order to verify before release.
    • Passed
  • CodeQL: Scan for security vulnerabilities, bugs, errors
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed
  • Trivy: Security scanner
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed
  • Snyk: Security scanner
    • New alerts: Go through them and either fix, dismiss och ignore. Add reasoning in items below.
    • Alerts fixed: What?
    • Alerts ignored / dismissed: Why?
    • Passed

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #656 (b0664f6) into dev (1e1cf80) will decrease coverage by 0.52%.
The diff coverage is 9.67%.

@@            Coverage Diff             @@
##              dev     #656      +/-   ##
==========================================
- Coverage   48.17%   47.66%   -0.52%     
==========================================
  Files          31       31              
  Lines        2856     2887      +31     
==========================================
  Hits         1376     1376              
- Misses       1480     1511      +31     
Files Coverage Δ
dds_cli/__init__.py 91.86% <100.00%> (+0.09%) ⬆️
dds_cli/data_putter.py 19.63% <6.66%> (-2.93%) ⬇️

... and 1 file with indirect coverage changes

@valyo
Copy link
Member Author

valyo commented Sep 28, 2023

Test fail because the code making a request to NEW_FILE in add_file_db is commented out, for the purpose of simulating failed request.
For the moment the files that added to DB in this extra step are still present in the failed_delivery_log. Perhaps we should remove them, which will probably require a new function, not sure where.

valyo and others added 3 commits October 12, 2023 14:31
Co-authored-by: Ina Odén Österbo <[email protected]>
Co-authored-by: Ina Odén Österbo <[email protected]>
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/__init__.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Outdated Show resolved Hide resolved
dds_cli/data_putter.py Show resolved Hide resolved
@i-oden i-oden marked this pull request as draft October 31, 2023 09:00
@i-oden i-oden changed the title DDs 1681 handle failed delivery log DDS 1681: Retry database insert if failed files after upload Oct 31, 2023
@i-oden i-oden changed the title DDS 1681: Retry database insert if failed files after upload DDS-1681: Retry database insert if failed files after upload Oct 31, 2023
@i-oden
Copy link
Member

i-oden commented Oct 31, 2023

I'll work on the tests, but can be reviewed without them for now since I'm not working tomorrow.

@i-oden i-oden marked this pull request as ready for review October 31, 2023 13:17
@i-oden i-oden requested a review from rv0lt October 31, 2023 13:18
@i-oden i-oden self-requested a review November 2, 2023 12:55
@i-oden i-oden requested a review from rv0lt November 2, 2023 12:58
@i-oden i-oden merged commit da7a2bd into dev Nov 2, 2023
18 checks passed
@i-oden i-oden deleted the DDS-1681-handle-failed_delivery_log branch November 2, 2023 13:54
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