Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process refKey #1558

Closed
wants to merge 13 commits into from
Closed

Add process refKey #1558

wants to merge 13 commits into from

Conversation

krhubert
Copy link
Contributor

close #1557

From what I see in this implementation nodeKey (in Reference) was also needed to find the right execution, @NicolasMahe any thoughts on that?

  • I've updated all messages id, because the counting was started form 2

@krhubert krhubert added the enhancement New feature or request label Dec 12, 2019
@krhubert krhubert self-assigned this Dec 12, 2019
@antho1404 antho1404 added this to the v0.18 milestone Dec 16, 2019
@NicolasMahe
Copy link
Member

NicolasMahe commented Dec 16, 2019

TODO:

  • rename execution.nodeKey to execution.refKey

@NicolasMahe NicolasMahe changed the title Add refKey to taks and rename nodeKey in reference Add refKey to tasks and rename nodeKey in reference Dec 16, 2019
@NicolasMahe NicolasMahe mentioned this pull request Dec 16, 2019
@NicolasMahe NicolasMahe changed the title Add refKey to tasks and rename nodeKey in reference Introduce process refKey Dec 16, 2019
@NicolasMahe NicolasMahe changed the title Introduce process refKey Add process refKey Dec 16, 2019
@NicolasMahe NicolasMahe marked this pull request as ready for review December 16, 2019 12:22
@krhubert krhubert marked this pull request as ready for review December 16, 2019 12:22
orchestrator/orchestrator.go Outdated Show resolved Hide resolved
if ref := output.GetRef(); ref != nil {
if _, err := w.FindNode(ref.NodeKey); err != nil {
if ref := output.GetRef(); ref != nil && ref.RefKey != "" {
if _, err := w.FindNode(ref.RefKey); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is right, findNode with check the nodeKey, in our case nodeKey is different than refKey.
This should be a find with a filter that the node is a task and has the same refKey or am I missing something here?

@@ -90,7 +91,7 @@ func (s *Orchestrator) dependencyFilter(exec *execution.Execution) func(wf *proc
if len(parents) > 1 {
return false, fmt.Errorf("multi parents not supported")
}
return parents[0] == exec.NodeKey, nil
return parents[0] == exec.RefKey, nil
Copy link
Member

Choose a reason for hiding this comment

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

parents are the list of parent nodes, so the list of nodeKey, I don't think this is right

@@ -33,6 +33,7 @@ func testOrchestratorRefTask(executionStream pb.Execution_StreamClient, instance
Key: "n1",
Type: &process.Process_Node_Task_{
Task: &process.Process_Node_Task{
RefKey: "n1",
Copy link
Member

Choose a reason for hiding this comment

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

Let's use a different name for key and refKey to avoid false positive in the tests

Suggested change
RefKey: "n1",
RefKey: "ref1",

@NicolasMahe NicolasMahe assigned antho1404 and unassigned krhubert Dec 17, 2019
@NicolasMahe
Copy link
Member

@antho1404 will finish the modif of this PR

Comment on lines +29 to +31
if refNode == nil {
return fmt.Errorf("%q reference not found", ref.RefKey)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't this error be returned by FindTaskNodeFromRef ?

@@ -45,3 +49,25 @@ func (w *Process) Trigger() (*Process_Node, error) {
}
return triggers[0], nil
}

// FindTaskNodeFromRef returns the node associated to a reference in the nodeKey's parents, returns an nil if not found
func (w *Process) FindTaskNodeFromRef(nodeKey string, refKey string) (*Process_Node, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
func (w *Process) FindTaskNodeFromRef(nodeKey string, refKey string) (*Process_Node, error) {
func (w *Process) FindTaskNodeFromRef(nodeKey, refKey string) (*Process_Node, error) {

Not mandatory

if err != nil {
return nil, err
}
if node.GetTask() != nil && node.GetTask().RefKey == refKey {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
if node.GetTask() != nil && node.GetTask().RefKey == refKey {
if task := node.GetTask(); task != nil && task.RefKey == refKey {

Comment on lines +69 to +70
refNode = r
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shoudn't we break here on refNode found?

@antho1404
Copy link
Member

I think this PR adds too much complexity for no real benefits. I created another PR (#1567) with a simple check on the parent and the ref that solves the data availability issue and still resolve based on the nodeKey.

This way we have a single system (nodeKey) to construct the graph and reference values but with additional checks.

There are more checks to do on the process that is listed on this issue #1568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add refKey to process map and execution
3 participants