This project will be used as an additional test aid of the currency features of lorax outside of the scope the unit tests that it already contains.
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
- unit testing with Ginkgo/Gomega
- implemented with π Cobra cli framework, assisted by π² Cobrass
- i18n with go-i18n
- linting configuration and pre-commit hooks, (see: linting-golang).
Some general project settings are indicated as follows:
General
Under Pull Requests
Allow merge commits
π³ DISABLEAllow squash merging
π³ DISABLEAllow rebase merging
β ENABLE
Branch Protection Rules
Under Protect matching branches
Require a pull request before merging
β ENABLERequire linear history
β ENABLEDo not allow bypassing the above settings
β ENABLE
coveralls.io
: add scorpio project
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 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 for all translation/pluralisation options and other regional sensitive content.
For more detailed workflow instructions relating to i18n, please see i18n README
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