Beispiel #1
0
  def test_setRequest(self):

    requestString = self.getTestRequestString()
    requestType = 'transfer'
    requestStatus = 'waiting'
    result = self.requestDB.setRequest(requestType,self.requestName,requestStatus,requestString)
    self.assert_(result['OK'])
    result = self.requestDB.getRequest('transfer')
    self.assert_(result['OK'])
    request = DataManagementRequest(request=result['Value']['RequestString'])
    res = request.getNumSubRequests(requestType)
    for ind in range (res['Value']):
      res = request.getSubRequestFiles(ind,requestType)
      files = res['Value']
      for file in files:
        file['Status'] = 'Done'
      res = request.setSubRequestFiles(ind, type, files)
    res = request.toXML()
    requestString = res['Value']
    result = self.requestDB.updateRequest(self.requestName, requestString)
    self.assert_(result['OK'])
    requestStatus = 'done'
    result = self.requestDB.setRequestStatus(requestType,self.requestName,requestStatus)
    #there is some transient error here where it fails to retrieve the requestID
    self.assert_( result['OK'])
    result = self.requestDB.deleteRequest(self.requestName)
    self.assert_(result['OK'])
Beispiel #2
0
    def test_setRequest(self):

        requestString = self.getTestRequestString()
        requestType = 'transfer'
        requestStatus = 'waiting'
        result = self.requestDB.setRequest(requestType, self.requestName,
                                           requestStatus, requestString)
        self.assert_(result['OK'])
        result = self.requestDB.getRequest('transfer')
        self.assert_(result['OK'])
        request = DataManagementRequest(
            request=result['Value']['RequestString'])
        res = request.getNumSubRequests(requestType)
        for ind in range(res['Value']):
            res = request.getSubRequestFiles(ind, requestType)
            files = res['Value']
            for file in files:
                file['Status'] = 'Done'
            res = request.setSubRequestFiles(ind, type, files)
        res = request.toXML()
        requestString = res['Value']
        result = self.requestDB.updateRequest(self.requestName, requestString)
        self.assert_(result['OK'])
        requestStatus = 'done'
        result = self.requestDB.setRequestStatus(requestType, self.requestName,
                                                 requestStatus)
        #there is some transient error here where it fails to retrieve the requestID
        self.assert_(result['OK'])
        result = self.requestDB.deleteRequest(self.requestName)
        self.assert_(result['OK'])
