Search in sources :

Example 11 with Diagnosis

use of com.microsoft.dhalion.core.Diagnosis in project heron by twitter.

the class UnderProvisioningDiagnoserTest method diagnosisFailsNotSimilarQueueSizes.

@Test
public void diagnosisFailsNotSimilarQueueSizes() {
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 12 with Diagnosis

use of com.microsoft.dhalion.core.Diagnosis in project heron by twitter.

the class UnderProvisioningDiagnoserTest method diagnosisWhen1Of1InstanceInBP.

@Test
public void diagnosisWhen1Of1InstanceInBP() {
    Collection<String> assign = Collections.singleton(comp);
    Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Collection<Symptom> symptoms = Collections.singletonList(symptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    validateDiagnosis(result);
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 13 with Diagnosis

use of com.microsoft.dhalion.core.Diagnosis in project heron by twitter.

the class UnderProvisioningDiagnoserTest method diagnosisFailsNotSimilarProcessingRates.

@Test
public void diagnosisFailsNotSimilarProcessingRates() {
    // TODO BP instance should be same as the one with high processing rate
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 14 with Diagnosis

use of com.microsoft.dhalion.core.Diagnosis in project heron by twitter.

the class SlowInstanceDiagnoserTest method failIfInstanceWithBpHasSmallBuffer.

@Test
public void failIfInstanceWithBpHasSmallBuffer() {
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Symptom exeDisparitySymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, qDisparitySymptom, exeDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 15 with Diagnosis

use of com.microsoft.dhalion.core.Diagnosis in project heron by twitter.

the class ScaleUpResolverTest method testResolve.

@Test
public void testResolve() {
    TopologyAPI.Topology topology = createTestTopology();
    Config config = createConfig(topology);
    PackingPlan currentPlan = createPacking(topology, config);
    PackingPlanProvider packingPlanProvider = mock(PackingPlanProvider.class);
    when(packingPlanProvider.get()).thenReturn(currentPlan);
    ISchedulerClient scheduler = mock(ISchedulerClient.class);
    when(scheduler.updateTopology(any(UpdateTopologyRequest.class))).thenReturn(true);
    Instant now = Instant.now();
    Collections.singletonList(new Measurement("bolt", "i1", METRIC_BACK_PRESSURE.text(), now, 123));
    List<String> assignments = Collections.singletonList("bolt");
    Diagnosis diagnoses = new Diagnosis(DIAGNOSIS_UNDER_PROVISIONING.text(), now, assignments, null);
    List<Diagnosis> diagnosis = Collections.singletonList(diagnoses);
    ExecutionContext context = mock(ExecutionContext.class);
    when(context.checkpoint()).thenReturn(now);
    ScaleUpResolver resolver = new ScaleUpResolver(null, packingPlanProvider, scheduler, eventManager, null);
    resolver.initialize(context);
    ScaleUpResolver spyResolver = spy(resolver);
    doReturn(2).when(spyResolver).computeScaleUpFactor("bolt");
    doReturn(currentPlan).when(spyResolver).buildNewPackingPlan(any(HashMap.class), eq(currentPlan));
    Collection<Action> result = spyResolver.resolve(diagnosis);
    verify(scheduler, times(1)).updateTopology(any(UpdateTopologyRequest.class));
    assertEquals(1, result.size());
}
Also used : Measurement(com.microsoft.dhalion.core.Measurement) Action(com.microsoft.dhalion.core.Action) HashMap(java.util.HashMap) Config(org.apache.heron.spi.common.Config) PackingPlan(org.apache.heron.spi.packing.PackingPlan) Instant(java.time.Instant) PackingPlanProvider(org.apache.heron.healthmgr.common.PackingPlanProvider) TopologyAPI(org.apache.heron.api.generated.TopologyAPI) UpdateTopologyRequest(org.apache.heron.proto.scheduler.Scheduler.UpdateTopologyRequest) ExecutionContext(com.microsoft.dhalion.policy.PoliciesExecutor.ExecutionContext) ISchedulerClient(org.apache.heron.scheduler.client.ISchedulerClient) Diagnosis(com.microsoft.dhalion.core.Diagnosis) Test(org.junit.Test)

Aggregations

Diagnosis (com.microsoft.dhalion.core.Diagnosis)16 Test (org.junit.Test)11 Symptom (com.microsoft.dhalion.core.Symptom)10 ArrayList (java.util.ArrayList)4 SymptomsTable (com.microsoft.dhalion.core.SymptomsTable)3 Instant (java.time.Instant)3 Action (com.microsoft.dhalion.core.Action)2 MeasurementsTable (com.microsoft.dhalion.core.MeasurementsTable)2 HashMap (java.util.HashMap)2 PackingPlan (org.apache.heron.spi.packing.PackingPlan)2 DiagnosisTable (com.microsoft.dhalion.core.DiagnosisTable)1 Measurement (com.microsoft.dhalion.core.Measurement)1 ExecutionContext (com.microsoft.dhalion.policy.PoliciesExecutor.ExecutionContext)1 TopologyAPI (org.apache.heron.api.generated.TopologyAPI)1 TopologyUpdate (org.apache.heron.healthmgr.common.HealthManagerEvents.TopologyUpdate)1 PackingPlanProvider (org.apache.heron.healthmgr.common.PackingPlanProvider)1 Scheduler (org.apache.heron.proto.scheduler.Scheduler)1 UpdateTopologyRequest (org.apache.heron.proto.scheduler.Scheduler.UpdateTopologyRequest)1 ISchedulerClient (org.apache.heron.scheduler.client.ISchedulerClient)1 Config (org.apache.heron.spi.common.Config)1