コード例 #1
0
    def testListReplicationRules(self):
        """
        Test the listReplicationRules function, which fetches the container
        rules a return a list of RSEs key'ed by the container name.
        """
        self.rucioToken, self.tokenValidity = getRucioToken(
            self.rucioAuthUrl, self.rucioAccount)
        resp = listReplicationRules([],
                                    self.rucioAccount,
                                    grouping="A",
                                    rucioUrl=self.rucioUrl,
                                    rucioToken=self.rucioToken,
                                    scope=self.rucioScope)
        self.assertEqual(resp, {})

        with self.assertRaises(RuntimeError):
            listReplicationRules(["blah"],
                                 self.rucioAccount,
                                 grouping="Not valid!!!",
                                 rucioUrl=self.rucioUrl,
                                 rucioToken=self.rucioToken,
                                 scope=self.rucioScope)

        containers = [CONT2, CONT3, self.badDID]
        resp = listReplicationRules(containers,
                                    self.rucioAccount,
                                    grouping="A",
                                    rucioUrl=self.rucioUrl,
                                    rucioToken=self.rucioToken,
                                    scope=self.rucioScope)
        self.assertTrue(len(resp) == 3)
        self.assertTrue(CONT2 in resp)
        self.assertTrue(isinstance(resp[CONT3], list))
        self.assertEqual(resp[self.badDID], [])
コード例 #2
0
 def setUp(self):
     "initialization"
     self.rucioUrl = "http://cmsrucio-int.cern.ch"
     self.rucioAuthUrl = "https://cmsrucio-auth-int.cern.ch"
     self.rucioAccount = "wma_test"
     self.rucioScope = "cms"
     self.rucioToken, self.tokenValidity = getRucioToken(
         self.rucioAuthUrl, self.rucioAccount)
     self.badDID = "/wrong/did/name"
コード例 #3
0
ファイル: RequestInfo.py プロジェクト: haozturk/WMCore
    def setupRucio(self):
        """
        Check whether Rucio is enabled and create a new token, or renew it if needed
        """
        if not self.tokenValidity:
            # a brand new token needs to be created. To be done in the coming lines...
            pass
        elif self.tokenValidity:
            # then check the token lifetime
            dateTimeNow = int(datetime.datetime.utcnow().strftime("%s"))
            timeDiff = self.tokenValidity - dateTimeNow
            if timeDiff > 30 * 60: # 30min
                # current token still valid for a while
                return

        self.rucioToken, self.tokenValidity = getRucioToken(self.msConfig['rucioAuthUrl'],
                                                            self.msConfig['rucioAccount'])
コード例 #4
0
ファイル: PycurlRucio_t.py プロジェクト: todor-ivanov/WMCore
 def testGetBlocksAndSizeRucio(self):
     """
     Test the getBlocksAndSizeRucio function, which fetches all the blocks
     (in a container) and their sizes.
     """
     self.rucioToken, self.tokenValidity = getRucioToken(self.rucioAuthUrl, self.rucioAccount)
     # Test 1: no DIDs provided as input
     resp = getBlocksAndSizeRucio([], self.rucioUrl, self.rucioToken, self.rucioScope)
     self.assertEqual(resp, {})
     # Test 2: multiple valid/invalid DIDs provided as input
     containers = [PU_CONT, CONT3, self.badDID]
     resp = getBlocksAndSizeRucio(containers, self.rucioUrl, self.rucioToken, self.rucioScope)
     self.assertTrue(len(resp) == 3)
     self.assertTrue(resp[PU_CONT][PU_CONT_BLK]['blockSize'] > 0)
     self.assertTrue(isinstance(resp[PU_CONT][PU_CONT_BLK]['locations'], list))
     self.assertTrue(len(resp[CONT3]) > 0)
     self.assertIsNone(resp[self.badDID])
コード例 #5
0
ファイル: PycurlRucio_t.py プロジェクト: todor-ivanov/WMCore
    def testGetPileupContainerSizesRucio(self):
        """
        Test the getPileupContainerSizesRucio function, which fetches the container
        total bytes.
        """
        self.rucioToken, self.tokenValidity = getRucioToken(self.rucioAuthUrl, self.rucioAccount)
        # Test 1: no DIDs provided as input
        resp = getPileupContainerSizesRucio([], self.rucioUrl,
                                            self.rucioToken, scope=self.rucioScope)
        self.assertEqual(resp, {})

        # Test 2: multiple valid/invalid DIDs provided as input
        containers = [CONT1, PU_CONT, self.badDID]
        resp = getPileupContainerSizesRucio(containers, self.rucioUrl,
                                            self.rucioToken, scope=self.rucioScope)
        self.assertTrue(len(resp) == 3)
        self.assertTrue(resp[PU_CONT] > 0)
        self.assertIsNone(resp[self.badDID])
コード例 #6
0
    def testGetBlocksAndSizeRucio(self):
        """
        Test the getBlocksAndSizeRucio function, which fetches all the blocks
        (in a container) and their sizes.
        """
        self.rucioToken, self.tokenValidity = getRucioToken(
            self.rucioAuthUrl, self.rucioAccount)
        BLOCK = "/DMSimp_MonoZLL_NLO_Vector_TuneCP3_GQ0p25_GDM1p0_MY1-500_MXd-1/RunIIFall17NanoAODv4-PU2017_12Apr2018_Nano14Dec2018_102X_mc2017_realistic_v6-v1/NANOAODSIM#048c25e9-38bb-496d-86f7-405ffd3d3fd8"
        resp = getBlocksAndSizeRucio([], self.rucioUrl, self.rucioToken,
                                     self.rucioScope)
        self.assertEqual(resp, {})

        containers = [CONT2, CONT4, self.badDID]
        resp = getBlocksAndSizeRucio(containers, self.rucioUrl,
                                     self.rucioToken, self.rucioScope)
        self.assertTrue(len(resp) == 3)
        self.assertTrue(CONT2 in resp)
        self.assertTrue(len(resp[CONT4]) > 3)
        self.assertItemsEqual(list(resp[CONT4][BLOCK]),
                              ["blockSize", "locations"])
        self.assertIsNone(resp[self.badDID])
コード例 #7
0
    def testGetPileupContainerSizesRucio(self):
        """
        Test the getPileupContainerSizesRucio function, which fetches the container
        total bytes.
        """
        self.rucioToken, self.tokenValidity = getRucioToken(
            self.rucioAuthUrl, self.rucioAccount)
        resp = getPileupContainerSizesRucio([],
                                            self.rucioUrl,
                                            self.rucioToken,
                                            scope=self.rucioScope)
        self.assertEqual(resp, {})

        containers = [CONT1, CONT2, self.badDID]
        resp = getPileupContainerSizesRucio(containers,
                                            self.rucioUrl,
                                            self.rucioToken,
                                            scope=self.rucioScope)
        self.assertTrue(len(resp) == 3)
        self.assertTrue(CONT2 in resp)
        self.assertTrue(resp[CONT1] > 0)
        self.assertIsNone(resp[self.badDID])