This guide provides practical recipes for implementing common patterns in xyOps, from continuous jobs to complex workflow pipelines.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pixlcore/xyops/llms.txt
Use this file to discover all available pages before exploring further.
Continuous Jobs
A continuous job automatically relaunches itself upon completion, enabling efficient and reliable job execution.Implement Error Handling
If the job fails, create a separate error handler that can:
- Notify responsible parties about the failure
- Restart the job if necessary
By following these guidelines, you can create a robust continuous job system that manages execution efficiently and handles errors gracefully.
Nightly S3 Backup Workflow
Back up databases and files to Amazon S3 on a fixed schedule with optional retention and notifications.How It Works
Trigger Configuration
Trigger Configuration
Add a
schedule trigger for 01:00 in your timezone, and enable catchup so missed runs replay after outages.Workflow Setup
Workflow Setup
Use a workflow to multiplex the job across multiple DB servers:
- Multiplex Controller: Attach a job node to run on a group of servers (e.g., “Database” group)
- Use the “stagger” option to spread jobs out, or use Max Concurrent Jobs and Max Queue Limit to run in series
- Job Node 1: Shell Plugin to create backups on each target DB server
- Examples:
pg_dumpormysqldump, plustarandgzipfor directories - Add files to output:
echo '{"xy":1, "code":0, "files":["*.tgz"]}'
- Examples:
- Job Node 2: Upload all input files to S3 (wire via “continue” condition)
- Target a server with outbound network access
Limits & Notifications
Limits & Notifications
- Add Max Run Time and Max CPU Limit to the backup job
- Add Max Concurrent Jobs limit to avoid overlapping runs
- Add Web Hook or Email action on
errorandcriticalwith links to the job
Video Transcoding Pipeline with ffmpeg
Transcode incoming videos to MP4 H.264 and push outputs to storage and a CDN. Supports parallel processing with progress feedback.How It Works
Entry: Manual trigger for ad hoc batches or a custom trigger plugin that watches an S3 bucket for new file arrivals. Workflow Graph:Transcode Job
Shell Plugin runs
ffmpeg with a standard preset, writes output to job temp dir, and prints periodic progressExample: Wrap ffmpeg and emit { "xy": 1, "progress": N } updates while parsing ffmpeg stderrAdd files to output: {"xy":1, "code":0, "files":["*.mp4"]}success, fire a Web Hook to your CDN cache purge endpoint. On error, send email or post to a channel.
- If you need per server fan out, target ffmpeg at a server group instead of a single server, and select “Round Robin” algo
- Tag successful jobs with
transcodedand wire atag:transcodedaction to trigger downstream publishing
PostgreSQL Metrics via Monitor Plugin
Collect PostgreSQL health metrics from the CLI and graph them, with alerts and automated remediation.How It Works
Monitor Plugin: Write a simple Monitor Plugin that runspsql and emits one numeric metric per minute. Point the monitor expression at the plugin output.
Examples of CLI queries that return a single number:
- Expression: Reference the plugin command output path such as
commands.pg_active_conns - Data Match: If your plugin returns a line of text, set a regex like
(\d+)to extract the number - Type: Choose
integerorsecondsdepending on the metric
- Active connections above 90 percent of
max_connectionsfor 5 minutes - Replication lag above 60 seconds for 3 minutes
vacuumdb during a maintenance window.
Sunrise and Sunset Trigger Plugin
Launch jobs at local sunrise and sunset with optional offsets. Useful for energy jobs, IoT device control, or time shifting heavy tasks to off-peak windows.How It Works
Trigger Plugin: Implement a scheduler plugin that calculates today’s sunrise and sunset for a configured latitude and longitude. The plugin runs once per minute, compares the current time in a configured timezone, and indicates a launch when a window is hit.- Recommended module for Node.js: SunCalc
lat, lon, timezone, sunrise_offset_sec, sunset_offset_sec, and optional launch selector (sunrise or sunset or both).
Workflow: Wire the plugin trigger node into a workflow that branches on which event fired:
- At sunrise: Run an HTTP Request Plugin that calls a home automation API to power down exterior lights and open blinds
- At sunset: Run a batch window starter that increases queue sizes or begins off-peak data processing
Daylight Savings Time
Run a job safely during the Daylight Savings Time changeover window without duplicates or missed runs.The Problem
During DST transitions, local clocks jump between 1:00 and 3:00 AM. Two effects occur in many regions:- Spring ahead: The clock skips from 1:59 to 3:00 AM. Any time between 2:00–2:59 AM does not exist that day.
- Fall back: The hour from 1:00–1:59 AM repeats twice. Times in that window occur twice.
The Solution
Use the Max Daily Limit feature to allow a maximum of one job completion per calendar day, then schedule two daily runs:Add Max Daily Limit
Set condition to “Complete” and max daily amount to “1”. This quietly blocks any second run after one job has completed that day.
- Normal days: The job runs at the desired time; the +1 hour run is silently blocked by the daily limit
- Spring ahead: The desired time may not exist (e.g., 2:30). The +1 hour run exists and executes; the daily limit still allows it because nothing ran yet
- Fall back: The desired time occurs twice; the first occurrence runs and completes, and both the repeated occurrence and the +1 hour run are blocked by the daily limit
Example Configuration
The following event configuration runs at 2:30 AM local time, with a safe second attempt at 3:30 AM: Schedule Trigger:- Hours:
2and3selected - Minutes:
30selected - Timezone: Set to yours
- Job Condition: “Complete”
- Max Daily Amount: 1
Manual runs skip the Max Daily Limit check by design. If you manually re-run the job on a changeover day, it can exceed the daily count.