https://github.com/zikwall/workstation
Simple, Powerful and productive asynchronous task manager written in Go
https://github.com/zikwall/workstation
go
Last synced: 22 days ago
JSON representation
Simple, Powerful and productive asynchronous task manager written in Go
- Host: GitHub
- URL: https://github.com/zikwall/workstation
- Owner: zikwall
- Created: 2021-01-17T11:35:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-03T09:17:10.000Z (about 5 years ago)
- Last Synced: 2025-02-23T20:43:54.780Z (over 1 year ago)
- Topics: go
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/zikwall/workstation/actions)
[](https://github.com/zikwall/workstation/actions)
Workstation
Simple, Powerful and productive asynchronous task manager written in Go
#### Types
- [x] Workstation - suitable for long-running processes
- [ ] WorkstationWorkerPool - pool of tasks that are processed in a limited number of threads
#### How to use
- `go get -u github.com/zikwall/workstation`
##### Workstation. Define custom worker
```go
package main
import (
"context"
"github.com/zikwall/workstation"
)
type MyWorker struct{}
func (w *MyWorker) Perform(ctx context.Context, key string, payload workstation.Payload) {
//..
//.. anything longer
//.. or unit process
}
func (w *MyWorker) Name() string {
return "worker_name_here"
}
// and create workstation ...
```
##### Workstation. Create workstation
```go
ctx, cancel := context.WithCancel(context.Background())
station := workstation.BuildWorkstation(ctx, &MyWorker{}, &MySecondWorker{})
space1, _ := station.Workspace((&MyWorker{}).Name())
space2, _ := station.Workspace((&MySecondWorker{}).Name())
// run sub-processes
err := space1.PerformAsync(
"first_process", workstation.Payload{"a": 1, "b": "6", "c": sampleFunctionC},
)
err := space2.PerformAsync(
"first_process", workstation.Payload{"a": 2, "b": "11", "c": sampleFunctionC},
)
// ..
// ..
cancel()
// stop all workspaces
station.Shutdown(func(e error) {
// ..
})
```
#### Todo
- [ ] **Workstation**: configuration
- [ ] **Workstation**: logs
- [ ] **Workstation**: limitation of parallel processes
- [ ] **Workstation**: max retry the process if the process failed with an error
- [ ] **Workstation**: server for pull/push jobs
- [ ] **Workstation**: web interface with auth, dashboards, control panel
- [ ] **Workstation**: process states: processed, busy, failed, dead (if retry > N), cancelled
- [ ] **WorkstationWorkerPool**: need to implement