Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Cache dynamic workflow #254

Merged
merged 22 commits into from
Apr 28, 2021
Merged

Cache dynamic workflow #254

merged 22 commits into from
Apr 28, 2021

Conversation

katrogan
Copy link
Contributor

@katrogan katrogan commented Apr 13, 2021

TL;DR

Cache dynamic workflow. Verified the cache is read during execution.

Also sends workflow spec to admin

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

How did you fix the bug, make the feature etc. Link to any design docs etc

Tracking Issue

flyteorg/flyte#899
flyteorg/flyteconsole#295
flyteorg/flyte#928

Follow-up issue

NA

Signed-off-by: Katrina Rogan <[email protected]>
@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #254 (d1ab1bf) into master (eaf0849) will decrease coverage by 0.19%.
The diff coverage is 42.72%.

Signed-off-by: Katrina Rogan <[email protected]>
@katrogan katrogan changed the title wip - Cache dynamic workflow Cache dynamic workflow Apr 13, 2021
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
}
return dynamicWorkflowContext{
isDynamic: true,
subWorkflow: compiledWf,
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we set subWorkflowClosure here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't cache that though, right? (if i'm understanding correctly)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we send the dynamic workflow spec only the first time? or on every event (that will be too much)?
If it's only needed the first time, then I guess that's alright...

Copy link
Contributor Author

@katrogan katrogan Apr 15, 2021

Choose a reason for hiding this comment

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

Yeah we only send the spec the first time (when it's uncached) and don't need to bog down subsequent messages

@@ -329,4 +333,88 @@ func Test_dynamicNodeHandler_buildContextualDynamicWorkflow_withLaunchPlans(t *t
assert.Error(t, err)
assert.True(t, callsAdmin)
})
t.Run("dynamic wf cached", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we write a test for the failure case? Where the cache read fails, or the cache write fails

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@kumare3
Copy link
Contributor

kumare3 commented Apr 15, 2021

I am assuming you do not have the event sending in this PR right?

@katrogan
Copy link
Contributor Author

trns.WithInfo(trns.Info().WithInfo(&handler.ExecutionInfo{TaskNodeInfo: &handler.TaskNodeInfo{TaskNodeMetadata: &event.TaskNodeMetadata{CacheStatus: status.GetCacheStatus(), CatalogKey: status.GetMetadata()}}}))
taskNodeInfoMetadata := &event.TaskNodeMetadata{CacheStatus: status.GetCacheStatus(), CatalogKey: status.GetMetadata()}
if dCtx.subWorkflowClosure != nil && dCtx.subWorkflowClosure.Primary != nil && dCtx.subWorkflowClosure.Primary.Template != nil {
taskNodeInfoMetadata.DynamicWorkflow = &event.DynamicWorkflowNodeMetadata{
Copy link
Contributor

Choose a reason for hiding this comment

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

This is pretty static (it gets generated once and never changes for the duration of that node)... should we keep sending it to Admin on every event? isn't that too much?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer we send it only once - does this need a state?

Copy link
Contributor Author

@katrogan katrogan Apr 15, 2021

Choose a reason for hiding this comment

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

yes we only send it once. for cached reads to the dynamic workflow we don't send it

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should rely on caching to not send it... can we make it based on the phase maybe? we only send it on queued or something like that... ? if there isn't a good existing node phase to control this, we can introduce one here...

katrogan added 15 commits April 16, 2021 11:05
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
@@ -116,6 +120,19 @@ func (d dynamicNodeTaskNodeHandler) buildDynamicWorkflowTemplate(ctx context.Con
}, nil
}

// Updates a dynamically generated subworkflow version to be deterministically generated from the computed closure.
func setDeterministicVersion(ctx context.Context, workflowClosure *core.CompiledWorkflowClosure) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not need to be done any more right? Why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted

kumare3
kumare3 previously approved these changes Apr 21, 2021
@katrogan
Copy link
Contributor Author

PTAL @EngHabu

Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Signed-off-by: Katrina Rogan <[email protected]>
Copy link
Contributor

@EngHabu EngHabu left a comment

Choose a reason for hiding this comment

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

Thank you for the verification runs!

@katrogan katrogan merged commit c5dde45 into master Apr 28, 2021
kumare3 pushed a commit that referenced this pull request May 25, 2021
eapolinario pushed a commit to eapolinario/flytepropeller that referenced this pull request Aug 9, 2023
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