Principle:173TECH Sayn Task Query Resolution
| Knowledge Sources | |
|---|---|
| Domains | CLI, Graph_Theory |
| Last Updated | 2026-10-17 00:00 GMT |
Overview
Technique for filtering a task execution graph through include/exclude operations with upstream and downstream dependency expansion, enabling selective task execution from the command line.
Description
Task query resolution allows users to execute a subset of the task DAG by specifying include (-t) and exclude (-x) selectors. Each selector can be:
- A task name:
-t load_users - A group selector:
-t group:sql_models - A tag selector:
-t tag:incremental - With upstream expansion:
-t load_users+(includes all ancestors) - With downstream expansion:
-t model_users-(includes all descendants)
This solves the problem of running only relevant tasks during development without modifying the project structure.
Usage
Use this principle when building a CLI for a task-based system where users need to selectively execute portions of a dependency graph. It is the right choice when tasks have complex interdependencies and users need fine-grained control over what runs.
Theoretical Basis
The query resolution algorithm:
- Parse the CLI query string into a list of operations (include/exclude)
- Sort operations: includes first, then excludes
- For each operation, expand the task name:
upstream=True: traverse parents recursivelydownstream=True: traverse children recursively
- Union (include) or subtract (exclude) the expanded set from the result
The group: and tag: prefixes expand to all tasks in that group or with that tag before applying upstream/downstream expansion.
Practical Guide
# Run only load_users and its upstream dependencies
sayn run -t load_users+
# Run all tasks in the "models" group
sayn run -t group:models
# Run all tasks tagged "incremental"
sayn run -t tag:incremental
# Run everything except test tasks
sayn run -x group:tests
# Combine: run models and their upstream, exclude raw_load tasks
sayn run -t group:models+ -x group:raw_load