Skip to content

Latest commit

 

History

History
121 lines (96 loc) · 4.45 KB

File metadata and controls

121 lines (96 loc) · 4.45 KB

REPL Command Reference

The REPL uses hierarchical commands grouped by function. Use ? after any command group to see its subcommands.

Starting the REPL

python -m dw.repl
python -m dw.repl -l DEBUG              # with debug logging
python -m dw.repl --trust-workflows     # only for workflow files you trust - see docs/SECURITY.md

A workflow JSON file can execute arbitrary Python (pre_load_modules, dotted *_type/config_type values). --trust-workflows is off by default for the whole session; workflow load/workflow run on a workflow that needs it without the flag fails with a clear error. See Trust model.

Commands

workflow — Manage and run workflows

workflow list            List workflows under the workflow directory
workflow load <file>     Load a workflow from JSON file
workflow reload          Reload current workflow from disk
workflow status          Show current workflow information
workflow run             Execute the currently loaded workflow
workflow run <n>=<v> ... Set arguments and run in one line
workflow run ask <arg>   Prompt for one argument's value, then run
workflow restart         Restart the worker process (clears GPU cache)

workflow load resolves names against the workflow directory (./workflows by default), including subfolders - workflow load models/flux-dev loads workflows/models/flux-dev.json. workflow list shows the available names.

workflow run ask <arg> prompts you interactively for <arg>'s value (the value is not saved to shell/readline history) before running — a shortcut for arg set followed by workflow run.

arg — Set workflow variables

arg show                Show available variables and current values
arg set <name>=<value>  Set a variable value
arg clear [<name>]      Clear one variable, or all of them

memory — Monitor GPU memory

memory show             Show current GPU memory usage
memory clear            Clear GPU memory, cached models, and cached step results

Step caching keeps each step's last Result in RAM for the life of the worker process so a rerun with unchanged inputs can skip straight to it - this trades some memory for speed, and holding it works against the normal end-of-step release that frees a result once no later step needs it. The cache is bounded to the 50 most recently used steps, and evicts the least recently used one beyond that; memory clear is the escape hatch: it drops every cached step result along with the GPU/model caches.

Caching is not REPL-only - it applies to any Workflow.run in the process, including a job the server runs. Re-running a fixed-seed workflow whose inputs did not change therefore completes almost instantly and produces no new gallery entry, because the previous run's files are reused. A cache entry is discarded if any of the files it names has been deleted since, so a deleted output is regenerated rather than reported again from cache. A workflow that names no seed draws a fresh one every run, so nothing it does can hit - the cache is skipped entirely for it. A reused step's manifest entry and its step_end event carry "reused": true, which is how the server keeps a file credited to the job that actually wrote it rather than to every later run that reused it. Cache entries are keyed by the workflow's id, so renaming or copying a workflow to a new id is a full cache miss.

config — REPL settings

config show                   Show all settings
config set output_dir=<path>  Change output directory
config set log_level=DEBUG    Change log level
config set workflow_dir=<path> Change default workflow directory

General

help / ?     Show all commands
exit / quit  Exit the REPL

run, load, and set also work at the top level as shortcuts for workflow run, workflow load, and arg set.

Ctrl+C during a run cancels it cooperatively and keeps the worker's models cached; a second Ctrl+C stops the worker process itself.

Typical Session

dw> workflow load models/flux-dev
dw> arg show
dw> arg set prompt="a majestic mountain landscape"
dw> workflow run
dw> arg set prompt="a serene beach at sunset"
dw> workflow run
dw> memory show
dw> exit

Quick Reference

workflow ── list | load <file> | reload | status | run [<n>=<v> ... | ask <arg>] | restart
arg      ── show | set <name>=<value> | clear [<name>]
memory   ── show | clear
config   ── show | set <name>=<value>