Skip to content

Log file created by default for uploads and downloads #740

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

Merged

Conversation

i-oden
Copy link
Member

@i-oden i-oden commented Mar 27, 2025

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

People rarely use the --log-file option. Previously the default was that there was always a log file generated, but we were logging a lot, which resulted in the users (mainly the units) generating a huge amount of logs which were quite big. However, we have now reduced the logging a bit.

Every time there's a support ticket, we usually end up having to ask the user to run the command again, which takes both time and energy for us, but also of course means that we cannot immediately investigate what the issue is and often have to wait for the user to try again.

This PR adds a flag --force-no-log which the user can use if they really do not want to generate a log file. If this flag is not used, the dds by default saves all logs to a file with the format: _.log. The user can also use the --log-file option to specify their own path to the log file, as usual.

The code needed some refactoring before being able to do this, and at first I made this PR: #737
However, while that did technically work when it comes to generating the actual log file as I wanted it to, it did not actually log things to the file. In order to make it work I needed to have it in the __main__.py module. There is a slight bit of code duplication since I need to add code to the dds data get and dds data put commands.

I probably need to look at adding tests as well, but will look at that next week.

2. Jira task / GitHub issue

HMS-2292

3. Type of change - Add label

What type of change(s) does the PR contain? For an explanation of the different options below, enter edit mode of this PR description template.

If you do not want this change to be included in release notes, add the label skip-changelog.

  • New feature
    • Breaking --> label: breaking
    • Non-breaking --> label: feature
  • Database change --> label: feature or none at all.
    Remember the to include a new migration version, or explain here why it's not needed.
  • Bug fix --> label: bug
  • Security Alert fix
    • Package update --> label: dependency
      • Major version update
  • Documentation --> label can be skipped, will be included in "other changes"
  • Workflow --> label: skip-changelog
  • Tests only --> label: skip-changelog

4. Additional information

5. Actions / Scans

Make sure that the following checks/actions have passed.

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

If an action does not pass and you need help with how to solve it, enter edit mode of this PR template or go to the PR template.

@i-oden i-oden added the type: feature For release template label Mar 28, 2025
@i-oden i-oden marked this pull request as ready for review March 28, 2025 12:27
@i-oden i-oden requested a review from a team as a code owner March 28, 2025 12:27
@i-oden
Copy link
Member Author

i-oden commented Mar 28, 2025

P.s. I will rename this PR before we merge it, I just want to keep track of which one is the working one and which one I made first etc.

@i-oden i-oden changed the title WORKS -- Log file created by default for uploads and downloads Log file created by default for uploads and downloads Apr 9, 2025
@i-oden
Copy link
Member Author

i-oden commented Apr 9, 2025

@ScilifelabDataCentre/teamhermes Review this when you have a chance

@i-oden i-oden requested review from valyo and rv0lt April 24, 2025 07:18
@rv0lt
Copy link
Member

rv0lt commented Apr 25, 2025

Maybe the only detail that I see. Is that when there is an error, the message asks to check for the JSON log and not this new one; example:

Please verify that the following error log has been generated: /code/DataDelivery_2025-04-25_08-49-38_project_1_upload/logs/dds_failed_delivery.json

@i-oden
Copy link
Member Author

i-oden commented Apr 25, 2025

Maybe the only detail that I see. Is that when there is an error, the message asks to check for the JSON log and not this new one; example:

Please verify that the following error log has been generated: /code/DataDelivery_2025-04-25_08-49-38_project_1_upload/logs/dds_failed_delivery.json

Good point!

@i-oden
Copy link
Member Author

i-oden commented Apr 25, 2025

@rv0lt I added the same info to the download message

@i-oden i-oden merged commit 7f6f308 into dev Apr 25, 2025
18 checks passed
@i-oden i-oden deleted the HMS-2292-should-we-reintroduce-the-log-file-option-as-default-copy branch April 25, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature For release template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants