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

Move some Rucio utils over to RucioUtils module #11218

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

amaltaro
Copy link
Contributor

Fixes #11217

Status

ready

Description

This PR does not add any new code and/or logic, it simply moves some constants and functions from Services/Rucio to Services/RucioUtils new module.

Is it backward compatible (if not, which system it affects?)

NO (external clients will need to update their import, if needed)

Related PRs

None

External dependencies / deployment changes

None

@amaltaro
Copy link
Contributor Author

@mapellidario @belforte I don't remember if CRAB* services rely on the WMCore/Services/Rucio module, but in case it does, would this change be fine with you?

@belforte
Copy link
Member

thank Alana. Let me check latest code.

@belforte
Copy link
Member

As I thought, we decided to change and use directly Rucio client. Feel free to change. Yeah... I know that initially Eric asked us to use same as WMCore, but in the end we use slightly different things and few enouugh things anyhow and Rucio API is good enough that wrapping it does not gain us anything. No bad feeling.

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 3 tests deleted
    • 1 tests no longer failing
    • 3 tests added
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 16 warnings and errors that must be fixed
    • 21 warnings
    • 76 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 13 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13399/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor Author

Thanks for prompt confirmation, Stefano.

@amaltaro
Copy link
Contributor Author

It just occurred to me that T0 might be using this as well. @germanfgv @jhonatanamado could you please check if you use it in any T0 specific code?

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 3 tests deleted
    • 4 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 17 warnings and errors that must be fixed
    • 21 warnings
    • 76 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 13 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13400/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor Author

test this please

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 3 tests deleted
    • 1 tests no longer failing
    • 4 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 17 warnings and errors that must be fixed
    • 21 warnings
    • 76 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 13 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13401/artifact/artifacts/PullRequestReport.html

# Python 3.6 includes something like this in the random library itself

total = sum(w for c, w in choices)
r = random.uniform(0, total)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think single character variables are discouraged in Python and pylint will complain about it. I don't know how WMCore treat them, but I would like to mention it here during review and this function may need adjustment to fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am actually pushing in a variation of it, dropping the python2 implementation in favor of the python3 random library.

Copy link
Contributor

@vkuznet vkuznet left a comment

Choose a reason for hiding this comment

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

I left couple of minor comments and it is up to you to decide to implement them, otherwise the PR is fine with me.

"""
# NOTE: a more reliable - but more expensive - way to know that would be
# to query `get_rse` and evaluate the rse_type parameter
return rseName.endswith("_Tape")
Copy link
Contributor

Choose a reason for hiding this comment

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

because you use this pattern at least twice and due to above comment I suggest to put rseName.endswith() into separate function which will check the rse name. Its implementation can be as simple as this return statement or more sophisticated as in a NOTE message.

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 1 new failures
    • 3 tests deleted
    • 4 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 15 warnings and errors that must be fixed
    • 21 warnings
    • 71 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 13 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13403/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor Author

Thank you for the prompt review, @vkuznet . You might want to look at the 3rd commit, which has a few changes on the code that you made a comment.
The unit test failure is likely unrelated, but let's see the next test results.

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 1 new failures
    • 3 tests deleted
    • 4 tests added
    • 3 changes in unstable tests
  • Python3 Pylint check: failed
    • 15 warnings and errors that must be fixed
    • 21 warnings
    • 70 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 12 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13404/artifact/artifacts/PullRequestReport.html

@amaltaro
Copy link
Contributor Author

test this please

@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: failed
    • 1 new failures
    • 3 tests deleted
    • 4 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 15 warnings and errors that must be fixed
    • 21 warnings
    • 70 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 12 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13406/artifact/artifacts/PullRequestReport.html

amaltaro added 2 commits July 19, 2022 11:53
fix source docstring

Replace custom weight choice by the random library
added unit test for weightedChoice function

adapt unit test to fail less

Update testWeightedChoice unit test

test pylint
@cmsdmwmbot
Copy link

Jenkins results:

  • Python3 Unit tests: succeeded
    • 3 tests deleted
    • 4 tests added
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 15 warnings and errors that must be fixed
    • 21 warnings
    • 70 comments to review
  • Pylint py3k check: succeeded
  • Pycodestyle check: succeeded
    • 12 comments to review

Details at https://cmssdt.cern.ch/dmwm-jenkins/view/All/job/DMWM-WMCore-PR-test/13407/artifact/artifacts/PullRequestReport.html

@amaltaro amaltaro merged commit 1f332ca into dmwm:master Jul 19, 2022
@amaltaro amaltaro mentioned this pull request Jul 19, 2022
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.

Create a Rucio utils module that does not depend on the python rucio client
4 participants