Cloud Spot Instances
Running Playwright E2E tests on CI Spot Instances and using Currents Orchestration to automatically rerouting tests before an eviction.
Last updated
Was this helpful?
Running Playwright E2E tests on CI Spot Instances and using Currents Orchestration to automatically rerouting tests before an eviction.
Last updated
Was this helpful?
An additional benefit of using Currents for balancing tests is the ability to automatically redrive tests from one machine to another.
Many cloud providers have an option to use for running workloads. Using Spot Instances can cost up to 90% lower, compared to the traditionally allocated resources.
However, spot instances can be terminated at any time, which can cause the loss of the test results.
Currents Orchestration can automatically reassign the tests from to-be-terminated instance to another machine. This way, the execution can continue without manual intervention.
Imagine a scenario when you have two machines running a testing suite consisting of two spec files.
Machine A - running specA
Machine B - running specB
When a spot instance is just about to be terminated (let's say Machine A), Currents will identify the affected spec files and reassign them a different machine.
Starting from version 1.3.0
of @currents/playwright
set --pwc-reset-signal
CLI parameter:
When specified, pwc-p
starts listening to POSIX signal (SIGUSR1
or SIGUSR2
). After receiving the signal, it send a request to Currents servers to reassign the affected tests to healthy machines. Currents updates the run status accordingly.
An example output you're expected to see upon termination:
It is your responsibility to capture the eviction notice, detect the PID and send the signal to pwc-p
process before an eviction.
usr1
normally activates the Node.js debugger, but this ability is disabled when we listen on usr1
usr2
normally treated as a exit in Node.js, so if you pass it WITHOUT turning on our listener, you will immediately kill the process
You must send the signal to pwc-p
process - not the npx or wrapper process. The parent process will behave as noted above and not pass the signal down to our process.
Refer to the following documentation for capturing the eviction notice for various cloud providers: