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

Of watchdog #61

Merged
merged 14 commits into from
Jul 21, 2019
Merged

Of watchdog #61

merged 14 commits into from
Jul 21, 2019

Conversation

s8sg
Copy link
Owner

@s8sg s8sg commented Jul 16, 2019

An adaptation of of-watchdog.
As per openfaas in future all of the templates going to use the of-watchdog

This PR migrates from go template based on legacy watchdog to go-http-template based on of-watchdog. Along with that comes the below changes

s8sg added 5 commits July 16, 2019 14:51
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
@s8sg
Copy link
Owner Author

s8sg commented Jul 18, 2019

@chennqqi Can you please test the PR

@chennqqi
Copy link
Contributor

OK

@s8sg
Copy link
Owner Author

s8sg commented Jul 18, 2019

@chennqqi the faas-flow api has changed, chaining in nodes are much easier now. To create a node and chain operations:

dag.Node("start-node").Modify(func(data []byte) ([]byte, error) {
		return data, nil
	})

Check
https://github.com/s8sg/branching-in-faas-flow/blob/master/test-branching/handler.go

@chennqqi
Copy link
Contributor

got it

@chennqqi
Copy link
Contributor

chennqqi commented Jul 18, 2019

hi s8sg,
I wrote a project to test https://github.com/chennqqi/faas-flow-test
flow-ofwatchdog to test sync all, test pass, input any string
sumofsquare to test dag call, test faild
image
input 1,2 expect 5

@s8sg
Copy link
Owner Author

s8sg commented Jul 18, 2019

https://github.com/chennqqi/faas-flow-test/blob/master/stack.yml#L50
This line has a wrong name of the flow-function

    environment:
      workflow_name: "sumofsqure"

@chennqqi
Copy link
Contributor

Changed, but still failed.

@s8sg
Copy link
Owner Author

s8sg commented Jul 18, 2019

Okay I'll check, are you testing with of-watchdog branch ?
Does the master branch pass ?

s8sg added 3 commits July 18, 2019 23:15
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
@s8sg
Copy link
Owner Author

s8sg commented Jul 19, 2019

@chennqqi Dynamic For each branching has issue. This is not because of of-watchdog. I'll try to fix it over the weekend

@s8sg
Copy link
Owner Author

s8sg commented Jul 19, 2019

Created an issue at: #62

Signed-off-by: s8sg <swarvanusg@gmail.com>
@chennqqi
Copy link
Contributor

ok

s8sg added 3 commits July 21, 2019 00:36
Signed-off-by: s8sg <swarvanusg@gmail.com>
Signed-off-by: s8sg <swarvanusg@gmail.com>
Add fix for dynamic branch issue
@s8sg
Copy link
Owner Author

s8sg commented Jul 21, 2019

@chennqqi The latest changes on this branch should fix the issue

@s8sg
Copy link
Owner Author

s8sg commented Jul 21, 2019

@chennqqi I'm gonna merge it for now. I tested with different example dags. All of them works fine. I'll not delete the branch though, we will keep testing this branch branch and for new issues we will fix/merge if necessary.

@s8sg s8sg merged commit 97a2859 into master Jul 21, 2019
@chennqqi
Copy link
Contributor

chennqqi commented Jul 22, 2019

I test you new code. results are very strange.
test example: https://github.com/chennqqi/faas-flow-test/blob/master/sumofsquare/handler.go
test input:

echo "2,5" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"
echo "1,3" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"
echo "2,6" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"
echo "5,5" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"
echo "7,7" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"
echo "6,6" |faas invoke sumofsquare --async -H "X-Callback-Url=http://x.x.x.x:5888/"

test output:

POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:2,5

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:06:47 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: aaa431a2-0a70-425a-80b4-d4f7f21154dd
X-Duration-Seconds: 0.380178
X-Faas-Flow-Reqid: bkqighpf68f3ssuq5o9g
X-Function-Status: 200
X-Start-Time: 1563764807413679521


POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 8
Content-Type: plain/text
User-Agent: Go-http-client/1.1

agg:25,4
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 6
Content-Type: plain/text
User-Agent: Go-http-client/1.1

