def test_produces(self): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES) produces = dict.fromkeys([ 'Factory_Entries_Grid', 'Factory_Entries_AWS', 'Factory_Entries_GCE', 'Factory_Entries_LCF' ], pandas.DataFrame) assert (entries._produces == produces)
def test_produces(self): entries = factory_entries.FactoryEntries(config_factory_entries) produces = [ 'Factory_Entries_Grid', 'Factory_Entries_AWS', 'Factory_Entries_GCE', 'Factory_Entries_LCF' ] assert(entries.produces() == produces)
def test_produces(self): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES) produces = [ 'Factory_Entries_Grid', 'Factory_Entries_AWS', 'Factory_Entries_GCE', 'Factory_Entries_LCF' ] assert (entries.produces() == produces)
def test_acquire_bad_with_timeout(): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES_BAD_WITH_TIMEOUT) start = time.time() result = entries.acquire() end = time.time() # Set by tuning max_retries and the retry_interval assert end - start > 5 for df in result.values(): assert df.dropna().empty
def test_produces(self): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES) produces = dict.fromkeys( [ "Factory_Entries_Grid", "Factory_Entries_AWS", "Factory_Entries_GCE", "Factory_Entries_LCF" ], pandas.DataFrame, ) assert entries._produces == produces
def test_acquire_correctionmap(): df1 = pd.DataFrame(data={"GLIDEIN_Resource_Slots": ["DummySlots", "DummySlots"]}) df2 = pd.DataFrame(data={"GLIDEIN_CMSSite": ["DummySite", "DummySite"]}) entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES_CORMAP) with mock.patch.object(htcondor_query.CondorStatus, "fetch") as f: f.return_value = utils.input_from_file(FIXTURE_FILE) dummypd = entries.acquire() dummypd2 = dummypd["Factory_Entries_Grid"] assert df1.equals(dummypd2[["GLIDEIN_Resource_Slots"]]) assert df2.equals(dummypd2[["GLIDEIN_CMSSite"]])
def test_acquire_bad(self): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES_BAD) result = entries.acquire() for df in result.values(): assert (df.dropna().empty is True)
def test_acquire_live(self): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES) pprint.pprint(entries.acquire())
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(FIXTURE_FILE) pprint.pprint(entries.acquire())
def test_produces(): entries = factory_entries.FactoryEntries(CONFIG_FACTORY_ENTRIES) produces = {f"Factory_Entries_{entrytype}": pd.DataFrame for entrytype in ["Grid", "AWS", "GCE", "LCF"]} assert entries._produces == produces
def test_acquire_bad(self): entries = factory_entries.FactoryEntries(config_factory_entries_bad) assert(len(entries.acquire()) == 0)
def test_acquire_live(self): entries = factory_entries.FactoryEntries(config_factory_entries) pprint.pprint(entries.acquire())
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())