Skip to main content

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 by xargsd, 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 watchman to run xargsd.client whenever 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 .py file and watch the daemon execute pytest .

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

xargsd-0.1.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xargsd-0.1.3-py2.py3-none-any.whl (2.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file xargsd-0.1.3.tar.gz.

File metadata

  • Download URL: xargsd-0.1.3.tar.gz
  • Upload date:
  • Size: 3.2 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

Hashes for xargsd-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4da8a2efa2a48a30925ed1c47ee0cd4ad85d8f2e10885337f042b35cec3d4a36
MD5 3812ef1ac1891c3b3f38bb8e33b16a43
BLAKE2b-256 3cb2b7a487fb192a471ae5eaff2993194ed179a64cb087440862cc54a2b25a05

See more details on using hashes here.

File details

Details for the file xargsd-0.1.3-py2.py3-none-any.whl.

File metadata

  • Download URL: xargsd-0.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 2, 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

Hashes for xargsd-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05c3232103b9c2560ea3f1cf2bc81641999477c30ba9e3f07127a4747e1e3ad5
MD5 4d25a19a2cb02ae4c6cd09c9e073035c
BLAKE2b-256 dc7351213c1ca9c72577b33b1202523fc73116e69a1fd5b771c1bd8eceb1664d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page