def main(): # Registering arguments will automatically add their description to the help menu Script.registerArgument(["transID: transformation ID"]) _, args = Script.parseCommandLine() transIDs = [int(arg) for arg in args] from DIRAC.TransformationSystem.Agent.TransformationCleaningAgent import TransformationCleaningAgent agent = TransformationCleaningAgent( "Transformation/TransformationCleaningAgent", "Transformation/TransformationCleaningAgent", "dirac-transformation-archive", ) agent.initialize() for transID in transIDs: agent.archiveTransformation(transID)
def main(): Script.parseCommandLine() args = Script.getPositionalArgs() if not args: Script.showHelp() transIDs = [int(arg) for arg in args] from DIRAC.TransformationSystem.Agent.TransformationCleaningAgent import TransformationCleaningAgent from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient agent = TransformationCleaningAgent( 'Transformation/TransformationCleaningAgent', 'Transformation/TransformationCleaningAgent', 'dirac-transformation-archive') agent.initialize() client = TransformationClient() for transID in transIDs: agent.archiveTransformation(transID)
#!/usr/bin/env python """ Archive a transformation """ from __future__ import print_function import sys from DIRAC.Core.Base.Script import parseCommandLine, getPositionalArgs parseCommandLine() if not getPositionalArgs(): print('Usage: dirac-transformation-archive transID [transID] [transID]') sys.exit() else: transIDs = [int(arg) for arg in getPositionalArgs()] from DIRAC.TransformationSystem.Agent.TransformationCleaningAgent import TransformationCleaningAgent from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient agent = TransformationCleaningAgent('Transformation/TransformationCleaningAgent', 'Transformation/TransformationCleaningAgent', 'dirac-transformation-archive') agent.initialize() client = TransformationClient() for transID in transIDs: agent.archiveTransformation(transID)
__RCSID__ = "$Id$" import sys if len( sys.argv ) < 2: print 'Usage: dirac-transformation-archive transID [transID] [transID]' sys.exit() else: transIDs = [int( arg ) for arg in sys.argv[1:]] from DIRAC.TransformationSystem.Agent.TransformationCleaningAgent import TransformationCleaningAgent from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient from DIRAC import gLogger import DIRAC agent = TransformationCleaningAgent( 'Transformation/TransformationCleaningAgent', 'dirac-transformation-archive' ) agent.initialize() client = TransformationClient() for transID in transIDs: res = client.getTransformationParameters( transID, ['Status'] ) if not res['OK']: gLogger.error( "Failed to determine transformation status" ) gLogger.error( res['Message'] ) continue status = res['Value'] if not status in ['Completed']: gLogger.error( "The transformation is in %s status and can not be archived" % status ) continue agent.archiveTransformation( transID )