When do Spark.functions run

At the end of loop() a bunch of other functions are called which maintain the connection to the cloud and handle things like Spark.Function(). Once that’s over loop() is called again. Make sense?