# 测试 livy ## code ```shell curl --request POST \ --url http://172.23.7.140:30998/sessions \ --header 'content-type: application/json' \ --data '{ "kind": "spark" }' | jq curl --request GET \ --url http://172.23.7.140:30998/sessions/0 \ --header 'content-type: application/json' \ --data '{ "kind": "spark" }' | jq curl -XPOST 'http://172.23.7.140:30998/sessions/0/statements' \ -H 'Content-Type: application/json' \ -d '{"code": "spark.range(1000 * 1000 * 1000).count()"}' | jq curl --request GET \ --url http://172.23.7.140:30998/sessions/0/statements/0 | jq ## pyspark curl --request POST \ --url http://10.138.143.16:8998/sessions \ --header 'content-type: application/json' \ --data '{ "kind": "pyspark" }' | jq # 查看session curl --request GET \ --url http://10.138.143.16:8998/sessions/0 \ --header 'content-type: application/json' \ --data '{ "kind": "pyspark" }' | jq # 提交任务 curl -XPOST 'http://10.138.143.16:8998/sessions/0/statements' \ -H 'Content-Type: application/json' \ -d '{"code": "sc.range(5).collect()"}' # 查看结果 curl --request GET \ --url http://10.138.143.16:8998/sessions/0/statements/0 | jq curl -X DELETE \ --url http://10.138.143.16:8998/sessions/0 | jq ```