def test_eligible_resources_with_constraints_limit(self):
     test_df = pandas.DataFrame({
         'EntryName': ['g1', 'g2', 'g3', 'g4', 'g5', 'a1', 'n5', 'a2'],
         'FOM': [0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.05, 0.10]
     })
     fom_plugin = resource_dist_plugins.FOMOrderPlugin(resources)
     # constraint works correctly
     fom_df = fom_plugin.eligible_resources(constraint='FOM < 1',
                                            limit=8).reset_index(drop=True)
     assert (test_df.equals(fom_df))
예제 #2
0
    def test_order_resources(self):
        test_df = pandas.DataFrame({
            'EntryName': [
                'g1', 'g2', 'g3', 'g4', 'g5', 'a1', 'n5', 'n1', 'a2', 'a4',
                'a5', 'n2', 'n3', 'a3', 'n4'
            ],
            'fom':
            [0, 0, 0, 0, 0, 0.01, 0.05, 0.1, 0.1, 0.1, 0.15, 0.3, 1, 1, 2.1]
        })

        fom_plugin = resource_dist_plugins.FOMOrderPlugin(resources)
        assert (test_df.equals(fom_plugin._ordered_resources))
예제 #3
0
    def test_eligible_resources(self):
        test_df = pandas.DataFrame({
            'EntryName': [
                'g1', 'g2', 'g3', 'g4', 'g5', 'a1', 'n5', 'n1', 'a2', 'a4',
                'a5', 'n2', 'n3', 'a3', 'n4'
            ],
            'fom':
            [0, 0, 0, 0, 0, 0.01, 0.05, 0.1, 0.1, 0.1, 0.15, 0.3, 1, 1, 2.1]
        })
        fom_plugin = resource_dist_plugins.FOMOrderPlugin(resources)

        # all resources are returned correctly
        assert (test_df.equals(fom_plugin.eligible_resources()))
 def shortlist_entries(self, foms):
     fom_plugin = resource_dist_plugins.FOMOrderPlugin(foms)
     return fom_plugin.eligible_resources(
         constraint=self.fom_resource_constraint,
         limit=self.fom_resource_limit)