damast.core.watch

damast.core.watch#

Module to watch directories and trigger file processors

A WatchConfig defines one or more jobs, where a job does the following: 1. scans a source directory for files matching a pattern, 2. considers a file “ready” once it has not been modified for a configurable quiet period, and 3. then runs a job-specific command on it.

The command is a plain argv list (no shell) with placeholders for the ready file and the job’s output directory. On success the source file is moved into the job’s processed_dir, on failure into its failed_dir alongside an error log.

This module intentionally has no notion of specific file types, conversions, or pipelines - the configured command owns that, e.g., typically invoking damast convert/damast process.

Classes

WatchConfig(*, jobs)

A watch config: the WatchJob s declared in a watch config YAML file.

WatchJob(*, name, source_dir, command, ...)

A single watch job: a source directory to scan and the command to run on ready files.

WatchResult(*, processed, failed, not_ready, ...)

Outcome of a single watch cycle for one job.