add:29
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:1,3

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:06:59 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: 1ba2f209-a7b1-449f-a4e8-275c54450476
X-Duration-Seconds: 0.246318
X-Faas-Flow-Reqid: bkqigkhf68f3ssuq5oa0
X-Function-Status: 200
X-Start-Time: 1563764818844988545


POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 7
Content-Type: plain/text
User-Agent: Go-http-client/1.1

agg:9,1
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 6
Content-Type: plain/text
User-Agent: Go-http-client/1.1

add:10
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:2,6

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:07:05 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: 2ff1e05b-28a6-4a9e-b6b7-23018f2077fb
X-Duration-Seconds: 0.197834
X-Faas-Flow-Reqid: bkqigm1f68f3ssuq5oag
X-Function-Status: 200
X-Start-Time: 1563764824961465391


POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 8
Content-Type: plain/text
User-Agent: Go-http-client/1.1

agg:36,4
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 6
Content-Type: plain/text
User-Agent: Go-http-client/1.1

add:40
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:5,5

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:07:16 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: c0fee028-0722-4614-b26a-4ba9a23edbf3
X-Duration-Seconds: 0.200775
X-Faas-Flow-Reqid: bkqigp1f68f3ssuq5ob0
X-Function-Status: 200
X-Start-Time: 1563764836075692459


POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 15
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:6,6
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:7,7

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:07:38 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: 115329a0-1256-4919-a5aa-397af5103ef9
X-Duration-Seconds: 0.235694
X-Faas-Flow-Reqid: bkqiguhf68f3ssuq5oc0
X-Function-Status: 200
X-Start-Time: 1563764858418288967


POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 9
Content-Type: plain/text
User-Agent: Go-http-client/1.1

agg:49,49
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 6
Content-Type: plain/text
User-Agent: Go-http-client/1.1

add:98
POST / HTTP/1.1
Host: 10.143.143.19:5888
Accept-Encoding: gzip
Content-Length: 16
Content-Type: plain/text
User-Agent: Go-http-client/1.1

square-each:6,6

POST / HTTP/1.1
Host: 10.143.143.19:5888
Connection: close
Accept-Encoding: gzip
Connection: close
Content-Length: 0
Date: Mon, 22 Jul 2019 03:07:46 GMT
User-Agent: Go-http-client/1.1
X-Call-Id: f8cd91a6-3918-4f52-93fe-45b882aeb22a
X-Duration-Seconds: 0.154781
X-Faas-Flow-Reqid: bkqih0hf68f3ssuq5ocg
X-Function-Status: 200
X-Start-Time: 1563764866607460948

after several calls, not all results are expect. Aggregator function not run.
5,5 6,6 no return

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

@chennqqi Thanks for sharing the output. What does the log say?

@chennqqi
Copy link
Contributor

chennqqi commented Jul 22, 2019

logs are here.

after run branch square, shoud next run Aggregator and then emit an async request to node_add. but not all testsl repeat this progress.

Forking - ./handler []
2019/07/22 03:04:55 Started logging stderr from function.
2019/07/22 03:04:55 Started logging stdout from function.
2019/07/22 03:04:55 OperationalMode: http
2019/07/22 03:04:55 Writing lock-file to: /tmp/.lock
2019/07/22 03:04:55 Metrics server. Port: 8081
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Created

2019/07/22 03:06:47 stderr: 2019/07/22 03:06:47 square-each: 2,5


