address code review comments

This commit is contained in:
jdar 2024-09-25 16:20:08 -07:00
parent f2150dd947
commit 9f4630db06
2 changed files with 8 additions and 5 deletions

View File

@ -70,3 +70,7 @@ If a Job Definition is set to having Gated Execution, then all work chunks for a
### Job Instance Completion
A Batch Job Maintenance Service runs every minute to monitor the status of all Job Instances and the Job Instance is transitioned to either `COMPLETED`, `ERRORED` or `FAILED` according to the status of all outstanding work chunks for that job instance. If the job instance is still `IN_PROGRESS` this maintenance service also estimates the time remaining to complete the job.
## Logging
The job instance ID and work chunk ID are both available through the logback MDC and can be accessed using the `%X` specifier in a `logback.xml` file. See [Logging](/docs/appendix/logging.html#logging) for more details about logging in HAPI.

View File

@ -18,6 +18,7 @@ import jakarta.annotation.Nonnull;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import static org.assertj.core.api.Assertions.assertThat;
@ -67,11 +68,9 @@ class WorkChannelMessageHandlerTest extends BaseBatch2Test {
verify(myAppender, atLeastOnce()).doAppend(myLoggingEvent.capture());
myLoggingEvent.getAllValues()
.forEach(event -> {
Set<String> mdcPropertySetKeys = event.getMDCPropertyMap().keySet();
assertThat(mdcPropertySetKeys).containsExactlyInAnyOrder(BatchJobTracingContext.CHUNK_ID, BatchJobTracingContext.INSTANCE_ID);
Collection<String> mdcPropertySetValues = event.getMDCPropertyMap().values();
assertThat(mdcPropertySetValues).containsExactlyInAnyOrder(INSTANCE_ID, CHUNK_ID);
Map<String, String> mdcPropertyMap = event.getMDCPropertyMap();
assertThat(mdcPropertyMap).containsEntry(BatchJobTracingContext.CHUNK_ID, CHUNK_ID);
assertThat(mdcPropertyMap).containsEntry(BatchJobTracingContext.INSTANCE_ID, INSTANCE_ID);
});
}