Pipelines¶
taters.pipelines.run_pipeline ¶
Taters Pipeline Runner (robust templating + flexible call resolution)
- ITEM steps run once per input (fan-out concurrently).
- GLOBAL steps run once (barrier before/after).
- Templating preserves native types when the entire value is a single template (e.g., {{var:text_cols}} → list, not "['text']").
- Calls:
- "potato.*" → call via a Taters() instance (e.g., potato.text.analyze_with_dictionaries)
- dotted path → import and call any function (e.g., taters.helpers.feature_gather.aggregate_features)
Usage example: python -m taters.pipelines.run_pipeline --root_dir videos --file_type video --preset conversation_video --workers 4 --var device=cuda --var overwrite_existing=true
available_presets ¶
available_presets(root=None)
Every preset the runner can see, with its metadata.
Both search directories are covered -- the ones that ship with Taters and
the ones in ./pipelines/ -- which is what lets a UI offer the built-in
pipelines alongside anything the user has built. Sorted by title so the
list is stable between runs.
Returns:
| Type | Description |
|---|---|
list[tuple[Path, dict]]
|
|
Source code in src\taters\pipelines\run_pipeline.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
discover_inputs ¶
discover_inputs(root_dir, kind)
Recursively discover input files under a root folder.
The preset's ITEM-scoped steps operate over a list of inputs. This
function builds that list by scanning root_dir and selecting files by
type:
- kind == "video": only common video extensions (e.g., .mp4, .mov, .mkv)
- kind == "audio": only common audio extensions (e.g., .wav, .mp3, .flac)
- kind == "any": all files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_dir
|
Path
|
Directory to scan (will be resolved to an absolute path). |
required |
kind
|
('audio', 'video', 'any')
|
Filter that determines which file extensions are included. |
"audio","video","any"
|
Returns:
| Type | Description |
|---|---|
List[Path]
|
Sorted list of absolute file paths. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
Source code in src\taters\pipelines\run_pipeline.py
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
is_builtin_preset ¶
is_builtin_preset(path)
Whether a preset ships with Taters, and so must not be edited or deleted.
Source code in src\taters\pipelines\run_pipeline.py
125 126 127 128 129 130 131 | |
load_preset_by_name ¶
load_preset_by_name(name)
Load a named pipeline preset by meta.id or filename stem.
Presets are resolved with :func:resolve_preset_path, which searches the
built-in presets/ folder as well as a project-local ./pipelines folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Preset |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Parsed YAML as a Python dictionary. Returns |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no preset with that name exists in any search directory. |
Source code in src\taters\pipelines\run_pipeline.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | |
load_yaml_file ¶
load_yaml_file(path)
Load a YAML file into a Python dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Full path to a YAML file. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Parsed YAML contents. Empty files yield |
Source code in src\taters\pipelines\run_pipeline.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
main ¶
main()
Entry point for the Taters Pipeline Runner.
Responsibilities
- Parse CLI arguments (
--presetor--preset-file, optional--vars-fileand repeated--var key=valueoverrides,--workers,--quiet, etc.). - Load the preset YAML and merge variables from three sources in order:
1) preset
varsblock 2)--vars-file(YAML) 3) repeated--varCLI flags - Decide whether input discovery is required:
- If the preset has any ITEM-scoped steps,
--root_diris required and files are discovered withdiscover_inputs(...). - If there are only GLOBAL steps, discovery is skipped entirely.
- If the preset has any ITEM-scoped steps,
- Build a run manifest skeleton (preset name, inputs, vars, globals).
- Create a single
Taters()instance (shared across all steps in the run). - Execute each step in order:
- ITEM steps: fan out across discovered inputs using a thread or process pool (configurable per step). A given step reuses one pool for all items to amortize worker startup.
- GLOBAL steps: run once, in order, with a barrier between steps.
- After each step, update and persist the JSON manifest so long-running runs are observable and resumable.
- Print the final manifest path on completion.
Concurrency Notes
- The default executor for ITEM steps is a
ThreadPoolExecutor(good for I/O-bound steps and for GPU inference that releases the GIL). - For heavy Python/CPU work, presets may set
engine: processon a step to use aProcessPoolExecutor. In that case, be mindful that a new Python process is spawned for each worker (model weights may be reloaded once per worker).
Error Handling
- Individual ITEM step failures do not crash the pipeline; they mark that
item as
"error"in the manifest and continue. - GLOBAL step failures are terminal for the run (the loop breaks), and the manifest is written before bailing out.
- The process exits with status 1 if anything failed — a global error or any individual item — and 0 only when every step succeeded.
Returns:
| Type | Description |
|---|---|
None
|
The function exits the process after writing the manifest. |
Source code in src\taters\pipelines\run_pipeline.py
1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 | |
merge_vars ¶
merge_vars(base, overlay)
Shallow-merge two variable dictionaries.
Later sources of variables (e.g., --vars-file, then repeated --var
overrides) should replace keys from earlier sources. This helper
applies a simple dict.update(...) and returns a new dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base
|
dict
|
The starting dictionary of variables. |
required |
overlay
|
dict
|
The dictionary whose keys override entries in |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A new dictionary with merged keys/values. |
Source code in src\taters\pipelines\run_pipeline.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
parse_var_overrides ¶
parse_var_overrides(pairs)
Parse --var key=value CLI overrides into typed Python values.
Typing rules: - "true"/"false" (case-insensitive) → bool - "null"/"none" (case-insensitive) → None - integer or float strings → numeric - all else → raw string
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
List[str]
|
CLI arguments of the form |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Mapping from variable name to parsed value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any entry does not contain an '=' separator. |
Source code in src\taters\pipelines\run_pipeline.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | |
render_value ¶
render_value(
val, *, item_ctx, globals_ctx, vars_ctx, input_path
)
Render templating expressions within a value (str, list, or dict).
Behavior
- Dicts/lists/tuples: render recursively.
- If a string is exactly one template token (e.g., "{{var:text_cols}}"), return the native value of that expression (list, int, bool, ...).
- Otherwise, perform string substitution for every {{...}} occurrence and return the resulting string.
Resolution rules (summary)
- {{input}} / {{cwd}}
- {{var:key}}
- {{global.path}} (explicit globals)
- {{pick:name.path}} → search item, then globals
- {{name}} → bare name; search item, then globals
Source code in src\taters\pipelines\run_pipeline.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | |
resolve_call ¶
resolve_call(call_name, potato)
Resolve a call target from a preset step into an actual callable.
Supported forms
1) Taters instance methods (recommended):
- "potato.audio.convert_to_wav"
- "potato.text.analyze_with_dictionaries"
The function is resolved via attribute chaining on a single
Taters() instance created for the whole run.
2) Dotted import paths:
- "package.module:function"
- "package.module.func"
- "package.module.Class.method"
The target is imported and attributes are resolved. The final target
must be callable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
call_name
|
str
|
Call string from the preset step's |
required |
potato
|
Taters
|
The shared |
required |
Returns:
| Type | Description |
|---|---|
Callable
|
The function/object that will be invoked for the step. |
Raises:
| Type | Description |
|---|---|
(AttributeError, KeyError, TypeError)
|
If the target cannot be resolved or is not callable. |
Source code in src\taters\pipelines\run_pipeline.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | |
resolve_preset_path ¶
resolve_preset_path(name)
Find a preset file by its meta.id or filename stem.
Searches every directory returned by _get_preset_dirs() — the built-in
taters/pipelines/presets/ folder first, then ./pipelines relative to the
current working directory — so anything shown by --list-presets can also
be loaded with --preset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Preset |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the matching preset file. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no preset matches, listing the presets that are available. |
Source code in src\taters\pipelines\run_pipeline.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
run_global_step ¶
run_global_step(
*,
step,
potato,
globals_ctx,
vars_ctx,
manifest_path,
on_progress=None,
quiet=False,
workers=None
)
Execute a single GLOBAL-scoped step (runs once per pipeline).
Differences from ITEM steps
- The templating
item_ctxis empty. - The run manifest path is injected into
varsasrun_manifest, so presets can reference it in GLOBAL stages. - On success, any values from
save_as:are merged into theglobalsartifact map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict
|
The step definition block from the preset. |
required |
potato
|
Taters
|
Shared Taters instance used to call |
required |
globals_ctx
|
Dict[str, Any]
|
Accumulated global artifacts (readable by later steps). |
required |
vars_ctx
|
Dict[str, Any]
|
Merged variables. |
required |
manifest_path
|
Path
|
Path where the JSON run manifest is (or will be) saved. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[str, Dict[str, Any], Dict[str, Any]]
|
A tuple |
Source code in src\taters\pipelines\run_pipeline.py
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
run_item_step_for_one_input ¶
run_item_step_for_one_input(
*,
step,
input_path,
potato,
item_artifacts,
globals_ctx,
vars_ctx,
on_progress=None,
quiet=False
)
Execute a single ITEM-scoped step for one input path.
Lifecycle
1) Template the step's with: parameters using render_value(...).
2) Validate any require: keys after templating (fail fast if missing).
3) Resolve the callable (Taters method or import path).
4) Invoke with keyword arguments.
5) If the step specified save_as: <name>, store the return value under
that name in the item's artifacts dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
dict
|
The step definition block from the preset. |
required |
input_path
|
Path
|
The current input file for ITEM scope. |
required |
potato
|
Taters
|
Shared Taters instance used to call |
required |
item_artifacts
|
Dict[str, Any]
|
The current item's artifact dictionary (mutated across steps). |
required |
globals_ctx
|
Dict[str, Any]
|
Global artifacts (from GLOBAL steps). |
required |
vars_ctx
|
Dict[str, Any]
|
Merged variables. |
required |
on_progress
|
callable
|
Progress sink for this file, passed on to the step function when it declares one. An ITEM step is counted from outside -- files finished out of files found -- but that says nothing while a single file is running, and transcription is routinely minutes per file. Without this a stalled step and a working one look identical until the first file lands. |
None
|
quiet
|
bool
|
Suppress the step function's own printing. See
:func: |
False
|
Returns:
| Type | Description |
|---|---|
Tuple[str, Dict[str, Any], Dict[str, Any]]
|
A tuple |
Source code in src\taters\pipelines\run_pipeline.py
783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | |
run_preset ¶
run_preset(
preset,
*,
root_dir=None,
file_type="any",
vars_ctx=None,
workers=None,
out_manifest=None,
preset_name=None,
on_event=None,
verbose=True,
work_dir=None,
command=None,
run_log=None
)
Run a loaded preset and return its manifest.
This is the engine main() wraps. It is separate so that callers other
than the command line -- the setup wizard in :mod:taters.ui.wizard, and
anything else that already holds a preset dict -- can run a pipeline
without building an argv and without the process exiting underneath them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preset
|
dict
|
A loaded preset: |
required |
root_dir
|
Path | str | None
|
Folder to scan for inputs. Required when the preset has any ITEM-scoped steps; ignored when it does not. |
None
|
file_type
|
('audio', 'video', 'any')
|
Extension filter for discovery. |
"audio","video","any"
|
vars_ctx
|
dict
|
The variable context, already merged. When omitted, the preset's own
|
None
|
workers
|
int
|
Default concurrency for ITEM steps. A step's own |
4
|
out_manifest
|
Path | str | None
|
Where to write the run manifest. Defaults to |
None
|
preset_name
|
str
|
Recorded in the manifest for provenance. |
None
|
on_event
|
callable
|
Called as |
None
|
verbose
|
bool
|
Print progress to stdout. Set False when |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
The run manifest. Check |
Source code in src\taters\pipelines\run_pipeline.py
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | |
summarize_manifest ¶
summarize_manifest(manifest, *, verbose=True)
Report on a finished run and say whether it was clean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manifest
|
dict
|
As returned by :func: |
required |
verbose
|
bool
|
Print the summary. When False, only the return value is produced. |
True
|
Returns:
| Type | Description |
|---|---|
bool
|
True when every item succeeded and no global step failed. |
Source code in src\taters\pipelines\run_pipeline.py
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | |