Skip to main content

JSON Pipeline Runner

The JSON Pipeline Runner is a headless DataManager workflow for batch processing. It loads data, runs DataManager commands or transformations, and saves outputs from one JSON file.

Basic Usage

Run the executable with a pipeline file:

DataManagerPipelineRunner pipeline.json

The process exits with 0 when the pipeline succeeds. It exits nonzero when parsing, loading, command execution, or saving fails.

Minimal Load And Save

This example loads point data from CSV and saves it back out through the DataManagerIO saver system.

{
  "variables": {
    "session": "/data/session_001"
  },
  "data": [
    {
      "data_type": "points",
      "name": "nose",
      "format": "csv",
      "filepath": "${session}/nose.csv",
      "csv_layout": "simple",
      "frame_column": 0,
      "x_column": 1,
      "y_column": 2,
      "column_delim": ","
    }
  ],
  "saves": [
    {
      "data_key": "nose",
      "format": "csv",
      "path": "${session}/outputs/nose.csv"
    }
  ]
}

Commands

Use commands to run command architecture operations between loading and saving:

{
  "variables": {
    "label_key": "manual_contact"
  },
  "commands": [
    {
      "command_name": "AddInterval",
      "parameters": {
        "interval_key": "${label_key}",
        "start_frame": 100,
        "end_frame": 125,
        "create_if_missing": true
      }
    }
  ],
  "saves": [
    {
      "data_key": "${label_key}",
      "format": "csv",
      "path": "manual_contact.csv"
    }
  ]
}

Transformations

Use the same transformations shape used by DataManager JSON loading:

{
  "data": [
    {
      "data_type": "mask",
      "name": "whisker_mask",
      "format": "csv",
      "filepath": "masks.csv"
    }
  ],
  "transformations": {
    "steps": [
      {
        "step_id": "area",
        "transform_name": "CalculateMaskArea",
        "input_key": "whisker_mask",
        "output_key": "mask_area",
        "parameters": {}
      }
    ]
  },
  "saves": [
    {
      "data_key": "mask_area",
      "format": "csv",
      "path": "mask_area.csv"
    }
  ]
}

Paths And Variables

Paths in data[].filepath are resolved by the existing DataManager JSON loading system. Relative saves[].path values are resolved against the directory containing the pipeline JSON file. String variables in the top-level variables object can be referenced as ${name} in load entries, commands, and saves.

Looping over data entries

Use a top-level "loops" object to expand templated load entries. Placeholders use single braces ({whisker_id}), not ${...}:

{
  "loops": { "whisker_id": { "from": 0, "to": 4 } },
  "data": [
    {
      "data_type": "line",
      "name": "whisker_{whisker_id}",
      "format": "csv",
      "filepath": "whiskers/whisker_{whisker_id}.csv"
    }
  ]
}

Loop expansion runs before ${variable} substitution. See the developer file I/O notes for full rules.

TransformsV2 Pipelines

Use RunTransformsV2Pipeline in commands to run a saved TransformsV2 pipeline library JSON over an entire data object. Input and output DataManager keys are specified in the command, not in the pipeline file:

{
  "commands": [
    {
      "command_name": "RunTransformsV2Pipeline",
      "parameters": {
        "input_key": "whisker_masks",
        "output_key": "whisker_lines",
        "pipeline_path": "/path/to/mask_to_line.json"
      }
    }
  ]
}

For transforms that change sample count (for example SincInterpolation), register an upsampled TimeFrame first (for example with UpsampleTimeFrame) and pass output_time_key.

Useful Options

DataManagerPipelineRunner --no-load-transform pipeline.json
DataManagerPipelineRunner --no-commands pipeline.json
DataManagerPipelineRunner --no-saves pipeline.json
DataManagerPipelineRunner --continue-on-command-error pipeline.json
DataManagerPipelineRunner --continue-on-save-error pipeline.json

Use these options when debugging one phase of a pipeline or when intentionally collecting multiple command/save failures in one run.