How detect the end of simulation ?

I would like execute an action when simulation is finished, ie when “Simulation finished.” is printed.
Is this possible ?

There’s been some discussions about such hooks recently on this mailing list, please search the archive.

The main Gatling class and script block until the Simulation is done, so you can easily write a wrapper class/script with your own logic.

In addling that in my simulation :

import io.gatling.core.action._

system.registerOnTermination({println(“FINISH !”)})

simply :slight_smile:

Ah ah ah, yeah, I hadn’t thought of this solution.

For those on this ML who need explanation: io.gatling.core.action.system is the Akka ActorSystem instance used by Gatling.
This class provides a way to register callbacks to be called when it will be terminated, and Gatling shut it down once the Simulation is done, before generating the reports.

Sadly, with a long processing, this processing is broken.
I think akka has a timeout.
I’ve put shutdown-timeout with large time in my akka.conf, but it doesn’t work.
I try all timeout too, but without success.

That makes sense: those hooks should prevent Akka from effectively shutting down.

In the same spirit, we can use scala sys :

println(“ANY POST ACTION”)

With this way, my post action isn’t broken.

Pointer here with my own protocol.