def main(): # Registering arguments will automatically add their description to the help menu Script.registerArgument("prodID: Production ID") _, args = Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient # get arguments prodID = args[0] prodClient = ProductionClient() res = prodClient.setProductionStatus(prodID, "Stopped") if res["OK"]: DIRAC.gLogger.notice("Production %s successully stopped" % prodID) else: DIRAC.gLogger.error(res["Message"]) DIRAC.exit(-1) DIRAC.exit(0)
def main(): Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient args = Script.getPositionalArgs() if len(args) < 1: Script.showHelp(exitCode=1) # get arguments prodID = args[0] prodClient = ProductionClient() res = prodClient.setProductionStatus(prodID, 'Active') if res['OK']: DIRAC.gLogger.notice('Production %s successully started' % prodID) else: DIRAC.gLogger.error(res['Message']) DIRAC.exit(-1) DIRAC.exit(0)
import DIRAC from DIRAC.Core.Base import Script Script.setUsageMessage('\n'.join([ __doc__.split('\n')[1], 'Usage:', ' %s prodID' % Script.scriptName, 'Arguments:', ' prodID: Production ID' ])) Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient args = Script.getPositionalArgs() if (len(args) != 1): Script.showHelp() # get arguments prodID = args[0] prodClient = ProductionClient() res = prodClient.setProductionStatus(prodID, 'Cleaned') if res['OK']: DIRAC.gLogger.notice('Production %s successully cleaned' % prodID) else: DIRAC.gLogger.error(res['Message']) DIRAC.exit(-1) DIRAC.exit(0)
import DIRAC from DIRAC.Core.Base import Script Script.setUsageMessage('\n'.join([ __doc__.split('\n')[1], 'Usage:', ' %s prodID' % Script.scriptName, 'Arguments:', ' prodID: Production ID (mandatory)' ])) Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient args = Script.getPositionalArgs() if len(args) < 1: Script.showHelp(exitCode=1) # get arguments prodID = args[0] prodClient = ProductionClient() res = prodClient.setProductionStatus(prodID, 'Stopped') if res['OK']: DIRAC.gLogger.notice('Production %s successully stopped' % prodID) else: DIRAC.gLogger.error(res['Message']) DIRAC.exit(-1) DIRAC.exit(0)
import DIRAC from DIRAC.Core.Base import Script Script.setUsageMessage('\n'.join([ __doc__.split('\n')[1], 'Usage:', ' %s prodID' % Script.scriptName, 'Arguments:', ' prodID: Production ID' ])) Script.parseCommandLine() from DIRAC.ProductionSystem.Client.ProductionClient import ProductionClient args = Script.getPositionalArgs() if (len(args) != 1): Script.showHelp() # get arguments prodID = args[0] prodClient = ProductionClient() res = prodClient.setProductionStatus(prodID, 'Active') if res['OK']: DIRAC.gLogger.notice('Production %s successully started' % prodID) else: DIRAC.gLogger.error(res['Message']) DIRAC.exit(-1) DIRAC.exit(0)