Search in sources :

Example 6 with JobMetadataChange

use of org.apache.samza.job.JobMetadataChange in project samza by apache.

the class TestJobCoordinatorMetadataManager method testCheckForMetadataChangesConfigChange.

@Test
public void testCheckForMetadataChangesConfigChange() {
    JobCoordinatorMetadata previousMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
    JobCoordinatorMetadata newMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, NEW_CONFIG_ID, OLD_JOB_MODEL_ID);
    Set<JobMetadataChange> metadataChanges = this.jobCoordinatorMetadataManager.checkForMetadataChanges(newMetadata, previousMetadata);
    assertEquals("Metadata check should indicate new config", ImmutableSet.of(JobMetadataChange.CONFIG), metadataChanges);
    assertEquals("Config changed across application attempts should be 1", 1, this.jobCoordinatorMetadataManager.getMetrics().getConfigChangedAcrossApplicationAttempt().getValue().intValue());
    assertEquals("Application attempt count should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getApplicationAttemptCount().getValue().intValue());
}
Also used : JobCoordinatorMetadata(org.apache.samza.job.JobCoordinatorMetadata) JobMetadataChange(org.apache.samza.job.JobMetadataChange) Test(org.junit.Test)

Example 7 with JobMetadataChange

use of org.apache.samza.job.JobMetadataChange in project samza by apache.

the class TestJobCoordinatorMetadataManager method testCheckForMetadataChangesNoChanges.

@Test
public void testCheckForMetadataChangesNoChanges() {
    JobCoordinatorMetadata previousMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
    JobCoordinatorMetadata newMetadata = new JobCoordinatorMetadata(OLD_EPOCH_ID, OLD_CONFIG_ID, OLD_JOB_MODEL_ID);
    Set<JobMetadataChange> metadataChanges = this.jobCoordinatorMetadataManager.checkForMetadataChanges(newMetadata, previousMetadata);
    assertEquals("Metadata check should indicate no changes", ImmutableSet.of(), metadataChanges);
    assertEquals("New deployment should be 0 since Epoch ID did not change", 0, this.jobCoordinatorMetadataManager.getMetrics().getNewDeployment().getValue().intValue());
    assertEquals("Job model changed across application attempts should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getJobModelChangedAcrossApplicationAttempt().getValue().intValue());
    assertEquals("Config changed across application attempts should be 0", 0, this.jobCoordinatorMetadataManager.getMetrics().getConfigChangedAcrossApplicationAttempt().getValue().intValue());
    assertEquals("Application attempt count should be 1", 1, this.jobCoordinatorMetadataManager.getMetrics().getApplicationAttemptCount().getValue().intValue());
}
Also used : JobCoordinatorMetadata(org.apache.samza.job.JobCoordinatorMetadata) JobMetadataChange(org.apache.samza.job.JobMetadataChange) Test(org.junit.Test)

Aggregations

JobCoordinatorMetadata (org.apache.samza.job.JobCoordinatorMetadata)7 JobMetadataChange (org.apache.samza.job.JobMetadataChange)7 Test (org.junit.Test)6 IOException (java.io.IOException)1 SamzaException (org.apache.samza.SamzaException)1 ConfigException (org.apache.samza.config.ConfigException)1 JobModelMonitors (org.apache.samza.coordinator.JobModelMonitors)1 DiagnosticsManager (org.apache.samza.diagnostics.DiagnosticsManager)1 JobModel (org.apache.samza.job.model.JobModel)1 StartpointManager (org.apache.samza.startpoint.StartpointManager)1