Beispiel #3
0
    def test_fullChain(self):

        ##########################################################
        # This is the section to be done by the data manager or whoever

        # Create the DataManagementRequest
        dmRequest = DataManagementRequest()
        requestID = 9999999
        dmRequest.setRequestID(requestID)
        requestType = 'transfer'
        res = dmRequest.initiateSubRequest(requestType)
        ind = res['Value']
        subRequestDict = {
            'Operation': 'Replicate',
            'SourceSE': 'CERN-disk',
            'TargetSE': 'SARA-SRM2',
            'Catalogue': 'LFC',
            'Status': 'Waiting',
            'SubRequestID': 0,
            'SpaceToken': 'LHCb_RAW'
        }
        res = dmRequest.setSubRequestAttributes(ind, requestType,
                                                subRequestDict)
        lfn = '/lhcb/production/DC06/phys-v2-lumi5/00001925/DST/0000/00001925_00000090_5.dst'
        files = []
        fileDict = {
            'FileID': 9999,
            'LFN': lfn,
            'Size': 10000,
            'PFN': '',
            'GUID': '',
            'Md5': '',
            'Addler': '',
            'Attempt': 0,
            'Status': 'Waiting'
        }
        files.append(fileDict)
        res = dmRequest.setSubRequestFiles(ind, requestType, files)
        requestName = 'test-Request-%s' % time.time()
        dmRequest.setRequestName(requestName)
        jobID = 0
        dmRequest.setJobID(jobID)
        ownerDN = '/C=Country/O=Organisation/OU=Unit/L=Location/CN=Name'
        dmRequest.setOwnerDN(ownerDN)
        diracInstance = 'developement'
        dmRequest.setDiracInstance(diracInstance)
        res = dmRequest.toXML()
        requestString = res['Value']
        print requestString
        # Insert the request in the request DB
        res = self.RequestDB.setRequest(requestType, requestName, 'Dummy',
                                        requestString)
        print res, 'RequestDB.setRequest()'
        self.assert_(res['OK'])
        self.assertEqual(type(res['Value']), types.IntType)
        requestID = res['Value']
        """
Beispiel #4
0
    def test_fullChain(self):

        ##########################################################
        # This is the section to be done by the data manager or whoever

        # Create the DataManagementRequest
        dmRequest = DataManagementRequest()
        requestID = 9999999
        dmRequest.setRequestID(requestID)
        requestType = "transfer"
        res = dmRequest.initiateSubRequest(requestType)
        ind = res["Value"]
        subRequestDict = {
            "Operation": "Replicate",
            "SourceSE": "CERN-disk",
            "TargetSE": "SARA-SRM2",
            "Catalogue": "LFC",
            "Status": "Waiting",
            "SubRequestID": 0,
            "SpaceToken": "LHCb_RAW",
        }
        res = dmRequest.setSubRequestAttributes(ind, requestType, subRequestDict)
        lfn = "/lhcb/production/DC06/phys-v2-lumi5/00001925/DST/0000/00001925_00000090_5.dst"
        files = []
        fileDict = {
            "FileID": 9999,
            "LFN": lfn,
            "Size": 10000,
            "PFN": "",
            "GUID": "",
            "Md5": "",
            "Addler": "",
            "Attempt": 0,
            "Status": "Waiting",
        }
        files.append(fileDict)
        res = dmRequest.setSubRequestFiles(ind, requestType, files)
        requestName = "test-Request-%s" % time.time()
        dmRequest.setRequestName(requestName)
        jobID = 0
        dmRequest.setJobID(jobID)
        ownerDN = "/C=Country/O=Organisation/OU=Unit/L=Location/CN=Name"
        dmRequest.setOwnerDN(ownerDN)
        diracInstance = "developement"
        dmRequest.setDiracInstance(diracInstance)
        res = dmRequest.toXML()
        requestString = res["Value"]
        print requestString
        # Insert the request in the request DB
        res = self.RequestDB.setRequest(requestType, requestName, "Dummy", requestString)
        print res, "RequestDB.setRequest()"
        self.assert_(res["OK"])
        self.assertEqual(type(res["Value"]), types.IntType)
        requestID = res["Value"]

        """
Beispiel #5
0
  def test_fullChain(self):


    ##########################################################
    # This is the section to be done by the data manager or whoever

    # Create the DataManagementRequest
    dmRequest = DataManagementRequest()
    requestID = 9999999
    dmRequest.setRequestID(requestID)
    requestType = 'transfer'
    res = dmRequest.initiateSubRequest(requestType)
    ind = res['Value']
    subRequestDict = {'Operation':'Replicate','SourceSE':'CERN-disk','TargetSE':'SARA-SRM2','Catalogue':'LFC','Status':'Waiting','SubRequestID':0,'SpaceToken':'LHCb_RAW'}
    res = dmRequest.setSubRequestAttributes(ind,requestType,subRequestDict)
    lfn = '/lhcb/production/DC06/phys-v2-lumi5/00001925/DST/0000/00001925_00000090_5.dst'
    files = []
    fileDict = {'FileID':9999,'LFN':lfn,'Size':10000,'PFN':'','GUID':'','Md5':'','Addler':'','Attempt':0,'Status':'Waiting'}
    files.append(fileDict)
    res = dmRequest.setSubRequestFiles(ind,requestType,files)
    requestName = 'test-Request-%s' % time.time()
    dmRequest.setRequestName(requestName)
    jobID = 0
    dmRequest.setJobID(jobID)
    ownerDN = '/C=Country/O=Organisation/OU=Unit/L=Location/CN=Name'
    dmRequest.setOwnerDN(ownerDN)
    diracInstance = 'developement'
    dmRequest.setDiracInstance(diracInstance)
    res = dmRequest.toXML()
    requestString = res['Value']
    print requestString
    # Insert the request in the request DB
    res = self.RequestDB.setRequest(requestType,requestName,'Dummy',requestString)
    print res,'RequestDB.setRequest()'
    self.assert_(res['OK'])
    self.assertEqual(type(res['Value']),types.IntType)
    requestID = res['Value']

    """