Skip to content

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 timeoutSeconds in reminix.json. Here is 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}]",
"timeoutSeconds": 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 Pro and Business plans. A long run can last up to its version’s timeoutSeconds. The plan caps that at 10 minutes on Pro and 15 on Business. Its minutes count toward the plan’s long-run minutes for the month. Pro includes 1,000 long-run minutes a month, and Business 10,000. See Plan limits.

It returns right away. Starting a long run returns 202 with the run in status running. In the app, you land on the run’s page. The CLI (reminix run) follows the run to the end. An agent gets the run’s id and reads it later with runs.get.

You can see it working. The run’s page shows its log as it grows. The log is what the script writes to standard error. 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.example
for 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, reminix.runs.get(runId) returns the run with its progress and progressMessage. reminix runs log <run-id> prints the log so far.

You can cancel it. Use Cancel run on its page, or reminix runs cancel <run-id>. The person who started the run, the script’s owner, or a workspace owner or admin can cancel it. Reminix stops the command and destroys its machine, and the run ends cancelled.

  • A long run executes at most once. Reminix never retries it on its own, because a retry could repeat what the script did, such as sending an email. If something interrupts a long run, it ends Failed, and its error says so.
  • A long run gets the same machine as any run: 1/4 of a CPU, 1 GB of memory and 4 GB of disk.
  • A long run starts only if the month’s remaining long-run minutes cover its whole timeout. Reminix sets those minutes aside when the run starts, and gives back what it didn’t use when the run ends. A 15-minute script needs 15 minutes left, even if it usually takes two.
  • A workspace can have at most 2 long runs in progress at once on Pro, and 5 on Business. They also count toward the plan’s runs at once. Reminix refuses the next long run with 429 rate_limited until one finishes. Its Retry-After header suggests about 30 seconds, because there’s no way to know when a run will end.
  • Everything else works as it does for any run: the network rules, secrets, approvals, schedules and triggers, and test runs of drafts. Reminix sends the run.succeeded, run.failed or run.cancelled event when a long run ends.