Skip to main content

Runs a not-so-simple command and collects resource usage metrics

Project description

duct

codecov

Quickstart

Try it out!

duct --sample-interval 0.5 --report-interval 1 test/data/test_script.py --duration 3 --memory-size=1000

duct is most useful when the report-interval is less than the duration of the script.

Summary:

A process wrapper script that monitors the execution of a command.

>duct --help

usage: duct [-h] [--version] [-p OUTPUT_PREFIX]
            [--summary-format SUMMARY_FORMAT] [--clobber] [-q]
            [--sample-interval SAMPLE_INTERVAL]
            [--report-interval REPORT_INTERVAL] [-c {all,none,stdout,stderr}]
            [-o {all,none,stdout,stderr}]
            [-t {all,system-summary,processes-samples}]
            command [command_args ...] ...

Gathers metrics on a command and all its child processes.

positional arguments:
  command [command_args ...]
                        The command to execute, along with its arguments.
  command_args          Arguments for the command.

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -p OUTPUT_PREFIX, --output-prefix OUTPUT_PREFIX
                        File string format to be used as a prefix for the
                        files -- the captured stdout and stderr and the
                        resource usage logs. The understood variables are
                        {datetime}, {datetime_filesafe}, and {pid}. Leading
                        directories will be created if they do not exist. You
                        can also provide value via DUCT_OUTPUT_PREFIX env
                        variable. (default:
                        .duct/logs/{datetime_filesafe}-{pid}_)
  --summary-format SUMMARY_FORMAT
                        Output template to use when printing the summary
                        following execution. (default: Exit Code: {exit_code}
                        Command: {command} Log files location: {logs_prefix}
                        Wall Clock Time: {wall_clock_time} sec Memory Peak
                        Usage (RSS): {peak_rss} Memory Average Usage (RSS):
                        {average_rss} Virtual Memory Peak Usage (VSZ):
                        {peak_vsz} Virtual Memory Average Usage (VSZ):
                        {average_vsz} Memory Peak Percentage: {peak_pmem}
                        Memory Average Percentage: {average_pmem} CPU Peak
                        Usage: {peak_pcpu} Average CPU Usage: {average_pcpu}
                        Samples Collected: {num_samples} Reports Written:
                        {num_reports} )
  --clobber             Replace log files if they already exist. (default:
                        False)
  -q, --quiet           Suppress duct output. (default: False)
  --sample-interval SAMPLE_INTERVAL, --s-i SAMPLE_INTERVAL
                        Interval in seconds between status checks of the
                        running process. Sample interval must be less than or
                        equal to report interval, and it achieves the best
                        results when sample is significantly less than the
                        runtime of the process. (default: 1.0)
  --report-interval REPORT_INTERVAL, --r-i REPORT_INTERVAL
                        Interval in seconds at which to report aggregated
                        data. (default: 60.0)
  -c {all,none,stdout,stderr}, --capture-outputs {all,none,stdout,stderr}
                        Record stdout, stderr, all, or none to log files. You
                        can also provide value via DUCT_CAPTURE_OUTPUTS env
                        variable. (default: all)
  -o {all,none,stdout,stderr}, --outputs {all,none,stdout,stderr}
                        Print stdout, stderr, all, or none to stdout/stderr
                        respectively. (default: all)
  -t {all,system-summary,processes-samples}, --record-types {all,system-summary,processes-samples}
                        Record system-summary, processes-samples, or all
                        (default: all)

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

con_duct-0.0.1.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

con_duct-0.0.1-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file con_duct-0.0.1.tar.gz.

File metadata

  • Download URL: con_duct-0.0.1.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for con_duct-0.0.1.tar.gz
Algorithm Hash digest
SHA256 730062871f43aa6bbbe40db5149f178712605b2654c2d31d1c447747e850d168
MD5 a8234967a1c68b92f2834f72f4467423
BLAKE2b-256 628589a0c80ea001d3330b89a0747e64bcd22bb22d77fbc6e2ea3d456fc3ff52

See more details on using hashes here.

File details

Details for the file con_duct-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: con_duct-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for con_duct-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f68aec5243e00fb8fd20c140eac2b5dbb664190770d2bcb26231613f92500121
MD5 4fbcc7bc4bd2b321cb2fa208ee7b5c22
BLAKE2b-256 06778f7d2c636a9b571222be69ff88aec3dfce52c879b03b8d90633a7e4cc15c

See more details on using hashes here.

Supported by

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