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

Added support to disable the project size feature #3531

Merged
merged 3 commits into from
May 7, 2024

Conversation

abujeda
Copy link
Contributor

@abujeda abujeda commented Apr 25, 2024

This changes disables the project size feature by setting the existing project_size_timeout property to 0

This changes disables the project size feature by setting a new Configuration.project_size_enabled property to false

Fixes #3530

@CSC-swesters
Copy link
Contributor

Thanks for picking up our issue!

I feel like the suggested implementation with setting project_size_timeout: 0 or project_size_timeout: "" is a bit confusing. The background is that timeout(1) on RHEL 8 (timeout (GNU coreutils) 8.30) specifies that:

A duration of 0 disables the associated timeout.

I.e., it means an infinite time. I think it's confusing that setting project_size_timeout to 0 means the exact opposite of what the code I quoted in the issue would suggest:

Open3.capture3('timeout', "#{Configuration.project_size_timeout}s", 'du', '-s', #...

If you want to go down this route anyway, perhaps setting a negative value could make more sense, since it's "illegal" in the timeout(1) program:

$ timeout -1 echo "hello"
timeout: invalid option -- '1'
Try 'timeout --help' for more information.

$ timeout --kill-after=-1 echo "hello"
timeout: invalid time interval ‘-1’
Try 'timeout --help' for more information.

I'd personally prefer a separate configuration option, like calculate_project_size: <boolean>, to avoid complicating the meaning of existing configuration values.

It was also a bit confusing to me that the project_size_enabled check didn't happen in the size method, where the du call would happen.

def size
if Dir.exist? project_dataroot
o, e, s = Open3.capture3('timeout', "#{Configuration.project_size_timeout}s", 'du', '-s', '-b', project_dataroot.to_s)
o.split('/')[0].to_i
end
end

It would be good to have a sanity check there that the parameter actually is a positive floating point number, to guard against future changes.

Let me know what you think!

@abujeda
Copy link
Contributor Author

abujeda commented Apr 26, 2024

Thanks for the review, will make some improvements based on your comments.

@abujeda abujeda force-pushed the project_size_feature_toggle branch 2 times, most recently from 9696770 to 4f61056 Compare April 26, 2024 16:51
@abujeda
Copy link
Contributor Author

abujeda commented Apr 26, 2024

I have made some improvements based on the comments:

  • I added a new boolean variable to Configuration: project_size_enabled to avoid confusion with project_size_timeout
  • The project UI will not make a request for the project size if project_size_enabled is false.
  • The JSON response will no longer get the project size if project_size_enabled is false.
  • There is no need to add this check in the Project.size method.

Regarding the validation of the project_size_timeout, I will leave that to @johrstrom. We can raise a new issue if that requires improvements.

@johrstrom
Copy link
Contributor

k8s tests are broken apparently. I'm fine with the changes, but it appears we need to fix that first.

@abujeda abujeda force-pushed the project_size_feature_toggle branch from 4f61056 to c7bf93d Compare April 26, 2024 21:51
@CSC-swesters
Copy link
Contributor

Thank you! @abujeda

@abujeda
Copy link
Contributor Author

abujeda commented Apr 29, 2024

It seems that some of the Ubuntu and Debian tests are broken now.

@johrstrom johrstrom closed this Apr 30, 2024
@johrstrom johrstrom reopened this Apr 30, 2024
@abujeda
Copy link
Contributor Author

abujeda commented May 6, 2024

Triggered a CI build and all tests are green

Copy link
Contributor

@johrstrom johrstrom left a comment

Choose a reason for hiding this comment

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

Works for me.

@johrstrom johrstrom merged commit 8ed5797 into OSC:master May 7, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make project size calculation optional
4 participants