Launching TestFlows Machine: self-service deterministic simulation testing environment Read the post

Sessions

Runs execute in a session, and you create one with machine sessions create. Pick its size when you create it.

1
machine sessions create ci-1 --cpus 2 --mem 4G

--cpus sets the number of vCPUs, --mem the memory and --storage the disk space. Your plan caps each session: 2 vCPUs, 4G of memory and 32G of disk on Free, 4 vCPUs, 8G and 128G on Starter and on Free with usage credits, 6 vCPUs, 12G and 192G on Plus, and 8 vCPUs, 16G and 256G on Pro. A hardware class can give a session less than the plan allows, and the smaller of the two applies. Your plan also limits the vCPUs your sessions hold together: 4 on Free, 8 on Starter and on Free with usage credits, 12 on Plus and 24 on Pro. A session counts the vCPUs it is charged for: 2 vCPUs with 8G of memory count 4. machine account show shows how many are in use.

--class picks the hardware class, and the default comes from your plan. machine sessions classes lists the classes, with the region and the CPU architecture of each. A session runs in its class’s region, and its runs are stored there. Prefer standard-ip; standard-ie costs less. A run starts only in a session with the same CPU architecture as the session it was recorded in.

dedicated-ip runs each vCPU on a core of its own. It is available from the Starter plan up, and on Free with usage credits. For software that needs stronger isolation, use dedicated-ip, or write to sales@testflows.com to have machines reserved for your team, in our cloud or for your infrastructure.

1
2
machine sessions classes
machine sessions create ci-1 --class standard-ie

The name is optional. If you leave it off, Machine generates one. Machine waits until the session is running and tells you when it is. Add --no-wait to return once the request is accepted.

Then Machine uses the new session in this terminal, so your next command goes to it. Add --no-use to keep using the session you are on. A session created with --no-wait is not running yet, so it is not used.

Your first session also sets up your account’s storage, so it takes longer to create, and Machine shows this as a step of its own. To set the storage up before that, run machine account provision.

Each machine takes its own memory plus 128MB from the session’s memory, and 256MB of every session is not available to machines. A machine with the default 256MB needs 384MB, and one created with --mem 2048 needs 2176MB, so a 4G session holds one and an 8G session holds three. A machine holds its memory until you stop it, whether or not its program has finished.

A branch you switch onto with machine go uses the machine that is already running, so it needs no more memory. A branch you start with machine fork is another machine and needs its own.

machine runs --size adds three columns for what a run takes of the session’s resources. RAM is the session memory its machine holds right now. It can be above the machine’s own MEMORY. DATA is what the run holds on the session’s disk. STORAGE is the state of that data, such as in use or not synced. A run with no machine shows — for RAM. A run in another session shows — for RAM and DATA.

The MEM column of machine sessions list shows the memory in use out of the session’s memory, for example 4.5G/8G with two machines of 2048MB. A new machine starts when what it needs fits in the rest, and is refused when it does not.

To switch to another session, tell Machine which one to use.

1
machine sessions use ci-1

machine sessions use applies to the terminal you ran it in. After that, every command in that terminal that needs a machine goes to ci-1. If you have only one session, you can leave out its name. You can send one command somewhere else with -s, for example machine -s ci-2 runs. -s goes before the command.

In a script, name the session once with TESTFLOWS_MACHINE_SESSION, and every command after it goes to that session.

1
2
3
export TESTFLOWS_MACHINE_SESSION=ci-1
machine sessions use ci-1
machine create --disk hello

The variable names the session. machine sessions use connects this computer to it, and is needed once. A tool that starts a new shell for each command, as an AI agent does, loses the export between commands. In that case, put -s ci-1 on each command. Commands that need no session, such as machine disks list, ignore the variable.

You manage the rest of your sessions like this:

1
2
3
4
machine sessions list
machine sessions show ci-1
machine sessions rename ci-1 ci-2
machine sessions delete ci-2

✋ A session costs from the moment you create it, whether or not anything is running in it. Delete sessions you are not using.

Idle sessions stop

A session is idle while it serves no command. Your plan sets its idle time: 10 minutes on Free, 30 on Starter and on Free with usage credits, 45 on Plus, and 60 on Pro. machine account show shows yours. When a session reaches its idle time, it stops, and so do its runs. The runs are kept. Start one again in any session with machine start <run>.

Every command sent to the session resets the idle time, from any terminal, the SDK or the control prompt. To step away without the session stopping, keep it with machine sessions keep:

1
machine sessions keep ci-1 30m

A keep lets the session stay idle without stopping for up to 30 minutes on Free, and up to an hour on Starter, Free with usage credits, Plus and Pro.

machine sessions list shows under IDLE how long each session has gone without a command, and machine sessions show shows when the session stops. machine sessions list --all also lists the sessions that stopped. One that stopped idle is listed as stopped idle, with the idle time it reached under IDLE. In the control prompt, /keep 30m keeps the session you are driving, and the line under the clock shows the time left.

From Python, client.sessions does the same: create, use, show, keep and delete. A session is a context manager, so a with block deletes it at the end. The SDK’s Sessions has the calls.

When the service does not answer

A command that cannot reach the service, or that the service refuses as unavailable, ends with a hint to the status page, status.testflows.com. The page shows whether the website, the API, sign-in and sessions on each class work now. It also lists open incidents, the incidents of the last 14 days and any planned maintenance. If every component is operational, check your network. If your network works, contact support.