Update parallel doc.

This commit is contained in:
jcamiel 2024-02-08 13:23:40 +01:00
parent e61d9ea9d4
commit 62a4a4dd0a
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC

View File

@ -53,13 +53,9 @@ $ hurl --parallel --test a.hurl b.hurl c.hurl
Reuse `--jobs` option from [GNU Parallel] to specify the number of threads.
```shell
$ hurl --parallel --jobs 4 --test a.hurl b.hurl c.hurl
$ hurl --parallel --max-workers 4 --test a.hurl b.hurl c.hurl
```
> `--jobs 0` will run as many jobs in parallel as possible.
## State of the Art / Tools
### GNU Parallel
@ -166,7 +162,7 @@ a.hurl Ab.hurl Bc.hurl Cd.hurl D%
The tag value is configurable.
- `keep-order/-k`: force GNU Parallel to print in the order of values, the commands are still run in parallel.
- `--keep-order/-k`: force GNU Parallel to print in the order of values, the commands are still run in parallel.
```shell
$ parallel sleep {}';' echo {} done ::: 5 4 3 2 1
@ -177,14 +173,12 @@ $ parallel sleep {}';' echo {} done ::: 5 4 3 2 1
5 done
```
#### From Hurl issues/discussions:
From [#87]():
```shell
$ parallel -j $(ls -1 *.hurl | wc -l) -i sh -c "hurl {} --test" -- *.hurl
$ echo "retval: $?"
```
> From [Hurl issues #87]():
>
> ```shell
> $ parallel -j $(ls -1 *.hurl | wc -l) -i sh -c "hurl {} --test" -- *.hurl
> $ echo "retval: $?"
> ```
### wrk2
@ -206,64 +200,64 @@ $ hurl --test *.hurl
[========> ] 2/3
```
### Hurl 4.2.0 parallel 5 jobs / option 2
- Progress bar on the right
- Idle jobs are displayed
### Hurl x.x.x parallel
- 5 workers:
```shell
$ hurl --test --parallel *.hurl
$ hurl --parallel --max-workers 5
/tmp/foo/bar/job-2.hurl: Success (2 request(s) in x ms)
/tmp/foo/bar/job-6.hurl: Success (4 request(s) in x ms)
/tmp/foo/bar/job-4.hurl: Success (7 request(s) in x ms)
#1 /tmp/foo/bar/baz/job-1.hurl: Running [1/10] [============> ] 6/10
#2 /tmp/foo/bar/ee/job-7.hurl: Running [7/10] [> ] 1/1
#3 /tmp/foo/bar/zzzzzz/job-3.hurl: Running [3/10] [================> ] 3/3
#4 /tmp/foo/bar/fff/job-8.hurl: Running [8/10] [> ] 1/5
#5 /tmp/foo/bar/ddd/job-5.hurl: Running [5/10] [================> ] 9/12
Executed files: 3/10 (30%)
[=========> ] 5/10 /tmp/foo/bar/baz/job-1.hurl: Running
[> ] 1/1 /tmp/foo/bar/ee/job-7.hurl: Running
[================> ] 3/3 /tmp/foo/bar/zzzzzz/job-3.hurl: Running
[> ] 1/5 /tmp/foo/bar/fff/job-8.hurl: Running
[==============> ] 8/12 /tmp/foo/bar/ddd/job-5.hurl: Running
```
- 1 worker:
```shell
/tmp/foo/bar/job-2.hurl: Success (2 request(s) in x ms)
/tmp/foo/bar/job-4.hurl: Success (7 request(s) in x ms)
/tmp/foo/bar/job-6.hurl: Success (4 request(s) in x ms)
/tmp/foo/bar/zzzzzz/job-3.hurl: Success (3 request(s) in x ms)
/tmp/foo/bar/ddd/job-5.hurl: Success (12 request(s) in x ms)
/tmp/foo/bar/ee/job-7.hurl: Success (1 request(s) in x ms)
$ hurl --parallel --max-workers 1
/tmp/foo/bar/baz/job-1.hurl: Success (10 request(s) in x ms)
#1 -: Idle
#2 /tmp/foo/bar/fff/job-8.hurl: Running [8/10] [===================> ] 5/5
#3 /tmp/foo/bar/job-9.hurl: Running [9/10] [===================> ] 9/10
#4 -: Idle
#5 /tmp/foo/bar/job-10.hurl: Running [10/10] [================> ] 3/3
/tmp/foo/bar/job-2.hurl: Success (2 request(s) in x ms)
/tmp/foo/bar/zzzzzz/job-3.hurl: Success (3 request(s) in x ms)
/tmp/foo/bar/job-4.hurl: Success (7 request(s) in x ms)
Executed files: 4/10 (40%)
[========> ] 5/12 /tmp/foo/bar/ddd/job-5.hurl: Running
```
### Hurl 4.2.0 parallel 5 jobs / option 2
- Progress bar on the left
- Idle jobs are not displayed
When the number of running jobs is more than x (TBD), we display x progress bars and '...y more'
```shell
$ hurl --parallel --max-workers 60
/tmp/foo/bar/job-2.hurl: Success (2 request(s) in x ms)
/tmp/foo/bar/job-6.hurl: Success (4 request(s) in x ms)
/tmp/foo/bar/job-4.hurl: Success (7 request(s) in x ms)
#1 [============> ] 6/10 /tmp/foo/bar/baz/job-1.hurl: Running [1/10]
#2 [> ] 1/1 /tmp/foo/bar/ee/job-7.hurl: Running [7/10]
#3 [================> ] 3/3 /tmp/foo/bar/zzzzzz/job-3.hurl: Running [3/10]
#4 [> ] 1/5 /tmp/foo/bar/fff/job-8.hurl: Running [8/10]
#5 [================> ] 9/12 /tmp/foo/bar/ddd/job-5.hurl: Running [5/10]
Executed files: 3/100 (3%)
[=========> ] 5/10 /tmp/foo/bar/baz/job-1.hurl: Running
[> ] 1/1 /tmp/foo/bar/ee/job-7.hurl: Running
[================> ] 3/3 /tmp/foo/bar/zzzzzz/job-3.hurl: Running
[> ] 1/5 /tmp/foo/bar/fff/job-8.hurl: Running
[==============> ] 8/12 /tmp/foo/bar/ddd/job-5.hurl: Running
...55 more
```
To reflect the current Hurl 4.2.0 temporal behaviour, when a job is done, we should output stderr and stdout (in this order).
## Exposed options
- `--parallel`: use parallel runner (should be the default in the future)
- `--max-workers 8`: limit the number of parallel jobs
- `--repeat`? `--repeat-all`?
- `--keep-order`: from GNU Parallel, useful for testing parallel reunner, or for getting response from a set of Hurl files.
## How to Test
Flask `run` method [takes a `threaded` option] to handle concurrent requests using thread or not (`True` by default).
## Related Issues
[1139 - how can send bulk request](https://github.com/Orange-OpenSource/hurl/issues/1139)
@ -272,13 +266,11 @@ Flask `run` method [takes a `threaded` option] to handle concurrent requests usi
[87 - add the --parallel option to run *.hurl files in parallel instead of sequentially](https://github.com/Orange-OpenSource/hurl/issues/87)
## Related Options
- `--repeat` TBD
- `--repeat-all` TBD
- ...
## Console Output
## Console Output of Others Programs
[Console output should better reflect the build process](https://github.com/rust-lang/cargo/issues/8889)
@ -293,12 +285,8 @@ TODO: make asciinema for different options.
## Backlog
- What options do we expose?
- Visualization? How do we report the timelines of Hurl files execution
- How to test? Support // in Flask?
- stderr / verbose report: do we prefix log lines by thread id / index ? We could make the debug logs identical whether
files are run sequentially or run in parallel.
- Does the user set "thread" affinity in Hurl files? (see https://github.com/Orange-OpenSource/hurl/issues/88#issuecomment-1674518247)
- What's the Rust runner API? Actually, we only expose on public method to run an Hurl file, we need(?) to expose methods
to runs multiple files