Long runs
By default a run must finish within 30 seconds, and whoever starts it
waits for the result. For reports, data syncs and batch jobs, give the
script a longer timeout, in seconds, in reminix.json. Here, a sync
that copies a day’s orders from the shop to the warehouse:
{ "slug": "nightly-sync", "name": "Nightly sync", "command": "python sync.py [--date {date}]", "timeout": 600, "hosts": ["api.shop.example", "api.warehouse.example"], "inputSchema": { "type": "object", "properties": { "date": { "type": "string", "title": "Day (YYYY-MM-DD)" } } }}Long runs are part of the Team and Business plans. A long run lasts at
most the version’s timeout or the plan’s longest run, whichever is
shorter: 10 minutes on Team, 15 on Business. Its minutes count toward
the plan’s long-run minutes for the month (1,000 on Team, 10,000 on
Business). See Plan allowances.
What changes
Section titled “What changes”It answers at once. Starting a run returns 202 with the run, its
status running. In the app you land on the run’s page. The command
line (reminix run) follows it to the end. An agent gets
the run’s id and reads it later (runs.get).
You can see it working. The run’s page shows its log, which is
what the script writes to standard error, as it grows. A line that
starts with ::progress, then a percentage and a message, moves the
progress bar instead:
import json, sys
pages = list_order_pages() # your code, reading api.shop.examplefor i, page in enumerate(pages, 1): copy_page(page) # your code, writing to api.warehouse.example print(f"copied page {i}", file=sys.stderr) print(f"::progress {i * 100 // len(pages)} Page {i} of {len(pages)}", file=sys.stderr, flush=True)print(json.dumps({"pages": len(pages)}))From your code, the run (reminix.runs.get(runId)) has progress and
progressMessage, and reminix runs logs <run-id> prints the log so
far.
You can stop it. Use Cancel run on its page, or
reminix runs cancel <run-id>. Whoever
started it, the script’s owner, and workspace owners and admins can
cancel. Reminix stops the command and destroys its machine, and the run
ends cancelled.
Good to know
Section titled “Good to know”- A long run executes at most once. It’s never retried automatically, because a retry could repeat what it did, such as sending an email. If it stops unexpectedly, it’s marked failed: interrupted.
- It runs on the same machine as any run: 1/4 of a CPU, 1 GB of memory and 4 GB of disk.
- A workspace runs at most 10 long runs at once. Reminix refuses the 11th with
429 rate_limiteduntil one finishes. ItsRetry-Afterheader says when to try again: 30 seconds, since nobody knows when a run will end. - Everything else works as for any run: the network rules, secrets,
approvals, schedules and triggers, test runs of drafts, and the
run.completedandrun.failedevents, sent when it ends.