https://github.com/s-matyukevich/executor
https://github.com/s-matyukevich/executor
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/s-matyukevich/executor
- Owner: s-matyukevich
- Created: 2015-03-06T20:27:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-07-24T09:00:18.000Z (almost 10 years ago)
- Last Synced: 2024-12-29T06:42:00.898Z (7 months ago)
- Language: Go
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Simple task excutor.
Main features:
1. Allows to execute tasks sequentially or in parallel.
2. Handle task status (Waiting, Running, Failed, Expired, Finished)
3. Allws to concurently track status of executing tasksk
4. Applys timout strategy for each task and to whole executionSample ussage:
stage1 := NewStage(
[]*Task{
&Task{
Name: "task1-1",
Func: func(){
fmt.Print("Task 1-1 is executing\n")
},
},
&Task{
Name: "task1-2",
Func: func(){
fmt.Print("Task 1-2 is executing\n")
},
},
&Task{
Name: "task1-3",
Func: func(){
fmt.Print("Task 1-3 is executing\n")
},
},
}, false)
stage2 := NewStage(
[]*Task{
&Task{
Name: "task2-1",
Func: func(){
fmt.Print("Task 2-1 is executing\n")
},
},
&Task{
Name: "task2-2",
Func: func(){
fmt.Print("Task 2-2 is executing\n")
},
},
&Task{
Name: "task2-3",
Func: func(){
fmt.Print("Task 2-3 is executing\n")
},
},
}, true)
executor := &Executor{}
executor.AddStage(stage1)
executor.AddStage(stage2)
executor.Execute()