Skip to content

Commit

Permalink
Merge fafd673 into a7fc664
Browse files Browse the repository at this point in the history
  • Loading branch information
hamersaw authored Oct 30, 2023
2 parents a7fc664 + fafd673 commit e278412
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
6 changes: 6 additions & 0 deletions flytepropeller/pkg/controller/nodes/task/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ func (t Handler) Handle(ctx context.Context, nCtx interfaces.NodeExecutionContex
}
if pluginTrns.IsPreviouslyObserved() {
logger.Debugf(ctx, "No state change for Task, previously observed same transition. Short circuiting.")
logger.Infof(ctx, "Parallelism now set to [%d].", nCtx.ExecutionContext().IncrementParallelism())

// This is a hack to ensure that we do not re-evaluate the same node again in the same round.
if err := nCtx.NodeStateWriter().PutTaskNodeState(ts); err != nil {
return handler.UnknownTransition, err

Check warning on line 577 in flytepropeller/pkg/controller/nodes/task/handler.go

View check run for this annotation

Codecov / codecov/patch

flytepropeller/pkg/controller/nodes/task/handler.go#L577

Added line #L577 was not covered by tests
}
return pluginTrns.FinalTransition(ctx)
}
}
Expand Down
29 changes: 11 additions & 18 deletions flytepropeller/pkg/controller/nodes/task/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,13 +530,12 @@ func Test_task_Handle_NoCatalog(t *testing.T) {
expectedState fakeplugins.NextPhaseState
}
type want struct {
handlerPhase handler.EPhase
wantErr bool
event bool
eventPhase core.TaskExecution_Phase
skipStateUpdate bool
incrParallel bool
checkpoint bool
handlerPhase handler.EPhase
wantErr bool
event bool
eventPhase core.TaskExecution_Phase
incrParallel bool
checkpoint bool
}
tests := []struct {
name string
Expand Down Expand Up @@ -666,10 +665,9 @@ func Test_task_Handle_NoCatalog(t *testing.T) {
},
},
want{
handlerPhase: handler.EPhaseRunning,
event: false,
skipStateUpdate: true,
incrParallel: true,
handlerPhase: handler.EPhaseRunning,
event: false,
incrParallel: true,
},
},
{
Expand Down Expand Up @@ -738,13 +736,8 @@ func Test_task_Handle_NoCatalog(t *testing.T) {
expectedPhase = pluginCore.PhasePermanentFailure
}
}
if tt.want.skipStateUpdate {
assert.Equal(t, pluginCore.PhaseUndefined, state.s.PluginPhase)
assert.Equal(t, uint32(0), state.s.PluginPhaseVersion)
} else {
assert.Equal(t, expectedPhase.String(), state.s.PluginPhase.String())
assert.Equal(t, tt.args.expectedState.PhaseVersion, state.s.PluginPhaseVersion)
}
assert.Equal(t, expectedPhase.String(), state.s.PluginPhase.String())
assert.Equal(t, tt.args.expectedState.PhaseVersion, state.s.PluginPhaseVersion)
if tt.want.checkpoint {
assert.Equal(t, "s3://sandbox/x/name-n1-1/_flytecheckpoints",
got.Info().GetInfo().TaskNodeInfo.TaskNodeMetadata.CheckpointUri)
Expand Down

0 comments on commit e278412

Please sign in to comment.