A test run is the fast inner loop: it runs your current code, unsaved, on a short window of a real recording, in the same runtime a workflow step uses. It saves nothing, so run it as often as you like.
What a test run uses
| Setting | What it means |
|---|---|
| Project and Recording | Any processed recording you can read. The panel says how much the test downloads, for example "Downloads 7.7 MB of 1.2 GB for the test". A recording that is not processed yet, or too large, is marked and can't be picked. Recordings that share a name show their upload time after the name. |
| Window | First 30 seconds by default; the menu also offers other lengths and Whole recording. An episode-level algorithm offers First 3 episodes instead. |
| Time | Your code gets 120 seconds. A GPU test may first wait for GPU memory. |
| Network | None. Code that downloads files works in a workflow step but not in a test. |
| At once | A few test runs per team at a time; more are refused with Too many runs at once and nothing runs. |
An algorithm that reads the uploaded files (a standardize algorithm, or a check that reads raw files) always gets the whole upload, because raw files have no time axis.
When you change the code, the parameters, the recording or the window after a run, the panel keeps the old output and says so, for example "The code changed since this run. The output below is from the earlier code." Choose Run again.
Read a result
A run ends in one of three ways:
| Panel says | Meaning |
|---|---|
| The run succeeded. | Your code ran and wrote its outputs. The preview shows them: a chart of per-frame features, a table of checks, episodes on a timeline, kept and dropped episodes, or the exported files, depending on the category. |
| Not applicable to this sample. | Your code decided the recording doesn't apply, for example it has no camera of the kind it needs. Not applicable is not a pass. |
| The run failed. | The panel names the failure. See below. |
Whatever your code prints with print() appears at the end of the result: under Logs when the run produced a result, and under Last lines of the log when it failed. Printing is the quickest way to look at your data, for example the cameras of the recording: print([cam.role for cam in recording.cameras]). Read a recording and write features lists what you can read.
Read a failure
A failed run shows the failure's code, a sentence on what to do, a link to the line of main.py that raised it, and the last lines of the log, including your own print output.
- Every failure has a name you can look up.
- Jump to the line that failed.
- The last lines your code printed, and the traceback.
| Code | What happened | What to do |
|---|---|---|
ALGORITHM_UNHANDLED_EXCEPTION | Your code raised an exception, or called sys.exit(n) with a status that is not 0, 85, 87 or 88 (shown as SystemExit: n). | Read the traceback in the log, go to the line, fix it and run again. |
ALGORITHM_SAMPLE_RUN_ALGORITHM_FAILED | The run ended with an error from your algorithm. | Read the message, then the last lines of the log. |
ALGORITHM_SAMPLE_RUN_TIMED_OUT | Your code ran out of time (120 s). | Use a shorter window, or load models and files once in setup() instead of for every frame. |
ALGORITHM_SAMPLE_RUN_EXIT_NONZERO | The container stopped with a non-zero status before your code could write a result, for example because it was killed. | Exit code 137 usually means out of memory: use a shorter window, or ask for more memory in resources. |
ALGORITHM_SAMPLE_RUN_RESULT_MISSING | The run ended without its output. | Make sure run() returns normally after writing with out. |
ALGORITHM_SAMPLE_RUN_INPUT_TOO_LARGE | The sample is over the test-run size limit. | Choose a shorter window or a smaller recording. |
ALGORITHM_SAMPLE_RUN_BUILD_FAILED | Installing the packages failed. | See Python packages. |
ALGORITHM_SAMPLE_RUN_QUEUE_TIMED_OUT | The run waited too long for a free slot. | Run it again in a moment. |
Some runs are refused before anything starts, with a title and a reason: The code has problems (fix the marked lines), A parameter value is not valid, This deployment has no GPU, Test runs are not available yet, or Too many runs at once. A refusal never counts against you; fix the cause and run again. Every code is in Troubleshooting.
Test from the terminal
The CLI runs the same loop on your machine. Install it from Install the CLI and Python SDK; ef is the short name of embodiflow, and both work.
| Command | What it does |
|---|---|
ef algorithm test <dir> | Runs the folder's test_main.py with Python on this machine, no Docker. |
ef algorithm test <dir> --recording <id> | Downloads that recording once and runs your code on its first 30 seconds; --window 60s, --window 2m or --window all changes the window. The output goes to .ef/runs/<utc time> in the algorithm folder, printed on the Output: line, or in the outputDir field when the output is JSON. |
ef algorithm dev <dir> --recording <id> | Runs again every time you save main.py; --cloud also runs the draft in the cloud. |
ef algorithm try <dir> --recording <id> | Runs the draft in the cloud, exactly as a test run in the console; its --window takes up to 600 seconds, or all. Nothing is saved. --project <team/project> first checks that the recording is in that project and processed. |
ef algorithm test exits with 0 when the test passed, 1 when it ran but did not pass (a failure, or not applicable), and 2 when nothing ran, so you can use it in CI. In a terminal the CLI prints text; when its output goes to a pipe or a file it prints JSON, and --output table forces text.
Unit tests without a recording
ef algorithm init writes a test_main.py next to main.py. It builds a small synthetic recording and checks the values your code writes, so it runs in a second and never needs your data. Keep it in git and add a case for every bug you fix.