Skip to main content

a cli for interacting with stumpf server

Project description

boiler

installation

# for yaml.CLoader support (faster yaml parsing)
apt install libyaml-dev

# install pipx
python3 -m pip install --user pipx
python3 -m pipx ensurepath

# install boiler tools
pipx install diva-boiler

# set token for stumpf
export STUMPF_API_URL="" # defaults to https://stumpf-the-younger.avidannotations.com/api/diva
export X_STUMPF_TOKEN=""

# set tokens for boto3.  currently unused - you can ignore these
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""

boiler --help

You should install jq for output formatting.

See boto3 docs for additional info about AWS config.

usage

This documentation provides some useful examples, but is not exhaustive.

# to get up-to-date documentation, use the help option
boiler [noun] --help
boiler [noun] [verb] --help

Commands produce json objects as output. No keys are guaranteed, and different commands produce different keys.

{
  "response": { /* network response body if network request succeeds */ },
  "error": { /* error information if errors were encountered */ },
  "context": { /* error context if available */ },
  "summary": { /* summarization of activity files */ },
}

local data manipulation

boiler has utilities to read, validate, and convert KPF and KW18 data. Some example commands are below. These are offline operations.

# show KPF help
boiler kpf load --help

# show kw18 help
boiler kw18 load --help

# validate some kpf
boiler kpf load \
  --geom examples/kpf/geom.yml \
  --activities examples/kpf/activities.yml \
  --types examples/kpf/types.yml \
  --prune \
  --validate \
  | jq

# convert kw18 to kpf
boiler kw18 load \
  --txt /path/to/data.txt \
  --kw18 /path/to/data.kw18 \
  --types /path/to/data.kw18.types \
  --validate \
  --convert kpf directory/output_basename \
  | jq
  • --validate checks activities for integrity errors. The rules for validation are generally documented as assertion string errors in boiler/validate.py
  • --prune runs keyframe correction to validate that no frames marked as keyframes match perfectly with the linear interpolation of their surrounding keyframes. If --prune is specified, --convert will omit non-keyframes from the output.
  • --convert takes 2 arguments: kpf|kw18 and a path to the output file's base name. It will overwrite the output file if it
  • Note that for --geom, --activities, --types, --txt, --kw18, not all of the options have to be specified at every run. Without all 3, validation will fail, but if you just want to see what's going on in an activity file (for example) without having to specify types or geometry, you'll still get a summary with info limited to that file.

Example data can be found in examples/kpf/

Workflow Step 1: video ingest

Can be done one-off or through a batch CSV file.

# one-off
boiler video add --help

# minimal add
boiler video add \
  --video-path somefile.avi \
  --release-batch testing \
  | jq

# bulk using a manifest csv file
boiler video bulk-ingest --help

# display the bulk csv header
boiler video get-bulk-csv-header

Example bulk ingest header:

local_file,release_batch
nodes/2018-03-04/10/2018-03-04.10-54-11.10-55-00.admin.G335.avi,sequestered
nodes/2018-05-12/17/2018-05-12.17-00-00.17-05-00.admin.G334.avi,testing

Workflow Step 2: vendor activity dispatch

Once a video exists, it can be transitioned to the annotation state.

boiler vendor dispatch --help

# generate the list of known activity types to file
boiler activity list-types > activity-list.txt

# specify a video, vendor, and list of activities to transition to the annotation stage
boiler vendor dispatch \
  --name kitware \
  --video-name 2999-01-01.00-00-00.00-05-00.admin.G999 \
  --activity-type-list activity-list.txt \
  --set-name test-set
  | jq

Example type lists can be found in examples/

Workflow Step 3: vendor activity ingestion

When activities come back from vendors, they should be transitioned to the audit state.

boiler kw18 ingest --help

# specify kw18 to ingest and transition
boiler kw18 ingest \
  --types examples/kw18/2999-01-01.00-00-00.00-05-00.admin.G999.kw18.types \
  --kw18 examples/kw18/2999-01-01.00-00-00.00-05-00.admin.G999.kw18  \
  --txt examples/kw18/2999-01-01.00-00-00.00-05-00.admin.G999.txt  \
  --regions examples/kw18/2999-01-01.00-00-00.00-05-00.admin.G999.kw18.regions  \
  --video-name 2999-01-01.00-00-00.00-05-00.admin.G999 \
  --vendor-name kitware \
  --activity-type-list examples/activity-type-list-short.txt \
  | jq

Stumpf will first detect whether the files have changed or not. If they have not, no further action will be taken. If they have, then Stumpf will:

  1. Generate a transition to the "annotation" status
  2. Run server side validation
    • If validation fails, return failure information
    • If validation succeeds, transition to the "audit" state and ingest activities from the KW18 files

design

design for cli commands follows some simple guidelines:

  • commands produce a single JSON document (map or array) as output on stdout in all conditions.
  • input data and REST errors cause boiler to exit with status code 1. error information is JSON on stdout.
  • fatal exceptions not related to input data or REST operations should not be caught or handled.
  • additional logging and metrics, especially for batch operations, may be printed to stderr.
  • any output on stderr has no guaranteed format, though in most cases it should be human-readable lines of text.
  • click.argument should not be used. prefer click.option
  • you can confidently pipe any boiler command to jq

Project details


Release history Release notifications | RSS feed

This version

0.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diva-boiler-0.0.7.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

diva_boiler-0.0.7-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file diva-boiler-0.0.7.tar.gz.

File metadata

  • Download URL: diva-boiler-0.0.7.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for diva-boiler-0.0.7.tar.gz
Algorithm Hash digest
SHA256 9f305e65acd757b5c5b5d98a7bc654414c7f149dea8bfe9cc5555ca4c90a0b3c
MD5 8374372f5ad17a4835e8f91666141c0d
BLAKE2b-256 2caf2f06d3dc254902d5b8d755572ece4073ab742c4bb100d5d57688b89c1533

See more details on using hashes here.

File details

Details for the file diva_boiler-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: diva_boiler-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9

File hashes

Hashes for diva_boiler-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 74b4a72cc8022df1cedb08709079d2480544dd2c9ea6c34328a60347a91ce6cf
MD5 9c8ab495a396c4f9c6cedd80edb2c16c
BLAKE2b-256 c80704f824e7bf91fc1033b9491e068e5739834311de152eab83caa94221fb62

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