How to re-flash core when in manual mode

The thing is, that Spark.connect() - which you’d need to connect to the cloud - is a blocking call.

But there are several threads dealing with interrupt driven Spark.disconnect(), to solve this - e.g. by using SparkIntervalTimer library.