def registerUsageMessage(): """ Takes the script __doc__ and adds the DIRAC version to it """ usageMessage = " DIRAC %s\n" % version usageMessage += __doc__ Script.setUsageMessage(usageMessage)
""" Do the initial configuration of a DIRAC component """ from __future__ import print_function from __future__ import absolute_import from __future__ import division __RCSID__ = "$Id$" from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage("\n".join([ __doc__.split("\n")[1], "Usage:", " %s [options] ... ComponentType System Component|System/Component" % Script.scriptName, "Arguments:", " ComponentType: Name of the ComponentType (ie: agent)", " System: Name of the DIRAC system (ie: WorkloadManagement)", " component: Name of the DIRAC component (ie: JobCleaningAgent)", ])) Script.parseCommandLine() args = Script.getPositionalArgs() componentType = args[0] if len(args) == 2: system, component = args[1].split("/") else: system = args[1] component = args[2]
#!/usr/bin/env python """ update local cfg """ from __future__ import print_function from __future__ import absolute_import from __future__ import division import os from diraccfg import CFG from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage("\n".join( [__doc__.split("\n")[1], "Usage:", " %s [options]" % Script.scriptName])) Script.registerSwitch("F:", "file=", "set the cfg file to update.") Script.registerSwitch("V:", "vo=", "set the VO.") Script.registerSwitch("S:", "setup=", "set the software dist module to update.") Script.registerSwitch("D:", "softwareDistModule=", "set the software dist module to update.") Script.parseCommandLine() args = Script.getPositionalArgs() from DIRAC import gConfig cFile = ""
#!/usr/bin/env python """ Drop DBs from the MySQL server """ from __future__ import print_function from __future__ import absolute_import from __future__ import division from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage("\n".join([ __doc__.split("\n")[1], "Usage:", " %s [options] ... DB ..." % Script.scriptName, "Arguments:", " DB: Name of the Database (mandatory)", ])) Script.parseCommandLine() args = Script.getPositionalArgs() if len(args) < 1: Script.showHelp(exitCode=1) from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller gComponentInstaller.getMySQLPasswords() for db in args: print(gComponentInstaller.execMySQL("DROP DATABASE IF EXISTS %s" % db))
# pylint: disable=invalid-name,wrong-import-position from __future__ import print_function from __future__ import absolute_import from __future__ import division import unittest import sys import os import tempfile import shutil from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage(""" Test a full DMS workflow against a StorageElement \t%s <SE name> <PluginLists> \t<SE name>: mandatory \t<plugins>: comma separated list of plugin to test (defautl all) """ % Script.scriptName) Script.parseCommandLine() # [SEName, <plugins>] posArgs = Script.getPositionalArgs() if not posArgs: Script.showHelp(exitCode=1) from DIRAC import gLogger from DIRAC.Core.Utilities.Adler import fileAdler from DIRAC.Core.Utilities.File import getSize from DIRAC.Resources.Storage.StorageElement import StorageElement
""" from __future__ import print_function from __future__ import absolute_import from __future__ import division __RCSID__ = "$Id$" from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script from DIRAC import S_OK import sys import pprint import os import numpy Script.setUsageMessage(""" Test suite for a generic File Catalog scalability tests """) testType = "noTest" def setTestType(value): global testType testType = value return S_OK() testDir = "" def setTestDirectory(value):
#!/usr/bin/env python """ Get a proxy from the proxy manager """ from __future__ import print_function from __future__ import absolute_import from __future__ import division import os from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage("\n".join([ __doc__.split("\n")[1], "Usage:", " %s [options] UserName Role" % Script.scriptName, "Arguments:", " UserName: User DN", ])) Script.registerSwitch("R:", "role=", "set the User DN.") Script.parseCommandLine() for unprocSw in Script.getUnprocessedSwitches(): if unprocSw[0] in ("R", "role"): role = unprocSw[1] args = Script.getPositionalArgs() dn = args[0] uid = os.getuid() from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager print("Getting proxy for User DN: %s, User role %s" % (dn, role))
""" This script submits a test prodJobuction with filter """ # pylint: disable=wrong-import-position, protected-access from __future__ import print_function from __future__ import absolute_import from __future__ import division import time import os import json from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script Script.setUsageMessage("\n".join([ __doc__.split("\n")[1], "Usage:", " %s test directory" % Script.scriptName ])) Script.registerSwitch("", "UseFilter=", "e.g. True/False") Script.parseCommandLine() from DIRAC import gLogger from DIRAC.Interfaces.API.Job import Job from DIRAC.TransformationSystem.Client.Transformation import Transformation # Needed to test transformations with Filters from DIRAC.Resources.Catalog.FileCatalog import FileCatalog from DIRAC.DataManagementSystem.Client.DataManager import DataManager # Parse the arguments args = Script.getPositionalArgs()