コード例 #1
0
    def test_acquire(self):
        nersc_job_info = NerscJobInfo.NerscJobInfo(config)

        with mock.patch.object(newt.Newt, 'get_status') as get_status:
            get_status.return_value = utils.input_from_file(
                'newt_status.cs.fixture')
            with mock.patch.object(newt.Newt, 'get_queue') as get_queue:
                get_queue.return_value = utils.input_from_file(
                    'newt_jobs.cs.fixture')
                res = nersc_job_info.acquire()
                assert produces == res.keys()
                assert expected_pandas_dframe.equals(res[produces[0]])
コード例 #2
0
 def test_acquire(self):
     gce_resource_limits = GCEResourceLimits.GCEResourceLimits(config)
     with mock.patch.object(SourceProxy.SourceProxy, 'acquire') as factory_data:
         factory_entries = utils.input_from_file('gce_limits_factory_entries.test')
         factory_data.return_value = {'Factory_Entries_GCE': pandas.DataFrame(factory_entries)}
         gce_limits = gce_resource_limits.acquire()
         assert produces == gce_limits.keys()
         assert config.get("entry_limit_attrs").sort() == list(gce_limits.get(produces[0])).sort()
コード例 #3
0
 def test_acquire(self):
     nersc_allocations = NerscAllocationInfo.NerscAllocationInfo(config)
     with mock.patch.object(newt.Newt, 'get_usage') as f:
         f.return_value = utils.input_from_file(
             'newt_allocations.cs.fixture')
         res = nersc_allocations.acquire()
         assert produces == res.keys()
         assert expected_pandas_dframe.equals(res[produces[0]])
コード例 #4
0
    def test_condorstatus(self):
        condor_status = htcondor_query.CondorStatus(
            subsystem_name='any', pool_name=config_cs.get('pool_name'))

        with mock.patch.object(htcondor_query.CondorStatus, 'fetch') as f:
            f.return_value = utils.input_from_file('cs.fixture')
            condor_status.load()
            #pprint.pprint(condor_status.stored_data)
            pprint.pprint('Fetched %s resource classads' %
                          len(condor_status.stored_data))
コード例 #5
0
    def test_condorq(self):

        condor_q = htcondor_query.CondorQ(
            schedd_name=config_cq.get('schedd_name'),
            pool_name=config_cq.get('pool_name'))

        with mock.patch.object(htcondor_query.CondorQ, 'fetch') as f:
            f.return_value = utils.input_from_file('cq.fixture')
            condor_q.load()
            pprint.pprint('Fetched %s job classads' %
                          len(condor_q.stored_data))
 def test_acquire(self):
     with mock.patch.object(SourceProxy.SourceProxy, "__init__", lambda x, y: None):
         aws_s_p = AWSSpotPrice.AWSSpotPrice(config)
         with mock.patch.object(SourceProxy.SourceProxy, 'acquire') as acquire:
             acquire.return_value = account
             with mock.patch.object(boto3.session, 'Session') as s:
                 s.return_value = SessionMock()
                 with mock.patch.object(AWSSpotPrice.AWSSpotPriceForRegion, 'get_price') as get_price:
                     sp_d = utils.input_from_file('spot_price.fixture')
                     get_price.return_value = sp_d
                     res = aws_s_p.acquire()
                     assert produces == res.keys()
                     new_df = fix_spot_price(res[produces[0]])
                     assert utils.compare_dfs(expected_pandas_df, new_df)
 def test_acquire(self):
     with mock.patch.object(SourceProxy.SourceProxy, "__init__",
                            lambda x, y: None):
         aws_occ = Occupancy.AWSOccupancy(config)
         with mock.patch.object(SourceProxy.SourceProxy,
                                'acquire') as acquire:
             acquire.return_value = account
             with mock.patch.object(boto3.session, 'Session') as s:
                 s.return_value = SessionMock()
                 with mock.patch.object(
                         Occupancy.OccupancyForRegion,
                         'get_ec2_instances') as get_instances:
                     cap = utils.input_from_file('occupancy.fixture')
                     get_instances.return_value = cap
                     res = aws_occ.acquire()
                     assert produces == res.keys()
                     df1 = expected_pandas_df.sort_values(
                         ['AvailabilityZone', 'InstanceType'])
                     new_df = res.get(produces[0]).sort_values(
                         ['AvailabilityZone', 'InstanceType'])
                     new_df.reindex()
                     assert utils.compare_dfs(df1, new_df)
コード例 #8
0
 def test_acquire(self):
     fc = factory_client.FactoryClientManifests(config)
     with mock.patch.object(htcondor_query.CondorStatus, 'fetch') as f:
         f.return_value = utils.input_from_file('factory_client.cs.fixture')
         pprint.pprint(fc.acquire())
コード例 #9
0
 def test_acquire(self):
     s = slots.StartdManifests(config_cs)
     with mock.patch.object(htcondor_query.CondorStatus, 'fetch') as f:
         f.return_value = utils.input_from_file('cs.fixture')
         pprint.pprint(s.acquire())
コード例 #10
0
 def test_acquire(self):
     entries = factory_entries.FactoryEntries(config_factory_entries)
     with mock.patch.object(htcondor_query.CondorStatus, 'fetch') as f:
         f.return_value = utils.input_from_file('factory_entries.cs.fixture')
         pprint.pprint(entries.acquire())
コード例 #11
0
 def test_condorq(self):
     jq = job_q.JobQ(config_cq)
     with mock.patch.object(htcondor_query.CondorQ, 'fetch') as f:
         f.return_value = utils.input_from_file('cq.fixture')
         pprint.pprint(jq.acquire())