2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] DAG state initiated at StateStore
[Request `bkqighpf68f3ssuq5o9g`] Executing node 0_1_square-each
[Request `bkqighpf68f3ssuq5o9g`] Processing dynamic node 0_1_square-each
[Request `bkqighpf68f3ssuq5o9g`] Executing foreach

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Received

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing node 1_1_square
[Request `bkqighpf68f3ssuq5o9g`] Executing function `square`

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:06:47 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Completed execution of Node 1_1_square

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Received

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing Node 0_1_square-each
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square
[Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for
2019/07/22 03:06:47 stdout:  option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqighpf68f3ssuq5o9g`] Executing end of dynamic node 0_1_square-each, delayed as completed indegree: 1/2

2019/07/22 03:06:47 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing node 1_1_square
[Request `bkqighpf68f3ssuq5o9g`] Executing function `square`

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Completed execution of Node 1_1_square

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing Node 0_1_square-each
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing end of dynamic node 0_1_square-each, completed indegree: 2/2

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 retrived from 0--0_1_square-each--0_1_square-each

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing aggregator of Dynamic Node 0_1_square-each

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Node 0_1_square-each to 0_2_add stored as 0_1_square-each--0_2_add
[Request `bkqighpf68f3ssuq5o9g`] performing request for Node 0_2_add, indegree count is 1

2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Async request submitted for Node 0_2_add

2019/07/22 03:06:47 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:47 stdout: [Request `bkqighpf68f3ssuq5o9g`] Received

2019/07/22 03:06:48 stdout: [Request `bkqighpf68f3ssuq5o9g`] Intermidiate result from Node 0_1_square-each to Node 0_2_add retrived from 0_1_square-each--0_2_add

2019/07/22 03:06:48 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing node 0_2_add
[Request `bkqighpf68f3ssuq5o9g`] Executing function `add`

2019/07/22 03:06:48 stdout: [Request `bkqighpf68f3ssuq5o9g`] Executing modifier
[Request `bkqighpf68f3ssuq5o9g`] Completed execution of Node 0_2_add

2019/07/22 03:06:48 stdout: [Request `bkqighpf68f3ssuq5o9g`] Completed successfully

2019/07/22 03:06:48 POST / - 200 OK - ContentLength: 2
2019/07/22 03:06:58 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Created

2019/07/22 03:06:58 stderr: 2019/07/22 03:06:58 square-each: 1,3


2019/07/22 03:06:58 stdout: [Request `bkqigkhf68f3ssuq5oa0`] DAG state initiated at StateStore
[Request `bkqigkhf68f3ssuq5oa0`] Executing node 0_1_square-each
[Request `bkqigkhf68f3ssuq5oa0`] Processing dynamic node 0_1_square-each
[Request `bkqigkhf68f3ssuq5oa0`] Executing foreach

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Received

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:06:59 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Received

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing node 1_1_square
[Request `bkqigkhf68f3ssuq5oa0`] Executing function `square`

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Completed execution of Node 1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing Node 0_1_square-each
2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing node 1_1_square
[Request `bkqigkhf68f3ssuq5oa0`] Executing function `square`

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Completed execution of Node 1_1_square

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing Node 0_1_square-each
2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing end of dynamic node 0_1_square-each, completed indegree: 2/2

2019/07/22 03:06:59 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqigkhf68f3ssuq5oa0`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:06:59 stdout:  indegree: 1/2

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 retrived from 0--0_1_square-each--0_1_square-each

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing aggregator of Dynamic Node 0_1_square-each

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Node 0_1_square-each to 0_2_add stored as 0_1_square-each--0_2_add
[Request `bkqigkhf68f3ssuq5oa0`] performing request for Node 0_2_add, indegree count is 1

2019/07/22 03:06:59 POST / - 200 OK - ContentLength: 0
2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Async request submitted for Node 0_2_add

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Received

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Intermidiate result from Node 0_1_square-each to Node 0_2_add retrived from 0_1_square-each--0_2_add

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing node 0_2_add
[Request `bkqigkhf68f3ssuq5oa0`] Executing function `add`

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Executing modifier

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Completed execution of Node 0_2_add

2019/07/22 03:06:59 stdout: [Request `bkqigkhf68f3ssuq5oa0`] Completed successfully

2019/07/22 03:06:59 POST / - 200 OK - ContentLength: 2
2019/07/22 03:07:04 stdout: [Request `bkqigm1f68f3ssuq5oag`] Created

2019/07/22 03:07:05 stderr: 2019/07/22 03:07:05 square-each: 2,6


2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] DAG state initiated at StateStore
[Request `bkqigm1f68f3ssuq5oag`] Executing node 0_1_square-each
[Request `bkqigm1f68f3ssuq5oag`] Processing dynamic node 0_1_square-each
[Request `bkqigm1f68f3ssuq5oag`] Executing foreach

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Received

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:07:05 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing node 1_1_square
[Request `bkqigm1f68f3ssuq5oag`] Executing function `square`

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Completed execution of Node 1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Received

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing Node 0_1_square-each
2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing node 1_1_square
[Request `bkqigm1f68f3ssuq5oag`] Executing function `square`

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Completed execution of Node 1_1_square

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqigm1f68f3ssuq5oag`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:05 stdout:  indegree: 1/2

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing Node 0_1_square-each
2019/07/22 03:07:05 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing end of dynamic node 0_1_square-each, completed indegree: 2/2

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 retrived from 0--0_1_square-each--0_1_square-each

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Executing aggregator of Dynamic Node 0_1_square-each

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Node 0_1_square-each to 0_2_add stored as 0_1_square-each--0_2_add
[Request `bkqigm1f68f3ssuq5oag`] performing request for Node 0_2_add, indegree count is 1

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Async request submitted for Node 0_2_add

2019/07/22 03:07:05 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Received

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Intermidiate result from Node 0_1_square-each to Node 0_2_add retrived from 0_1_square-each--0_2_add
[Request `bkqigm1f68f3ssuq5oag`] Executing node 0_2_add
[Request `bkqigm1f68f3ssuq5oag`] Executing function `add`
[Request
2019/07/22 03:07:05 stdout:  `bkqigm1f68f3ssuq5oag`] Executing modifier

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Completed execution of Node 0_2_add

2019/07/22 03:07:05 stdout: [Request `bkqigm1f68f3ssuq5oag`] Completed successfully

2019/07/22 03:07:05 POST / - 200 OK - ContentLength: 2
2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Created

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] DAG state initiated at StateStore
[Request `bkqigp1f68f3ssuq5ob0`] Executing node 0_1_square-each
[Request `bkqigp1f68f3ssuq5ob0`] Processing dynamic node 0_1_square-each
[Request `bkqigp1f68f3ssuq5ob0`] Executing foreach

2019/07/22 03:07:16 stderr: 2019/07/22 03:07:16 square-each: 5,5


2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Received

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:07:16 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Received

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Executing node 1_1_square
[Request `bkqigp1f68f3ssuq5ob0`] Executing function `square`

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Executing node 1_1_square
[Request `bkqigp1f68f3ssuq5ob0`] Executing function `square`

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Completed execution of Node 1_1_square
[Request `bkqigp1f68f3ssuq5ob0`] Completed execution of Node 1_1_square

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Executing Node 0_1_square-each
2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Executing Node 0_1_square-each
2019/07/22 03:07:16 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqigp1f68f3ssuq5ob0`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:16 stdout:  indegree: 1/2

