Search in sources :

Example 6 with Diagnosis

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

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowRate.

@Test
public void diagnosisNoDataSkewLowRate() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 100, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 10000, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, 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 7 with Diagnosis

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

the class DataSkewDiagnoserTest method diagnosis1DataSkewInstance.

@Test
public void diagnosis1DataSkewInstance() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 5000, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 10000, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(1, result.size());
    Diagnosis diagnoses = result.iterator().next();
    assertEquals(DIAGNOSIS_DATA_SKEW.text(), diagnoses.type());
    assertEquals(1, diagnoses.assignments().size());
    assertEquals("i1", diagnoses.assignments().iterator().next());
// TODO
// assertEquals(1, diagnoses.symptoms().size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 8 with Diagnosis

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

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowBufferSize.

@Test
public void diagnosisNoDataSkewLowBufferSize() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 5000, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 1, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, 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 9 with Diagnosis

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

the class UnderProvisioningDiagnoserTest method validateDiagnosis.

private void validateDiagnosis(Collection<Diagnosis> result) {
    assertEquals(1, result.size());
    Diagnosis diagnoses = result.iterator().next();
    assertEquals(DIAGNOSIS_UNDER_PROVISIONING.text(), diagnoses.type());
    assertEquals(1, diagnoses.assignments().size());
    assertEquals(comp, diagnoses.assignments().iterator().next());
// TODO
// Assert.assertEquals(1, result.getSymptoms().size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis)

Example 10 with Diagnosis

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

the class DataSkewDiagnoserTest method failsIfNoDataSkewSymptom.

@Test
public void failsIfNoDataSkewSymptom() {
    Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), Instant.now(), null);
    Collection<Symptom> symptoms = Collections.singletonList(symptom);
    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)

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