I am following Livy programmatic API page https://livy.incubator.apache.org/docs/latest/programmatic-api.html to submit a job to existing session.
String clientURL = String.format("http://%s:%s/sessions/%s", ip, port, session);
System.out.println(clientURL);
LivyClient client = new LivyClientBuilder()
.setURI(new URI(clientURL))
.build();
client.submit(new MyJob(index, query))
The clientURL is http://myip:8998/sessions/1
But my code fails with stacktrace:
Failed to handleRequest java.lang.RuntimeException: java.io.IOException: Not Found: {"msg":"Session '1' not found."}java.lang.RuntimeException: java.io.IOException: Not Found: {"msg":"Session '1' not found."}
at org.apache.livy.client.http.HttpClient.propagate(HttpClient.java:182)
at org.apache.livy.client.http.HttpClient.<init>(HttpClient.java:82)
at org.apache.livy.client.http.HttpClientFactory.createClient(HttpClientFactory.java:37)
at org.apache.livy.LivyClientBuilder.build(LivyClientBuilder.java:142)
I read your livy code, I am quite confused by this code line 73. Why it calls
conn.post(null, SessionInfo.class, "/%d/connect", sessionId);
What is this connect endpoint?
My session was created by very easy python code from lambda. I even post 1 simple statement after it so I know the session was created.
host = 'http://{0}:8998'.format(ip)
data = {'kind': 'pyspark', 'numExecutors': 200,
'conf':
{
'spark.submit.deployMode':'client',
'spark.driver.memory': '10g',
'spark.executor.memory': '2g',
'spark.executor.cores': '2'}}
headers = {'Content-Type': 'application/json'}
r = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
I can not find this connect endpoint from anywhere https://livy.incubator.apache.org/docs/latest/rest-api.html.