Skip to content

[v7r2 --> v7r3(#5035)] register script arguments#5024

Closed
TaykYoku wants to merge 14 commits into
DIRACGrid:integrationfrom
TaykYoku:v7r2_scriptargs
Closed

[v7r2 --> v7r3(#5035)] register script arguments#5024
TaykYoku wants to merge 14 commits into
DIRACGrid:integrationfrom
TaykYoku:v7r2_scriptargs

Conversation

@TaykYoku

@TaykYoku TaykYoku commented Mar 8, 2021

Copy link
Copy Markdown
Contributor

BEGINRELEASENOTES
As continuation of #4958.
Added the ability to register positional arguments and add it to help message.

Scripts with positional arguments that I didn't touch:

  • src/DIRAC/DataManagementSystem/scripts/dirac_dms_add_file.py
  • src/DIRAC/FrameworkSystem/scripts/dirac_sys_sendmail.py
  • src/DIRAC/Interfaces/scripts/dirac_framework_ping_service.py
  • src/DIRAC/StorageManagementSystem/scripts/dirac_stager_stage_files.py
  • src/DIRAC/TransformationSystem/scripts/dirac_production_runjoblocal.py
  • tests/Jenkins/dirac-proxy-download.py

*All systems affected:
CHANGE: useregisterArgument to register positional arguments for scripts

*Core:
CHANGE: Added the ability to register positional arguments

*Configuration:
CHANGE: Added the ability to register positional arguments

ENDRELEASENOTES

@andresailer andresailer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a cool thing, but it is still optional to use registerArgument, right?

Also pylint spotted some errors

Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
# Check arguments
lenDefinedArgs = len(self.commandArgList)
lenRegistredArgs = len(self.commandArgumentList)
for i in range(lenRegistredArgs):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use enumerate

Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
Comment thread src/DIRAC/Interfaces/scripts/dirac_framework_ping_service.py Outdated
Comment thread src/DIRAC/Interfaces/scripts/dirac_wms_jobs_select_output_search.py Outdated
Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
Comment thread src/DIRAC/ConfigurationSystem/Client/LocalConfiguration.py Outdated
Comment thread src/DIRAC/Core/Base/Script.py
@TaykYoku

TaykYoku commented Mar 9, 2021

Copy link
Copy Markdown
Contributor Author

@andresailer yes, it's optional to use, I added it everywhere to make the scripts more standard.. but if it's a bad idea, I can only leave it as an example script.
..and I'm in a bit of a hurry to do RP, I think I still have to add a test and fix bugs of course.

@TaykYoku TaykYoku changed the title [v7r2] register script arguments [v7r2][WIP] register script arguments Mar 9, 2021
@andresailer

Copy link
Copy Markdown
Contributor

@TaykYoku No, you can leave it in, I just wanted to be sure I understood that this is indeed optional for all the other scripts out there

@TaykYoku TaykYoku changed the title [v7r2][WIP] register script arguments [v7r2] register script arguments Mar 12, 2021
return localCfg.getPositionalArguments()
def registerArgument(description, mandatory=True, acceptedValues=None, default=None):
""" Register a new command line argument

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Point to the registerCmdArg function. Something like (I think)

Suggested change
See :func:`~DIRAC.ConfigurationSystem.Client.LocalConfiguration.LocalConfiguration.registerCmdArg` for the syntax of the ``description`` parameter.

@TaykYoku TaykYoku changed the title [v7r2] register script arguments [v7r2 --> v7r3(#5035)] register script arguments Mar 16, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Mar 17, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Mar 17, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Mar 17, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Mar 17, 2021
@fstagni

fstagni commented Mar 25, 2021

Copy link
Copy Markdown
Contributor

Will be treated separately.

@fstagni fstagni closed this Mar 25, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Jul 10, 2021
TaykYoku added a commit to TaykYoku/DIRAC that referenced this pull request Jul 15, 2021
@TaykYoku TaykYoku deleted the v7r2_scriptargs branch September 6, 2021 13:39
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.

3 participants