Exemplo n.º 1
0
  def setUp( self ):

    self.mockTransClient = Mock()
    self.mockTransClient.setTaskStatusAndWmsID.return_value = {'OK':True}

    self.WMSClientMock = Mock()
    self.jobMonitoringClient = Mock()
    self.mockReqClient = Mock()

    self.jobMock = Mock()
    self.jobMock2 = Mock()
    mockWF = Mock()
    mockPar = Mock()
    mockWF.findParameter.return_value = mockPar
    mockPar.getValue.return_value = 'MySite'

    self.jobMock2.workflow = mockWF
    self.jobMock2.setDestination.return_value = {'OK':True}
    self.jobMock.workflow.return_value = ''
    self.jobMock.return_value = self.jobMock2

    self.taskBase = TaskBase( transClient = self.mockTransClient )
    self.wfTasks = WorkflowTasks( transClient = self.mockTransClient,
                                  submissionClient = self.WMSClientMock,
                                  jobMonitoringClient = self.jobMonitoringClient,
                                  outputDataModule = "mock",
                                  jobClass = self.jobMock )
    self.requestTasks = RequestTasks( transClient = self.mockTransClient,
                                      requestClient = self.mockReqClient
                                      )
    self.tc = TransformationClient()
    self.transformation = Transformation()

    self.maxDiff = None
Exemplo n.º 2
0
 def _getClients(self):
     """ Here the taskManager becomes a RequestTasks object
 """
     res = TaskManagerAgentBase._getClients(self)
     threadTaskManager = RequestTasks()
     res.update({'TaskManager': threadTaskManager})
     return res
Exemplo n.º 3
0
    def _getClients(self, ownerDN=None, ownerGroup=None):
        """Set the clients for task submission.

    Here the taskManager becomes a RequestTasks object.

    See :func:`DIRAC.TransformationSystem.TaskManagerAgentBase._getClients`.
    """
        res = super(RequestTaskAgent, self)._getClients(ownerDN=ownerDN,
                                                        ownerGroup=ownerGroup)
        threadTaskManager = RequestTasks(ownerDN=ownerDN,
                                         ownerGroup=ownerGroup)
        res.update({'TaskManager': threadTaskManager})
        return res
Exemplo n.º 4
0
    def __init__(self, *args, **kwargs):
        ''' c'tor
    '''
        TaskManagerAgentBase.__init__(self, *args, **kwargs)

        self.taskManager = RequestTasks(transClient=self.transClient)
        self.shifterProxy = 'ProductionManager'
        agentTSTypes = self.am_getOption('TransType', [])
        if agentTSTypes:
            self.transType = agentTSTypes
        else:
            self.transType = Operations().getValue(
                'Transformations/DataManipulation', ['Replication', 'Removal'])
Exemplo n.º 5
0
  def initialize( self ):
    """ Sets defaults """
    
    taskManager = RequestTasks()
    
    TaskManagerAgentBase.initialize( self, taskManager = taskManager )
    self.transType = ['Replication', 'Removal']

    # This sets the Default Proxy to used as that defined under 
    # /Operations/Shifter/ProductionManager
    # the shifterProxy option in the Configuration can be used to change this default.
    self.am_setOption( 'shifterProxy', 'ProductionManager' )

    return S_OK()
Exemplo n.º 6
0
  def setUp(self):
    self.mockTransClient = mock.MagicMock()
    self.mockTransClient.setTaskStatusAndWmsID.return_value = {'OK': True}

    self.mockReqClient = mock.MagicMock()

    self.taskBase = TaskBase(transClient=self.mockTransClient)
    self.pu = PluginUtilities(transClient=self.mockTransClient)

    self.requestTasks = RequestTasks(transClient=self.mockTransClient,
                                     requestClient=self.mockReqClient,
                                     requestValidator=reqValFake)
    self.transformation = Transformation()

    self.maxDiff = None
Exemplo n.º 7
0
    def initialize(self):
        """ Standard initialize method
    """
        res = TaskManagerAgentBase.initialize(self)
        if not res['OK']:
            return res

        # clients
        self.taskManager = RequestTasks(transClient=self.transClient)

        agentTSTypes = self.am_getOption('TransType', [])
        if agentTSTypes:
            self.transType = agentTSTypes
        else:
            self.transType = Operations().getValue(
                'Transformations/DataManipulation', ['Replication', 'Removal'])

        return S_OK()
    def setUp(self):

        self.mockTransClient = MagicMock()
        self.mockTransClient.setTaskStatusAndWmsID.return_value = {'OK': True}

        self.WMSClientMock = MagicMock()
        self.jobMonitoringClient = MagicMock()
        self.mockReqClient = MagicMock()

        self.jobMock = MagicMock()
        self.jobMock2 = MagicMock()
        mockWF = MagicMock()
        mockPar = MagicMock()
        mockWF.findParameter.return_value = mockPar
        mockPar.getValue.return_value = 'MySite'

        self.jobMock2.workflow = mockWF
        self.jobMock2.setDestination.return_value = {'OK': True}
        self.jobMock.workflow.return_value = ''
        self.jobMock.return_value = self.jobMock2

        self.reqValidatorMock = MagicMock()
        self.reqValidatorMock.validate.return_value = {'OK': True}

        self.taskBase = TaskBase(transClient=self.mockTransClient)
        self.pu = PluginUtilities(transClient=self.mockTransClient)
        self.wfTasks = WorkflowTasks(
            transClient=self.mockTransClient,
            submissionClient=self.WMSClientMock,
            jobMonitoringClient=self.jobMonitoringClient,
            outputDataModule="mock")

        self.requestTasks = RequestTasks(transClient=self.mockTransClient,
                                         requestClient=self.mockReqClient,
                                         requestValidator=reqValFake)
        self.tc = TransformationClient()
        self.transformation = Transformation()

        self.maxDiff = None

        gLogger.setLevel('DEBUG')
Exemplo n.º 9
0
    def setUp(self):

        self.mockTransClient = Mock()
        self.mockTransClient.setTaskStatusAndWmsID.return_value = {'OK': True}

        self.WMSClientMock = Mock()
        self.jobMonitoringClient = Mock()
        self.mockRequestClient = Mock()

        self.jobMock = Mock()
        self.jobMock.setDestination.return_value = {'OK': True}

        self.taskBase = TaskBase(transClient=self.mockTransClient)
        self.wfTasks = WorkflowTasks(
            transClient=self.mockTransClient,
            submissionClient=self.WMSClientMock,
            jobMonitoringClient=self.jobMonitoringClient,
            outputDataModule="mock",
            jobClass=self.jobMock)
        self.requestTasks = RequestTasks(transClient=self.mockTransClient,
                                         requestClient=self.mockRequestClient)