@@ -10,7 +10,7 @@ AsyncJob aiming to help you organize code in dependencyGraph(DAG), instead of a
10
10
** Step** is a individual code block which can be executed and have inputs, output.
11
11
- a step would be started once all it's dependency is finished.
12
12
- output of a step can be feed into next step as input, type is checked by go generics.
13
- - step is wrapped in [ AsyncTask] ( github.com/Azure/go-asynctask ) with strongType info preserved
13
+ - step is wrapped in [ AsyncTask] ( https:// github.com/Azure/go-asynctask) with strongType info preserved
14
14
- you can feed parameters as a step as well.
15
15
16
16
# Usage
@@ -38,40 +38,57 @@ AsyncJob aiming to help you organize code in dependencyGraph(DAG), instead of a
38
38
# summarize
39
39
StepAfterBoth (bCtx, job, " summarize" , qery1ResultTask, qery2ResultTask, jobLib.SummarizeQueryResult )
40
40
41
- # visualize the job
42
- dotGraph := job.Visualize ()
43
- fmt.Println (dotGraph)
44
-
45
41
# execute job
46
42
job.Start (context.Background ())
47
43
job.Wait (context.WithTimeout (context.Background (), 10 *time.Second ))
48
44
```
49
45
50
46
### visualize of a job
51
- tried https://github.com/hashicorp/terraform/tree/main/internal/dag , which doesn't have own go module, but terraform go module have too much dependencies.
52
- baking a inhouse one.
47
+ ```
48
+ # visualize the job
49
+ dotGraph := job.Visualize()
50
+ fmt.Println(dotGraph)
51
+ ```
53
52
54
53
```
55
54
digraph {
56
- compound = "true"
57
55
newrank = "true"
58
- subgraph "root" {
59
- "[root] [Start]" -> "[root] getConnection"
60
- "[root] [Start]" -> "[root] param_query1"
61
- "[root] [Start]" -> "[root] param_query2"
62
- "[root] [Start]" -> "[root] param_table1"
63
- "[root] [Start]" -> "[root] param_table2"
64
- "[root] getConnection" -> "[root] getTableClient1"
65
- "[root] getConnection" -> "[root] getTableClient2"
66
- "[root] getTableClient1" -> "[root] queryTable1"
67
- "[root] getTableClient2" -> "[root] queryTable2"
68
- "[root] param_query1" -> "[root] queryTable1"
69
- "[root] param_query2" -> "[root] queryTable2"
70
- "[root] param_table1" -> "[root] getTableClient1"
71
- "[root] param_table2" -> "[root] getTableClient2"
72
- "[root] queryTable1" -> "[root] summarize"
73
- "[root] queryTable2" -> "[root] summarize"
74
- }
56
+ param_table1 [label="table1" shape=hexagon style=filled tooltip="Type: param\nName: table1\nState: completed\nStartAt: 2022-11-03T00:56:30.006196-07:00\nDuration: 12.657µs" fillcolor=green]
57
+ param_query1 [label="query1" shape=hexagon style=filled tooltip="Type: param\nName: query1\nState: completed\nStartAt: 2022-11-03T00:56:30.0062-07:00\nDuration: 17.013µs" fillcolor=green]
58
+ root_job [label="job" shape=triangle style=filled tooltip="Type: root\nName: job\nState: completed\nStartAt: 2022-11-03T00:56:30.006183-07:00\nDuration: 3.695µs" fillcolor=green]
59
+ param_query2 [label="query2" shape=hexagon style=filled tooltip="Type: param\nName: query2\nState: completed\nStartAt: 2022-11-03T00:56:30.006197-07:00\nDuration: 13.781µs" fillcolor=green]
60
+ task_getTableClient1 [label="getTableClient1" shape=box style=filled tooltip="Type: task\nName: getTableClient1\nState: completed\nStartAt: 2022-11-03T00:56:30.006304-07:00\nDuration: 34.652µs" fillcolor=green]
61
+ task_queryTable1 [label="queryTable1" shape=box style=filled tooltip="Type: task\nName: queryTable1\nState: completed\nStartAt: 2022-11-03T00:56:30.006349-07:00\nDuration: 3.217443247s" fillcolor=green]
62
+ param_table2 [label="table2" shape=hexagon style=filled tooltip="Type: param\nName: table2\nState: completed\nStartAt: 2022-11-03T00:56:30.006199-07:00\nDuration: 15.632µs" fillcolor=green]
63
+ task_getTableClient2 [label="getTableClient2" shape=box style=filled tooltip="Type: task\nName: getTableClient2\nState: completed\nStartAt: 2022-11-03T00:56:30.00631-07:00\nDuration: 51.872µs" fillcolor=green]
64
+ task_queryTable2 [label="queryTable2" shape=box style=filled tooltip="Type: task\nName: queryTable2\nState: completed\nStartAt: 2022-11-03T00:56:30.006377-07:00\nDuration: 67.814µs" fillcolor=green]
65
+ task_emailNotification [label="emailNotification" shape=box style=filled tooltip="Type: task\nName: emailNotification\nState: completed\nStartAt: 2022-11-03T00:56:33.223952-07:00\nDuration: 3.92µs" fillcolor=green]
66
+ param_serverName [label="serverName" shape=hexagon style=filled tooltip="Type: param\nName: serverName\nState: completed\nStartAt: 2022-11-03T00:56:30.006198-07:00\nDuration: 14.638µs" fillcolor=green]
67
+ task_getConnection [label="getConnection" shape=box style=filled tooltip="Type: task\nName: getConnection\nState: completed\nStartAt: 2022-11-03T00:56:30.006231-07:00\nDuration: 62.234µs" fillcolor=green]
68
+ task_checkAuth [label="checkAuth" shape=box style=filled tooltip="Type: task\nName: checkAuth\nState: completed\nStartAt: 2022-11-03T00:56:30.006212-07:00\nDuration: 650ns" fillcolor=green]
69
+ task_summarize [label="summarize" shape=box style=filled tooltip="Type: task\nName: summarize\nState: completed\nStartAt: 2022-11-03T00:56:33.22392-07:00\nDuration: 4.325µs" fillcolor=green]
70
+
71
+ param_table1 -> task_getTableClient1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006304-07:00" color=green]
72
+ param_query1 -> task_queryTable1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006349-07:00" color=green]
73
+ param_table2 -> task_getTableClient2 [style=bold tooltip="Time: 2022-11-03T00:56:30.00631-07:00" color=green]
74
+ task_getTableClient2 -> task_queryTable2 [style=bold tooltip="Time: 2022-11-03T00:56:30.006377-07:00" color=green]
75
+ param_query2 -> task_queryTable2 [style=bold tooltip="Time: 2022-11-03T00:56:30.006377-07:00" color=green]
76
+ task_queryTable2 -> task_summarize [style=bold tooltip="Time: 2022-11-03T00:56:33.22392-07:00" color=green]
77
+ root_job -> param_serverName [style=bold tooltip="Time: 2022-11-03T00:56:30.006198-07:00" color=green]
78
+ root_job -> task_checkAuth [style=bold tooltip="Time: 2022-11-03T00:56:30.006212-07:00" color=green]
79
+ root_job -> param_table1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006196-07:00" color=green]
80
+ root_job -> param_query1 [style=bold tooltip="Time: 2022-11-03T00:56:30.0062-07:00" color=green]
81
+ root_job -> param_table2 [style=bold tooltip="Time: 2022-11-03T00:56:30.006199-07:00" color=green]
82
+ root_job -> param_query2 [style=bold tooltip="Time: 2022-11-03T00:56:30.006197-07:00" color=green]
83
+ param_serverName -> task_getConnection [style=bold tooltip="Time: 2022-11-03T00:56:30.006231-07:00" color=green]
84
+ task_getTableClient1 -> task_queryTable1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006349-07:00" color=green]
85
+ task_queryTable1 -> task_summarize [style=bold tooltip="Time: 2022-11-03T00:56:33.22392-07:00" color=green]
86
+ task_summarize -> task_emailNotification [style=bold tooltip="Time: 2022-11-03T00:56:33.223952-07:00" color=green]
87
+ task_getConnection -> task_getTableClient1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006304-07:00" color=green]
88
+ task_getConnection -> task_getTableClient2 [style=bold tooltip="Time: 2022-11-03T00:56:30.00631-07:00" color=green]
89
+ task_checkAuth -> task_queryTable1 [style=bold tooltip="Time: 2022-11-03T00:56:30.006349-07:00" color=green]
90
+ task_checkAuth -> task_queryTable2 [style=bold tooltip="Time: 2022-11-03T00:56:30.006377-07:00" color=green]
91
+
75
92
}
76
93
```
77
- ![ visualize job graph] ( media/graphviz .svg )
94
+ ![ visualize job graph] ( media/asyncjob .svg )
0 commit comments