Skip to content

Add rucio client instances to wmagent-component-standalone #12318

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

todor-ivanov
Copy link
Contributor

Fixes #11855

Status

ready

Description

During our training session I noticed that in the upstream version of the wmagent-component-standalone script the rucio client instances (both the upstream Rucio client and the WMCore wrapper) were missing.

With the current PR we are adding the line for creating those instances at script execution. The rucio configuration is taken from the RucioInjector component configuration from the actual wmagent.config for the agent (at the environment referred by the variable $WMA_CONFIG_FILE).

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

YES

Related PRs

None

External dependencies / deployment changes

None

@todor-ivanov
Copy link
Contributor Author

We can now close the training issue as usual - with a PR.

@dmwm-bot
Copy link

dmwm-bot commented Apr 2, 2025

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 21 warnings and errors that must be fixed
    • 26 comments to review
  • Pycodestyle check: succeeded
    • 22 comments to review

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

@@ -15,18 +15,25 @@ wmagent-component-standalone -c $WMA_CONFIG_FILE -p JobAccountant -e $WMA_ENV_FI

import os
import sys
sys.dont_write_bytecode = True
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I see reason for this introduction, can you elaborate more why you add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the current setup for the cmst1 user at our agents, we have two options enabled by default for any ipython session. And those options are:
% load_ext
% autoreload 2

Which basically tells the interpreter to always reload the source code whenever the inmemory object is referred in an interactive session. This gives the power of editing the source code and immediately registering the change of state in the interactive session, without the need to restart wmagent-component-standalone.

While debugging this mechanism recently I found, due to some extra complications on how the class definitions are imported and object instances created at runtime, we may have more than one place for module searchpath wen the module is loaded into the python global scope during the interactive session. One being the source and the other being the module's byte code cached (the .pyc file). This is just a precaution that we do not create the byte code files when we execute this script.

The mechanism is still sub-optimal because the so enabled % autoreload module for ipython works for any imports that has happened during the interactive session itself, and fails for anything that was preloaded at sys.modules during startup. There is still some details we can polish to make it fully work, tough.

Anyway, that's the real reason behind setting this flag right after importing sys.

Copy link
Contributor

Choose a reason for hiding this comment

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

Todor, thanks for explanation, I strongly suggest that you add this (shorter) description as docstring before this line to explain this reason. We will forget about it in a future but it would be extremely useful to anyone who may comeback to this code to understand this reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@todor-ivanov todor-ivanov requested a review from vkuznet April 2, 2025 11:37
@todor-ivanov todor-ivanov force-pushed the feature_TrainingDebugWithVenv_fix-11855 branch from 1aaacb8 to de6e6ae Compare April 2, 2025 12:59
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from WMCore.Configuration import loadConfigurationFile
from WMCore.ResourceControl.ResourceControl import ResourceControl
from WMCore.Services.CRIC.CRIC import CRIC
Copy link
Contributor

Choose a reason for hiding this comment

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

this is added but not used in this PR, do you need it?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is also reported as a pylint issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, we need to create an instance of the cric service to suppress this pylint warning. And that was the idea of having those imported in advance. let me check the proper way of doing this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

and done

@dmwm-bot
Copy link

dmwm-bot commented Apr 2, 2025

Jenkins results:

  • Python3 Unit tests: succeeded
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 21 warnings and errors that must be fixed
    • 26 comments to review
  • Pycodestyle check: succeeded
    • 22 comments to review

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

Add requested comment

Crate a cric instance
@todor-ivanov todor-ivanov force-pushed the feature_TrainingDebugWithVenv_fix-11855 branch from de6e6ae to 730487c Compare April 3, 2025 12:37
@dmwm-bot
Copy link

dmwm-bot commented Apr 3, 2025

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 changes in unstable tests
  • Python3 Pylint check: failed
    • 20 warnings and errors that must be fixed
    • 26 comments to review
  • Pycodestyle check: succeeded
    • 22 comments to review

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

Copy link
Member

@mapellidario mapellidario left a comment

Choose a reason for hiding this comment

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

looks good to me, thanks todor!

@dmwm-bot
Copy link

dmwm-bot commented Apr 4, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 1 new failures
    • 1 tests no longer failing
    • 4 changes in unstable tests
  • Python3 Pylint check: failed
    • 4 warnings and errors that must be fixed
    • 25 comments to review
  • Pycodestyle check: succeeded
    • 20 comments to review

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

@anpicci
Copy link
Contributor

anpicci commented Apr 4, 2025

test this please

@dmwm-bot
Copy link

dmwm-bot commented Apr 4, 2025

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 2 changes in unstable tests
  • Python3 Pylint check: failed
    • 4 warnings and errors that must be fixed
    • 25 comments to review
  • Pycodestyle check: succeeded
    • 20 comments to review

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

@dmwm-bot
Copy link

dmwm-bot commented Apr 4, 2025

Jenkins results:

  • Python3 Unit tests: failed
    • 1 new failures
    • 1 tests no longer failing
    • 4 changes in unstable tests
  • Python3 Pylint check: failed
    • 3 warnings and errors that must be fixed
    • 25 comments to review
  • Pycodestyle check: succeeded
    • 20 comments to review

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

@anpicci
Copy link
Contributor

anpicci commented Apr 4, 2025

test this please

1 similar comment
@anpicci
Copy link
Contributor

anpicci commented Apr 4, 2025

test this please

@anpicci anpicci merged commit ce29996 into dmwm:master Apr 4, 2025
0 of 3 checks passed
@dmwm-bot
Copy link

dmwm-bot commented Apr 4, 2025

Jenkins results:

  • Python3 Unit tests: succeeded
    • 1 tests no longer failing
    • 4 changes in unstable tests
  • Python3 Pylint check: succeeded
  • Pycodestyle check: succeeded

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

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.

Training: Deploy and use a WMAgent with a virtual environment
5 participants