An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# ๐Ÿฆ‚ scorpio: ___Client application to test lorax concurrency features___

[![A B](https://img.shields.io/badge/branching-commonflow-informational?style=flat)](https://commonflow.org)
[![A B](https://img.shields.io/badge/merge-rebase-informational?style=flat)](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
[![A B](https://img.shields.io/badge/branch%20history-linear-blue?style=flat)](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule)
[![Go Reference](https://pkg.go.dev/badge/github.com/snivilised/scorpio.svg)](https://pkg.go.dev/github.com/snivilised/scorpio)
[![Go report](https://goreportcard.com/badge/github.com/snivilised/scorpio)](https://goreportcard.com/report/github.com/snivilised/scorpio)
[![Coverage Status](https://coveralls.io/repos/github/snivilised/scorpio/badge.svg?branch=master)](https://coveralls.io/github/snivilised/scorpio?branch=master&kill_cache=1)
[![Scorpio Continuous Integration](https://github.com/snivilised/scorpio/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/snivilised/scorpio/actions/workflows/ci-workflow.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![A B](https://img.shields.io/badge/commit-conventional-commits?style=flat)](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