Skip to content

DOESN'T WORK -- Log file created by default for uploads and downloads #737

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

Draft
wants to merge 40 commits into
base: dev
Choose a base branch
from

Conversation

i-oden
Copy link
Member

@i-oden i-oden commented Mar 5, 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.

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: <command>_<current time>.log. The user can also use the --log-file option to specify their own path to the log file, as usual.

This PR also creates a directory in home called dds-cli_logs where the automatic default logs will be stored. I could technically have used the generated DDS directory which is always created when uploads and downloads are started but this meant more code changes in more files, and made everything less maintainable.

2. Jira task / GitHub issue

Is this a GitHub issue? --> Add the link to the github issue

Is this from a Jira task? --> If your branch does not contain info regarding the Jira task ID, put it here.

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 5, 2025
@i-oden i-oden self-assigned this Mar 5, 2025
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 22.64151% with 41 lines in your changes missing coverage. Please review.

Project coverage is 47.53%. Comparing base (9860477) to head (065577c).

Files with missing lines Patch % Lines
dds_cli/directory.py 23.80% 16 Missing ⚠️
dds_cli/__main__.py 33.33% 8 Missing ⚠️
dds_cli/data_putter.py 12.50% 7 Missing ⚠️
dds_cli/data_getter.py 0.00% 6 Missing ⚠️
dds_cli/utils.py 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #737      +/-   ##
==========================================
- Coverage   47.88%   47.53%   -0.36%     
==========================================
  Files          31       31              
  Lines        2890     2920      +30     
==========================================
+ Hits         1384     1388       +4     
- Misses       1506     1532      +26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@i-oden i-oden marked this pull request as ready for review March 6, 2025 14:20
@i-oden i-oden requested a review from a team as a code owner March 6, 2025 14:20
@i-oden
Copy link
Member Author

i-oden commented Mar 6, 2025

Note: I did try to use a custom Click class which would handle the if force_no_log and log_file check, but I didn't get it to work. I also made several attemps with the Cloup package to make the options mutually exclusive but it seems like I may have needed to completely replace Click with Cloup which is not something I want to do, so I went for this snippet instead.

@i-oden
Copy link
Member Author

i-oden commented Mar 6, 2025

Re: Tests.
I have not added tests to this here. We have not yet added tests for the actual click commands because of some difficulty that I can't remember now, but I'm going to leave this as is as well.

@rv0lt
Copy link
Member

rv0lt commented Mar 6, 2025

Quick review but in the client container it's giving me this error:

FileNotFoundError: [Errno 2] No such file or directory: '/root/dds-cli_logs/dds_data_put_s_tests/_p_project_1_20250306-174108.log'

@rv0lt
Copy link
Member

rv0lt commented Mar 6, 2025

I know what it is, if you specify a folder to upload files, it is translated as a subdirectory, such as

dds data put -s tests/ -p project_1 --overwrite

The / in tests/ will get converted

Quick review but in the client container it's giving me this error:

FileNotFoundError: [Errno 2] No such file or directory: '/root/dds-cli_logs/dds_data_put_s_tests/_p_project_1_20250306-174108.log'

@i-oden
Copy link
Member Author

i-oden commented Mar 7, 2025

@valyo To review as well

If something to change -- you guys fix it

When ok --> merge and make release.

Remember to inform the units about the change.

@valyo
Copy link
Member

valyo commented Mar 12, 2025

Team decided to wait for Ina to come back in order to implement the log file being saved in the staging directory's logs directory

@i-oden i-oden marked this pull request as draft March 25, 2025 09:59
@i-oden i-oden changed the title Log file created by default for uploads and downloads DOESN'T WORK -- Log file created by default for uploads and downloads Mar 27, 2025
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