private void examineRunningWFISandAssociatedPods(Map<WorkflowInstance, RunState> activeStates,
PodList podList) {
final Map<WorkflowInstance, RunState> runningWorkflowInstances = Maps.filterValues(activeStates, runState ->
runState.state().equals(RUNNING) && runState.data().executionId().isPresent());
final Set<WorkflowInstance> workflowInstancesForPods = podList.getItems().stream()
.map(pod -> pod.getMetadata().getAnnotations())
.filter(Objects::nonNull)
.map(annotations -> annotations.get(STYX_WORKFLOW_INSTANCE_ANNOTATION))
.filter(Objects::nonNull)
.map(WorkflowInstance::parseKey)
.collect(toSet());
runningWorkflowInstances.forEach((workflowInstance, runState) -> {
if (workflowInstancesForPods.contains(workflowInstance)) {
return;
}
final String executionId = runState.data().executionId().get();
final Pod pod = client.pods().withName(executionId).get();
if (pod != null) {
return;
}
stateManager.receiveIgnoreClosed(
Event.runError(workflowInstance, "No pod associated with this instance"), runState.counter());
});
}