2019/07/22 03:07:16 stdout: [Request `bkqigp1f68f3ssuq5ob0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 stored as 1--0_1_square-each--0_1_square-each
[Request `bkqigp1f68f3ssuq5ob0`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:16 stdout:  indegree: 1/2

2019/07/22 03:07:16 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:24 stdout: [Request `bkqigr1f68f3ssuq5obg`] Created

2019/07/22 03:07:24 stdout: [Request `bkqigr1f68f3ssuq5obg`] DAG state initiated at StateStore
[Request `bkqigr1f68f3ssuq5obg`] Executing node 0_1_square-each
[Request `bkqigr1f68f3ssuq5obg`] Processing dynamic node 0_1_square-each
[Request `bkqigr1f68f3ssuq5obg`] Executing foreach

2019/07/22 03:07:24 stderr: 2019/07/22 03:07:24 square-each: 6,6

2019/07/22 03:07:24 stdout: [Request `bkqigr1f68f3ssuq5obg`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:24 stdout: [Request `bkqigr1f68f3ssuq5obg`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:07:25 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square
[Request `bkqigr1f68f3ssuq5obg`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Received

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Received
[Request `bkqigr1f68f3ssuq5obg`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square
[Request `bkqigr1f68f3ssuq5obg`] Executing node 1_1_square
2019/07/22 03:07:25 stdout: 
[Request `bkqigr1f68f3ssuq5obg`] Executing function `square`
[Request `bkqigr1f68f3ssuq5obg`] Completed execution of Node 1_1_square
[Request `bkqigr1f68f3ssuq5obg`] Executing Node 0_1_square-each
2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Executing node 1_1_square
[Request `bkqigr1f68f3ssuq5obg`] Executing function `square`

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Completed execution of Node 1_1_square

2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Executing Node 0_1_square-each
2019/07/22 03:07:25 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqigr1f68f3ssuq5obg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:25 stdout:  indegree: 1/2

2019/07/22 03:07:25 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:25 stdout: [Request `bkqigr1f68f3ssuq5obg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 stored as 1--0_1_square-each--0_1_square-each
[Request `bkqigr1f68f3ssuq5obg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:25 stdout:  indegree: 1/2

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Created

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] DAG state initiated at StateStore
[Request `bkqiguhf68f3ssuq5oc0`] Executing node 0_1_square-each
[Request `bkqiguhf68f3ssuq5oc0`] Processing dynamic node 0_1_square-each
[Request `bkqiguhf68f3ssuq5oc0`] Executing foreach

2019/07/22 03:07:38 stderr: 2019/07/22 03:07:38 square-each: 7,7


2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Received

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:07:38 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Received

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing node 1_1_square
[Request `bkqiguhf68f3ssuq5oc0`] Executing function `square`

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Completed execution of Node 1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing Node 0_1_square-each
2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing node 1_1_square
[Request `bkqiguhf68f3ssuq5oc0`] Executing function `square`

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Completed execution of Node 1_1_square

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing Node 0_1_square-each
2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 stored as 1--0_1_square-each--0_1_square-each
[Request `bkqiguhf68f3ssuq5oc0`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:38 stdout:  indegree: 1/2

2019/07/22 03:07:38 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing end of dynamic node 0_1_square-each, completed indegree: 2/2

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 retrived from 1--0_1_square-each--0_1_square-each

2019/07/22 03:07:38 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing aggregator of Dynamic Node 0_1_square-each

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Node 0_1_square-each to 0_2_add stored as 0_1_square-each--0_2_add
[Request `bkqiguhf68f3ssuq5oc0`] performing request for Node 0_2_add, indegree count is 1

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Async request submitted for Node 0_2_add

2019/07/22 03:07:39 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Received

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Intermidiate result from Node 0_1_square-each to Node 0_2_add retrived from 0_1_square-each--0_2_add

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Executing node 0_2_add
[Request `bkqiguhf68f3ssuq5oc0`] Executing function `add`
[Request `bkqiguhf68f3ssuq5oc0`] Executing modifier

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Completed execution of Node 0_2_add

2019/07/22 03:07:39 stdout: [Request `bkqiguhf68f3ssuq5oc0`] Completed successfully

2019/07/22 03:07:39 POST / - 200 OK - ContentLength: 2
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Created

2019/07/22 03:07:46 stderr: 2019/07/22 03:07:46 square-each: 6,6


2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] DAG state initiated at StateStore
[Request `bkqih0hf68f3ssuq5ocg`] Executing node 0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Processing dynamic node 0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Executing foreach

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result for option 0 from Node 0_1_square-each to 1_1_square stored as 0--0_1_square-each--1_1_square

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Async request submitted for Node 1_1_square option 0

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result for option 1 from Node 0_1_square-each to 1_1_square stored as 1--0_1_square-each--1_1_square
[Request `bkqih0hf68f3ssuq5ocg`] Received

2019/07/22 03:07:46 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Async request submitted for Node 1_1_square option 1

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Received

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 1 retrived from 1--0_1_square-each--1_1_square

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Node 0_1_square-each to Node 1_1_square for option 0 retrived from 0--0_1_square-each--1_1_square

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Executing node 1_1_square
[Request `bkqih0hf68f3ssuq5ocg`] Executing function `square`
[Request `bkqih0hf68f3ssuq5ocg`] Executing node 1_1_square
[Request `bkqih0hf68f3ssuq5ocg`] Executing function `square`

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Completed execution of Node 1_1_square

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Completed execution of Node 1_1_square

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Executing Node 0_1_square-each
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Executing Node 0_1_square-each
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 stored as 1--0_1_square-each--0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:46 stdout:  indegree: 1/2

2019/07/22 03:07:46 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:46 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:46 stdout:  indegree: 1/2

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

@chennqqi the error here is strange, it seems the coordination failed

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Executing Node 0_1_square-each
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Executing Node 0_1_square-each
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 1 stored as 1--0_1_square-each--0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:46 stdout:  indegree: 1/2

2019/07/22 03:07:46 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:46 POST / - 200 OK - ContentLength: 0
2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Intermidiate result from Branch to Dynamic Node 0_1_square-each for option 0 stored as 0--0_1_square-each--0_1_square-each
[Request `bkqih0hf68f3ssuq5ocg`] Executing end of dynamic node 0_1_square-each, delayed as completed
2019/07/22 03:07:46 stdout:  indegree: 1/2

Clearly for 2nd execution the in-degree count should have been 2 for the same request
Problem is I'm not being able to reproduce it
Can you please check the value for request bkqih0hf68f3ssuq5ocg and key 0_1_square-each-branch-completion in consul.

@chennqqi
Copy link
Contributor

curl http://*.*.*.*:8500/v1/kv/faasflow/sumofsquare/bkqih0hf68f3ssuq5ocg/0_1_square-each-branch-completion
[{"LockIndex":0,"Key":"faasflow/sumofsquare/bkqih0hf68f3ssuq5ocg/0_1_square-each-branch-completion","Flags":0,"Value":"MQ==","CreateIndex":250622,"ModifyIndex":250625}]

echo "MQ==" | base64 -d
1

value is 1

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

I thought so
@chennqqi You may review the coordinator code here, this is how the counter getting incremented
https://github.com/s8sg/faas-flow/blob/master/template/faas-flow/handler.go#L88

// IncrementCounter increment counter by given term, if doesn't exist init with incrementby
func (fhandler *flowHandler) IncrementCounter(counter string, incrementby int) (int, error) {
        var serr error
        count := 0
        for i := 0; i < counterUpdateRetryCount; i++ {
                encoded, err := fhandler.stateStore.Get(counter)
                if err != nil {
                        // if doesn't exist try to create
                        err := fhandler.stateStore.Set(counter, fmt.Sprintf("%d", incrementby))
                        if err != nil {
                                return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err)
                        }
                        return incrementby, nil
                }

                current, err := strconv.Atoi(encoded)
                if err != nil {
                        return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err)
                }

                count = current + incrementby
                counterStr := fmt.Sprintf("%d", count)

                err = fhandler.stateStore.Update(counter, encoded, counterStr)
                if err == nil {
                        return count, nil
                }
                serr = err
        }
        return 0, fmt.Errorf("failed to update counter after max retry for %s, error %v", counter, serr)
}

One possible hole here is, when both of the requests fails to get the counter and both tries to create it.
Great if you can suggest some improvement

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

@chennqqi
This should not be created over there.
The variable would have been initialised at https://github.com/s8sg/faas-flow/blob/master/template/faas-flow/handler.go#L692

        // Set the no of branch completion for the current dynamic node
	key := pipeline.GetNodeExecutionUniqueId(currentNode) + "-branch-completion"
	_, err := fhandler.IncrementCounter(key, 0)
	if err != nil {
		return nil, fmt.Errorf("[Request `%s`] Failed to initiate dynamic indegree count for %s, err %v",
			fhandler.id, key, err)
        }

       fmt.Printf("[Request `%s`] Dynamic indegree count initiated as %s\n",
		fhandler.id, key)

	// Set all the dynamic options for the current dynamic node
	key = pipeline.GetNodeExecutionUniqueId(currentNode) + "-dynamic-branch-options"
	err = fhandler.SetDynamicBranchOptions(key, options)
	if err != nil {
		return nil, fmt.Errorf("[Request `%s`] Dynamic Node %s, failed to store dynamic options",
			fhandler.id, currentNodeUniqueId)
	}

	fmt.Printf("[Request `%s`] Dynamic options initiated as %s\n",
		fhandler.id, key)

Which logged

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Dynamic indegree count initiated as 0_1_square-each-branch-completion

2019/07/22 03:07:46 stdout: [Request `bkqih0hf68f3ssuq5ocg`] Dynamic options initiated as 0_1_square-each-dynamic-branch-options

The issue is in the Increment Counter update logic

@chennqqi
Copy link
Contributor

chennqqi commented Jul 22, 2019

all branch run square, both of two consider self as node 0_1_square-each
so after ``quarebranch indegree: 1/2` not expected `indegree: 2/2`.
The problem is how to avoid branch node run with same node name ?

@chennqqi
Copy link
Contributor

chennqqi commented Jul 22, 2019

Is that atomic counter problem? to solve this, use consul global lock

// IncrementCounter increment counter by given term, if doesn't exist init with incrementby
func (fhandler *flowHandler) IncrementCounter(counter string, incrementby int) (int, error) {
        var serr error
        count := 0
        for i := 0; i < counterUpdateRetryCount; i++ {
               LOCK_BY_FLOW_ID()
                encoded, err := fhandler.stateStore.Get(counter)
                if err != nil {
                        // if doesn't exist try to create
                        err := fhandler.stateStore.Set(counter, fmt.Sprintf("%d", incrementby))
                        if err != nil {
                                return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err)
                        }
                        return incrementby, nil
                }

                current, err := strconv.Atoi(encoded)
                if err != nil {
                        return 0, fmt.Errorf("failed to update counter %s, error %v", counter, err)
                }

                count = current + incrementby
                counterStr := fmt.Sprintf("%d", count)

                err = fhandler.stateStore.Update(counter, encoded, counterStr)
                if err == nil {
                        return count, nil
                }
                serr = err
              UNLOCK_BY_FLOW_ID()
        }
        return 0, fmt.Errorf("failed to update counter after max retry for %s, error %v", counter, serr)
}

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

@chennqqi

1st

I'm not sure whats the problem of two nodes running with same node id. In the current dag it doesn't have any issue. If you have nested foreach then it is a problem, to avoid that we are generating a unique execution id for making the counter unique

pipeline.GetNodeExecutionUniqueId(currentNode)

You can think of the logic here is each branch is an execution thread. But only one of them should continue forward and every other would be stopped. The logic is simple

1. Execute branch
2. Check no of options (branch count)
3. Increment the Counter based on the dynamic node name (expected to be Atomic by KV)
4. Check the count 
5. IF all branch not finished 
   a. stop
6. Else
   a. get result of other branches
   b. Aggregate
   c. Execute next nodes

2nd

We can use distributed lock, but then the lock should be based on key. Creating a lock by flow-name will have a lot of bottleneck, and not necessary in this case.

Although I'm trying to avoid lock. We are doing compare and update in statestore.

// compare old value and if match then only update
err = fhandler.stateStore.Update(counter, encoded, counterStr)

each compare and update call implemented as atomic in KV store. If one compare and update success, the next one should fail. Isn't it ?

@s8sg
Copy link
Owner Author

s8sg commented Jul 22, 2019

This is the code from consul statestore implementation

// Update Compare and Update a valuer
func (consulStore *ConsulStateStore) Update(key string, oldValue string, newValue string) error {
	key = consulStore.consulKeyPath + "/" + key
	pair, _, err := consulStore.kv.Get(key, nil)
	if err != nil {
		return fmt.Errorf("failed to get key %s, error %v", key, err)
	}
	if pair == nil {
		return fmt.Errorf("failed to get key %s", key)
	}
	if string(pair.Value) != oldValue {
		return fmt.Errorf("Old value doesn't match for key %s", key)
	}
	modifyIndex := pair.ModifyIndex

	p := &consul.KVPair{Key: key, Value: []byte(newValue), ModifyIndex: modifyIndex}
	_, err = consulStore.kv.Put(p, nil)
	if err != nil {
		return fmt.Errorf("failed to update key %s, error %v", key, err)
	}
	return nil
}

If once is updated the pair.ModifyIndex should change. If the pair.ModifyIndex doesn't match the

consulStore.kv.Put(p, nil)

should fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants