https://github.com/snivilised/scorpio
๐ฆ lorax worker pool client test app
https://github.com/snivilised/scorpio
Last synced: about 1 year ago
JSON representation
๐ฆ lorax worker pool client test app
- Host: GitHub
- URL: https://github.com/snivilised/scorpio
- Owner: snivilised
- License: mit
- Created: 2023-08-02T16:16:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-17T11:13:30.000Z (almost 2 years ago)
- Last Synced: 2025-02-14T23:48:30.252Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 190 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฆ scorpio: ___Client application to test lorax concurrency features___
[](https://commonflow.org)
[](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
[](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule)
[](https://pkg.go.dev/github.com/snivilised/scorpio)
[](https://goreportcard.com/report/github.com/snivilised/scorpio)
[](https://coveralls.io/github/snivilised/scorpio?branch=master&kill_cache=1)
[](https://github.com/snivilised/scorpio/actions/workflows/ci-workflow.yml)
[](https://github.com/pre-commit/pre-commit)
[](https://www.conventionalcommits.org/)
## ๐ฐ Introduction
This project will be used as an additional test aid of the currency features of [___lorax___](https://github.com/snivilised/lorax) outside of the scope the unit tests that it already contains.
## ๐ Usage
### Worker Pool Pipeline
From user provided flags, the __pool__ command submits a stream of jobs to the worker pool for concurrent execution. The job is defined as a function which takes a name and emits a greeting to this recipient. Since this function does not represent real work and therefore takes next to no time to run, it is infused with a synthetic delay to simulate real work. The delay is currently defined as a random interval.
- โถ๏ธ __Producer(jobsChSize, stopAfter) => jobsCh:__ generates a workload
๐ Variables:
| Name | Flag | Unit | Description |
|------------|---------|---------|-------------|
| jobsChSize | _jobq_ | | Capacity of the jobs channel |
| stopAfter | _after_ | seconds | Stops the producer after this time period |
- โถ๏ธ __Pool(noOfWorkers, jobsCh) => resultsCh:__ handles the workload with multiple workers generating a result stream
๐ Variables:
| Name | Flag | Unit | Description |
|---------------|---------|---------|-------------|
| noOfWorkers | _now_ | | No of workers in pool |
- โถ๏ธ __Consumer(resultsChSize, resultsCh):__ consumes the result stream
๐ Variables:
| Name | Flag | Unit | Description |
|---------------|---------|---------|-------------|
| resultsChSize | _resq_ | | Capacity of the results channel |
___โก Invocation:___
```
scorpio pool --after 3 --now 5 --jobq 18 --resq 16
```
## ๐ Features
- unit testing with [Ginkgo](https://onsi.github.io/ginkgo/)/[Gomega](https://onsi.github.io/gomega/)
- implemented with [๐ Cobra](https://cobra.dev/) cli framework, assisted by [๐ฒ Cobrass](https://github.com/snivilised/cobrass)
- i18n with [go-i18n](https://github.com/nicksnyder/go-i18n)
- linting configuration and pre-commit hooks, (see: [linting-golang](https://freshman.tech/linting-golang/)).
## ๐จ Developer Info
### โ๏ธ Github changes
Some general project settings are indicated as follows:
___General___
Under `Pull Requests`
- `Allow merge commits` ๐ณ _DISABLE_
- `Allow squash merging` ๐ณ _DISABLE_
- `Allow rebase merging` โ
_ENABLE_
___Branch Protection Rules___
Under `Protect matching branches`
- `Require a pull request before merging` โ
_ENABLE_
- `Require linear history` โ
_ENABLE_
- `Do not allow bypassing the above settings` โ
_ENABLE_
### โ๏ธ Code coverage
- `coveralls.io`: add scorpio project
### ๐ l10n Translations
This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __i18n/deploy/scorpio.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app.
Make sure that the go-i18n package has been installed so that it can be invoked as cli, see [go-i18n](https://github.com/nicksnyder/go-i18n) for installation instructions.
To maintain localisation of the application, the user must take care to implement all steps to ensure translate-ability of all user facing messages. Whenever there is a need to add/change user facing messages including error messages, to maintain this state, the user must:
- define template struct (__xxxTemplData__) in __i18n/messages.go__ and corresponding __Message()__ method. All messages are defined here in the same location, simplifying the message extraction process as all extractable strings occur at the same place. Please see [go-i18n](https://github.com/nicksnyder/go-i18n) for all translation/pluralisation options and other regional sensitive content.
For more detailed workflow instructions relating to i18n, please see [i18n README](./resources/doc/i18n-README.md)
### ๐งช Quick Test
To check the app is working (as opposed to running the unit tests), build and deploy:
> task tbd
(which performs a test, build then deploy)
NB: the `deploy` task has been set up for windows by default, but can be changed at will.
Check that the executable and the US language file __scorpio.active.en-US.json__ have both been deployed. Then invoke the __pool__ command with something like
> scorpio pool -now 5 --job 18 --resq 16


