I'm using spark java API to submit a driver to a local Spark cluster (1 master + 1 worker). After calling startApplication with a Listener attached, the first call to stateChanged gives the LOST state.
The Driver is submitted OK and runs fine in the worker.
I've tried with a waiting loop instead of a Listener.
I've tried with Spark versions 2.3.1 and 2.4.3.
I've tried in OSX and Ubuntu.
I've tried changing the Spark Master Host to the machine's IP instead of the name.
SparkLauncher launcher = new SparkLauncher(env)
.setAppResource(path)
.setMainClass("full.package.name.RTADriver")
.setMaster("spark://" + sparkMasterHost + ":" + sparkMasterPort)
.setAppName("rta_scala_app_")
.setDeployMode("cluster")
.setConf("spark.ui.enabled", "true")
.addAppArgs(runnerStr)
.setVerbose(true);
SparkAppHandle handle = launcher.startApplication();
while (!handle.getState().equals(SparkAppHandle.State.FINISHED)){
System.out.println("Wait Loop: App_ID: " + handle.getAppId() + " state: " + handle.getState());
Thread.sleep(10000);
}
Logs of the System.out on my code:
First State App_ID: null state: UNKNOWN
Wait Loop: App_ID: null state: UNKNOWN
Wait Loop: App_ID: null state: LOST
Wait Loop: App_ID: null state: LOST
...
Important spark submit logs:
INFO: 19/06/04 11:27:54 INFO Utils: Successfully started service 'driverClient' on port 52077.
INFO: 19/06/04 11:27:54 INFO TransportClientFactory: Successfully created connection to /10.10.0.179:7077 after 34 ms (0 ms spent in bootstraps)
INFO: 19/06/04 11:27:54 INFO ClientEndpoint: Driver successfully submitted as driver-20190604112754-0030
INFO: 19/06/04 11:27:54 INFO ClientEndpoint: ... waiting before polling master for driver state
INFO: 19/06/04 11:27:59 INFO ClientEndpoint: ... polling master for driver state
INFO: 19/06/04 11:27:59 INFO ClientEndpoint: State of driver-20190604112754-0030 is RUNNING
INFO: 19/06/04 11:27:59 INFO ClientEndpoint: Driver running on 10.10.0.179:49705 (worker-20190603154544-10.10.0.179-49705)
INFO: 19/06/04 11:27:59 INFO ShutdownHookManager: Shutdown hook called
INFO: 19/06/04 11:27:59 INFO ShutdownHookManager: Deleting directory /private/var/folders/90/pgndgkk11lj0qb4q5qw_f03c0000gn/T/spark-8d8d92b9-8d0c-43a1-8bb9-3d08f1519c53
Wait Loop: App_ID: null state: LOST
...