Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Add error event when pod is missing #35

Merged
merged 1 commit into from
Dec 23, 2016

Conversation

TinaRanic
Copy link
Contributor

I might remove the isntanceStates() method on StateManager. I liked using instanceState directly, but we can derive it from the activeStates().

@rouz @jocke @fdema

abstract static class InstanceState {
abstract WorkflowInstance workflowInstance();
abstract RunState runState();
public abstract static class InstanceState {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer keeping this private.

In KubernetesDockerRunner, you can get the WorkflowInstance from the RunState, no need to spread this class across different component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah true, I commented on the PR itself it was unnecessary job

activeWorkflowInstances.parallelStream()
.forEach(workflowInstance -> stateManager.receiveIgnoreClosed(
Event.runError(workflowInstance, "No pod associated with this instance")));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is not that time sensitive and I think the collections that are worked on are pretty small that the paralellStream use is unnecessary. It might actually be more overhead to dispatch on the fork-join-pool rather than just iterating sequentially.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point


kdr.pollPods();

verify(stateManager, never()).receiveIgnoreClosed(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like we don't depend on something like SyncStateManager 👍

@TinaRanic TinaRanic force-pushed the send-errorevent-missing-pod branch from 012bfe7 to bf4d1dc Compare December 22, 2016 15:08
@@ -190,9 +194,32 @@ public void init() {
.watch(new PodWatcher(Integer.parseInt(resourceVersion)));
}

private void pollPods() {
void examineRunningWFISandAssociatedPods(PodList podList) {
final Set<WorkflowInstance> activeWorkflowInstances = stateManager.activeStates().entrySet()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since RunState includes the WorkflowInstance, we can just use .values() followed by something like:

.filter(runState -> !runState.equals(RUNNING))
.map(RunState::workflowInstance) 

@@ -71,6 +75,13 @@ public void receive(Event event) {
}

@Override
public Set<Scheduler.InstanceState> instanceStates() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed anymore.

@TinaRanic TinaRanic force-pushed the send-errorevent-missing-pod branch 2 times, most recently from c134c3d to 10e0423 Compare December 22, 2016 15:37
@fabriziodemaria
Copy link
Member

@ranic can we add a test that involves an active state that is not in RUNNING state?

@TinaRanic TinaRanic force-pushed the send-errorevent-missing-pod branch from 10e0423 to 1c6207e Compare December 22, 2016 17:51

kdr.pollPods();

verify(stateManager, times(1)).receiveIgnoreClosed(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a verify for WORKFLOW_INSTANCE to check that that was never called?

Copy link
Contributor Author

@TinaRanic TinaRanic Dec 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't like to reverify something that there is already a unit test for - shouldNotSendRunErrorWhenPodForRunningWFIExists. I don't see value added in improving test coverage.

@fabriziodemaria
Copy link
Member

👍

@fabriziodemaria fabriziodemaria merged commit 5773912 into master Dec 23, 2016
@fabriziodemaria fabriziodemaria deleted the send-errorevent-missing-pod branch December 23, 2016 09:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants