xargs-like daemon accepting input from arbitrary processes
Project description
Like xargs, but accepts arguments from arbitrary processes, and executes eagerly as long as there are arguments available.
That is to say, xargsd [...] -- foobar, when it receives arguments a and b, will execute foobar a b. If arguments c through f arrive while foobar a b is executing, then foobar c d e f will get run as soon as the first invocation finishes.
Examples
-
A toy example, demonstrating the very basic functionality:
$ python -m xargsd --socket-file temp.sock -vvv -- echo & [1] 14917 $ submit() { python -m xargsd.client --socket-file temp.sock -- "$@"; } $ submit a INFO:root:executing ['echo', 'a'] a $ submit b c d INFO:root:executing ['echo', 'b', 'c', 'd'] b c d
(Note that the
INFO:lines and the following ones are printed byxargsd, not the client.) -
A slightly-less-toy example, which demonstrates how commands are batched up while a previous command is executing:
$ echo 'date; sleep "$@"' > date-and-sleep.sh $ python -m xargsd --socket-file temp.sock -vvv -- bash date-and-sleep.sh & [4] 15714 $ submit() { echo "submitting $@"; python -m xargsd.client --socket-file temp.sock -- "$@"; } $ submit 1; sleep 0.1; submit 0.99; sleep 0.1; submit 1.01; sleep 3 submitting 1 INFO:root:executing ['bash', 'date-and-sleep.sh', '1'] Sun May 12 09:53:13 PDT 2019 submitting 0.99 submitting 1.01 DEBUG:root:finished executing ['bash', 'date-and-sleep.sh', '1']: status 0 INFO:root:executing ['bash', 'date-and-sleep.sh', '0.99', '1.01'] Sun May 12 09:53:14 PDT 2019 DEBUG:root:finished executing ['bash', 'date-and-sleep.sh', '0.99', '1.01']: status 0
-
A completely serious example, using
watchmanto runxargsd.clientwhenever a file (whose name matches some pattern) changes:$ watchman watch . $ watchman -- trigger . pytest -p '.*\.py$' -X -p '(^|.*/)\.' -- bash -c 'python -m xargsd.client --socket-file .xargsd-pytest.sock -- .' $ python -m xargsd --unique --socket-file .xargsd-pytest.sock -vvv -- pytest --color=yes
Then save a
.pyfile and watch the daemon executepytest .
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xargsd-0.1.6.tar.gz.
File metadata
- Download URL: xargsd-0.1.6.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4543863fa4011e502f8ee3adf3f9118f4d7414d868b0a0e9026d47d1fac0ce62
|
|
| MD5 |
c814c5e5f6a7979ed7f2d2ee5e46b280
|
|
| BLAKE2b-256 |
ac8829f05a3948ad5e972ea0f84b5ac8c6d964d399bb95684933b5fb234b3831
|
File details
Details for the file xargsd-0.1.6-py3-none-any.whl.
File metadata
- Download URL: xargsd-0.1.6-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0f6a2e29d974ca552caaeceb215e5e318df114fd9c5e3e73f3e9fd7fec2ce0
|
|
| MD5 |
9a17019b984209497ec8228194347261
|
|
| BLAKE2b-256 |
e3fe55ecda5714621123a738110a9acfdc6a9154adc607e7fe640fb5091eff03
|