README.rst 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. Welcome to Livy, the REST Spark Server
  2. ======================================
  3. Livy is an open source REST interface for interacting with Spark from anywhere. It supports executing snippets of code or programs in a Spark context that runs locally or in YARN.
  4. * Interactive Scala, Python and R shells
  5. * Batch submissions in Scala, Java, Python
  6. * Multi users can share the same server (impersonation support)
  7. * Can be used for submitting jobs from anywhere with REST
  8. * Does not require any code change to your programs
  9. The code is currently incubating in Hue but hopefully will eventually graduate in its top project. `Pull requests` are welcomed!
  10. Livy is used for powering the `Spark Notebook`_ of `Hue 3.8`_, which you can see the
  11. `implementation here`_.
  12. .. _Pull requests: https://github.com/cloudera/hue/pulls
  13. .. _Spark Notebook: http://gethue.com/new-notebook-application-for-spark-sql/
  14. .. _Hue 3.8: http://gethue.com/hue-3-8-with-an-oozie-editor-revamp-better-performances-improved-spark-ui-is-out/
  15. .. _implementation here: https://github.com/cloudera/hue/blob/master/apps/spark/src/spark/job_server_api.py
  16. Prerequisites
  17. =============
  18. To build/run Livy, you will need:
  19. Debian/Ubuntu:
  20. * mvn (from ``maven`` package or maven3 tarball)
  21. * openjdk-7-jdk (or Oracle Java7 jdk)
  22. * spark 1.4 from (from `Apache Spark tarball`_)
  23. * Python 2.6+
  24. * R 3.x
  25. Redhat/CentOS:
  26. * mvn (from ``maven`` package or maven3 tarball)
  27. * java-1.7.0-openjdk (or Oracle Java7 jdk)
  28. * spark 1.4 (from `Apache Spark tarball`_)
  29. * Python 2.6+
  30. * R 3.x
  31. MacOS:
  32. * Xcode command line tools
  33. * Oracle's JDK 1.7+
  34. * Maven (Homebrew)
  35. * apache-spark 1.4 (Homebrew)
  36. * Python 2.6+
  37. * R 3.x
  38. .. _Apache Spark Tarball: https://spark.apache.org/downloads.html
  39. Building Livy
  40. =============
  41. Livy is currently built by the `Hue Build System`_, it can also be built on
  42. it's own (aka without any other Hue dependency) with `Apache Maven`_. To build,
  43. run:
  44. .. code:: shell
  45. % cd $HUE_HOME/apps/spark/java
  46. % mvn -DskipTests clean package
  47. .. _Hue Build System: https://github.com/cloudera/hue/#getting-started
  48. .. _Apache Maven: http://maven.apache.org
  49. Running Tests
  50. =============
  51. In order to run the Livy Tests, first follow the instructions in `Building
  52. Livy`_. Then run:
  53. .. code:: shell
  54. % cd $HUE_HOME/apps/spark/java
  55. % export SPARK_HOME=/usr/lib/spark
  56. % mvn test
  57. Running Livy
  58. ============
  59. In order to run Livy with local sessions, start the server with:
  60. .. code:: shell
  61. % export SPARK_HOME=/usr/lib/spark
  62. % ./bin/livy-server
  63. Or with YARN sessions by running:
  64. .. code:: shell
  65. % env \
  66. LIVY_SERVER_JAVA_OPTS="-Dlivy.server.session.factory=yarn" \
  67. CLASSPATH=`hadoop classpath` \
  68. ./bin/livy-server
  69. Livy Configuration
  70. ==================
  71. The properties of the server can be modified by copying <https://github.com/cloudera/hue/blob/master/apps/spark/java/conf/livy-defaults.conf.tmpl>
  72. and renaming it ``livy-defaults.conf``.
  73. In particular the ``YARN mode`` (default is ``local`` process for development) can be set with:
  74. .. code:: shell
  75. livy.server.session.factory = yarn
  76. Spark Example
  77. =============
  78. Now to see it in action by interacting with it in Python with the `Requests`_
  79. library. By default livy runs on port 8998 (which can be changed with the
  80. ``livy_server_port config`` option). We’ll start off with a Spark session that
  81. takes Scala code:
  82. .. code:: python
  83. >>> import json, pprint, requests, textwrap
  84. >>> host = 'http://localhost:8998'
  85. >>> data = {'kind': 'spark'}
  86. >>> headers = {'Content-Type': 'application/json'}
  87. >>> r = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
  88. >>> r.json()
  89. {u'state': u'starting', u'id': 0, u’kind’: u’spark’}
  90. Once the session has completed starting up, it transitions to the idle state:
  91. .. code:: python
  92. >>> session_url = host + r.headers['location']
  93. >>> r = requests.get(session_url, headers=headers)
  94. >>> r.json()
  95. {u'state': u'idle', u'id': 0, u’kind’: u’spark’}
  96. Now we can execute Scala by passing in a simple JSON command:
  97. .. code:: python
  98. >>> statements_url = session_url + '/statements'
  99. >>> data = {'code': '1 + 1'}
  100. >>> r = requests.post(statements_url, data=json.dumps(data), headers=headers)
  101. >>> r.json()
  102. {u'output': None, u'state': u'running', u'id': 0}
  103. If a statement takes longer than a few milliseconds to execute, Livy returns
  104. early and provides a URL that can be polled until it is complete:
  105. .. code:: python
  106. >>> statement_url = host + r.headers['location']
  107. >>> r = requests.get(statement_url, headers=headers)
  108. >>> pprint.pprint(r.json())
  109. [{u'id': 0,
  110. u'output': {u'data': {u'text/plain': u'res0: Int = 2'},
  111. u'execution_count': 0,
  112. u'status': u'ok'},
  113. u'state': u'available'}]
  114. That was a pretty simple example. More interesting is using Spark to estimate
  115. PI. This is from the `Spark Examples`_:
  116. .. code:: python
  117. >>> data = {
  118. ... 'code': textwrap.dedent("""\
  119. ... val NUM_SAMPLES = 100000;
  120. ... val count = sc.parallelize(1 to NUM_SAMPLES).map { i =>
  121. ... val x = Math.random();
  122. ... val y = Math.random();
  123. ... if (x*x + y*y < 1) 1 else 0
  124. ... }.reduce(_ + _);
  125. ... println(\"Pi is roughly \" + 4.0 * count / NUM_SAMPLES)
  126. ... """)
  127. ... }
  128. >>> r = requests.post(statements_url, data=json.dumps(data), headers=headers)
  129. >>> pprint.pprint(r.json())
  130. {u'id': 1,
  131. u'output': {u'data': {u'text/plain': u'Pi is roughly 3.14004\nNUM_SAMPLES: Int = 100000\ncount: Int = 78501'},
  132. u'execution_count': 1,
  133. u'status': u'ok'},
  134. u'state': u'available'}
  135. Finally, lets close our session:
  136. .. code:: python
  137. >>> session_url = 'http://localhost:8998/sessions/0'
  138. >>> requests.delete(session_url, headers=headers)
  139. <Response [204]>
  140. .. _Requests: http://docs.python-requests.org/en/latest/
  141. .. _Spark Examples: https://spark.apache.org/examples.html
  142. PySpark Example
  143. ===============
  144. pyspark has the exact same API, just with a different initial command:
  145. .. code:: python
  146. >>> data = {'kind': 'pyspark'}
  147. >>> r = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
  148. >>> r.json()
  149. {u'id': 1, u'state': u'idle'}
  150. The PI example from before then can be run as:
  151. .. code:: python
  152. >>> data = {
  153. ... 'code': textwrap.dedent("""\
  154. ... import random
  155. ... NUM_SAMPLES = 100000
  156. ... def sample(p):
  157. ... x, y = random.random(), random.random()
  158. ... return 1 if x*x + y*y < 1 else 0
  159. ...
  160. ... count = sc.parallelize(xrange(0, NUM_SAMPLES)).map(sample) \
  161. ... .reduce(lambda a, b: a + b)
  162. ... print "Pi is roughly %f" % (4.0 * count / NUM_SAMPLES)
  163. ... """)
  164. ... }
  165. >>> r = requests.post(statements_url, data=json.dumps(data), headers=headers)
  166. >>> pprint.pprint(r.json())
  167. {u'id': 12,
  168. u'output': {u'data': {u'text/plain': u'Pi is roughly 3.136000'},
  169. u'execution_count': 12,
  170. u'status': u'ok'},
  171. u'state': u'running'}
  172. SparkR Example
  173. ==============
  174. SparkR also has the same API:
  175. .. code:: python
  176. >>> data = {'kind': 'sparkR'}
  177. >>> r = requests.post(host + '/sessions', data=json.dumps(data), headers=headers)
  178. >>> r.json()
  179. {u'id': 1, u'state': u'idle'}
  180. The PI example from before then can be run as:
  181. .. code:: python
  182. >>> data = {
  183. ... 'code': textwrap.dedent("""\
  184. ... n <- 100000
  185. ... piFunc <- function(elem) {
  186. ... rands <- runif(n = 2, min = -1, max = 1)
  187. ... val <- ifelse((rands[1]^2 + rands[2]^2) < 1, 1.0, 0.0)
  188. ... val
  189. ... }
  190. ... piFuncVec <- function(elems) {
  191. ... message(length(elems))
  192. ... rands1 <- runif(n = length(elems), min = -1, max = 1)
  193. ... rands2 <- runif(n = length(elems), min = -1, max = 1)
  194. ... val <- ifelse((rands1^2 + rands2^2) < 1, 1.0, 0.0)
  195. ... sum(val)
  196. ... }
  197. ... rdd <- parallelize(sc, 1:n, slices)
  198. ... count <- reduce(lapplyPartition(rdd, piFuncVec), sum)
  199. ... cat("Pi is roughly", 4.0 * count / n, "\n")
  200. ... """)
  201. ... }
  202. >>> r = requests.post(statements_url, data=json.dumps(data), headers=headers)
  203. >>> pprint.pprint(r.json())
  204. {u'id': 12,
  205. u'output': {u'data': {u'text/plain': u'Pi is roughly 3.136000'},
  206. u'execution_count': 12,
  207. u'status': u'ok'},
  208. u'state': u'running'}
  209. Community
  210. =========
  211. * User group: http://groups.google.com/a/cloudera.org/group/hue-user
  212. * Jira: https://issues.cloudera.org/browse/HUE-2588
  213. * Reviews: https://review.cloudera.org/dashboard/?view=to-group&group=hue (repo 'hue-rw')
  214. REST API
  215. ========
  216. GET /sessions
  217. -------------
  218. Returns all the active interactive sessions.
  219. Response Body
  220. ^^^^^^^^^^^^^
  221. +----------+-----------------+------+
  222. | name | description | type |
  223. +==========+=================+======+
  224. | sessions | `session`_ list | list |
  225. +----------+-----------------+------+
  226. POST /sessions
  227. --------------
  228. Creates a new interative Scala or Python shell in the cluster.
  229. Request Body
  230. ^^^^^^^^^^^^
  231. +----------------+--------------------------------------------------+----------------------------+
  232. | name | description | type |
  233. +================+==================================================+============================+
  234. | id | The session id | int |
  235. +----------------+--------------------------------------------------+----------------------------+
  236. | kind | session kind (spark, pyspark, or sparkr) | `session kind`_ (required) |
  237. +----------------+--------------------------------------------------+----------------------------+
  238. | log | The log lines | list of strings |
  239. +----------------+--------------------------------------------------+----------------------------+
  240. | state | The session state | string |
  241. +----------------+--------------------------------------------------+----------------------------+
  242. | file | archive holding the file | path (required) |
  243. +----------------+--------------------------------------------------+----------------------------+
  244. | args | command line arguments | list of strings |
  245. +----------------+--------------------------------------------------+----------------------------+
  246. | className | application's java/spark main class | string |
  247. +----------------+--------------------------------------------------+----------------------------+
  248. | jars | files to be placed on the java classpath | list of paths |
  249. +----------------+--------------------------------------------------+----------------------------+
  250. | pyFiles | files to be placed on the PYTHONPATH | list of paths |
  251. +----------------+--------------------------------------------------+----------------------------+
  252. | files | files to be placed in executor working directory | list of paths |
  253. +----------------+--------------------------------------------------+----------------------------+
  254. | driverMemory | memory for driver | string |
  255. +----------------+--------------------------------------------------+----------------------------+
  256. | driverCores | number of cores used by driver | int |
  257. +----------------+--------------------------------------------------+----------------------------+
  258. | executorMemory | memory for executor | string |
  259. +----------------+--------------------------------------------------+----------------------------+
  260. | executorCores | number of cores used by executor | int |
  261. +----------------+--------------------------------------------------+----------------------------+
  262. | numExecutors | number of executor | int |
  263. +----------------+--------------------------------------------------+----------------------------+
  264. | archives | | list of paths |
  265. +----------------+--------------------------------------------------+----------------------------+
  266. Response Body
  267. ^^^^^^^^^^^^^
  268. The created `Session`_.
  269. GET /sessions/{sessionId}
  270. -------------------------
  271. Return the session information
  272. Response
  273. ^^^^^^^^
  274. The `Session`_.
  275. DELETE /sessions/{sessionId}
  276. -------------------------
  277. Kill the `Session`_ job.
  278. GET /sessions/{sessionId}/logs
  279. ---------------------------
  280. Get the log lines from this session.
  281. Request Parameters
  282. ^^^^^^^^^^^^^^^^^^
  283. +------+-----------------------------+------+
  284. | name | description | type |
  285. +======+=============================+======+
  286. | from | offset | int |
  287. +------+-----------------------------+------+
  288. | size | amount of batches to return | int |
  289. +------+-----------------------------+------+
  290. Response Body
  291. ^^^^^^^^^^^^^
  292. +------+-----------------------+-----------------+
  293. | name | description | type |
  294. +======+=======================+=================+
  295. | id | The session id | int |
  296. +------+-----------------------+-----------------+
  297. | from | offset | int |
  298. +------+-----------------------+-----------------+
  299. | size | total amount of lines | int |
  300. +------+-----------------------+-----------------+
  301. | log | The log lines | list of strings |
  302. +------+-----------------------+-----------------+
  303. GET /sessions/{sessionId}/statements
  304. ------------------------------------
  305. Return all the statements in a session.
  306. Response Body
  307. ^^^^^^^^^^^^^
  308. +------------+-------------------+------+
  309. | name | description | type |
  310. +============+===================+======+
  311. | statements | `statement`_ list | list |
  312. +------------+-------------------+------+
  313. POST /sessions/{sessionId}/statements
  314. -------------------------------------
  315. Execute a statement in a session.
  316. Request Body
  317. ^^^^^^^^^^^^
  318. +------+---------------------+--------+
  319. | name | description | type |
  320. +======+=====================+========+
  321. | code | The code to execute | string |
  322. +------+---------------------+--------+
  323. Response Body
  324. ^^^^^^^^^^^^^
  325. The `statement`_ object.
  326. GET /batches
  327. ------------
  328. Return all the active batch jobs.
  329. Response Body
  330. ^^^^^^^^^^^^^
  331. +---------+---------------+------+
  332. | name | description | type |
  333. +=========+===============+======+
  334. | batches | `batch`_ list | list |
  335. +---------+---------------+------+
  336. POST /batches
  337. -------------
  338. Request Body
  339. ^^^^^^^^^^^^
  340. +----------------+--------------------------------------------------+-----------------+
  341. | name | description | type |
  342. +================+==================================================+=================+
  343. | id | The session id | int |
  344. +----------------+--------------------------------------------------+-----------------+
  345. | log | The log lines | list of strings |
  346. +----------------+--------------------------------------------------+-----------------+
  347. | state | The session state | string |
  348. +----------------+--------------------------------------------------+-----------------+
  349. | file | archive holding the file | path (required) |
  350. +----------------+--------------------------------------------------+-----------------+
  351. | args | command line arguments | list of strings |
  352. +----------------+--------------------------------------------------+-----------------+
  353. | className | application's java/spark main class | string |
  354. +----------------+--------------------------------------------------+-----------------+
  355. | jars | files to be placed on the java classpath | list of paths |
  356. +----------------+--------------------------------------------------+-----------------+
  357. | pyFiles | files to be placed on the PYTHONPATH | list of paths |
  358. +----------------+--------------------------------------------------+-----------------+
  359. | files | files to be placed in executor working directory | list of paths |
  360. +----------------+--------------------------------------------------+-----------------+
  361. | driverMemory | memory for driver | string |
  362. +----------------+--------------------------------------------------+-----------------+
  363. | driverCores | number of cores used by driver | int |
  364. +----------------+--------------------------------------------------+-----------------+
  365. | executorMemory | memory for executor | string |
  366. +----------------+--------------------------------------------------+-----------------+
  367. | executorCores | number of cores used by executor | int |
  368. +----------------+--------------------------------------------------+-----------------+
  369. | numExecutors | number of executor | int |
  370. +----------------+--------------------------------------------------+-----------------+
  371. | archives | | list of paths |
  372. +----------------+--------------------------------------------------+-----------------+
  373. Response Body
  374. ^^^^^^^^^^^^^
  375. The created `Batch`_ object.
  376. GET /batches/{batchId}
  377. ----------------------
  378. Request Parameters
  379. ^^^^^^^^^^^^^^^^^^
  380. +------+-----------------------------+------+
  381. | name | description | type |
  382. +======+=============================+======+
  383. | from | offset | int |
  384. +------+-----------------------------+------+
  385. | size | amount of batches to return | int |
  386. +------+-----------------------------+------+
  387. Response Body
  388. ^^^^^^^^^^^^^
  389. +-------+-----------------------------+-----------------+
  390. | name | description | type |
  391. +=======+=============================+=================+
  392. | id | The batch id | int |
  393. +-------+-----------------------------+-----------------+
  394. | state | The state of the batch | `batch`_ state |
  395. +-------+-----------------------------+-----------------+
  396. | log | The output of the batch job | list of strings |
  397. +-------+-----------------------------+-----------------+
  398. DELETE /batches/{batchId}
  399. -------------------------
  400. Kill the `Batch`_ job.
  401. GET /batches/{batchId}/logs
  402. ---------------------------
  403. Get the log lines from this batch.
  404. Request Parameters
  405. ^^^^^^^^^^^^^^^^^^
  406. +------+-----------------------------+------+
  407. | name | description | type |
  408. +======+=============================+======+
  409. | from | offset | int |
  410. +------+-----------------------------+------+
  411. | size | amount of batches to return | int |
  412. +------+-----------------------------+------+
  413. Response Body
  414. ^^^^^^^^^^^^^
  415. +------+-----------------------+-----------------+
  416. | name | description | type |
  417. +======+=======================+=================+
  418. | id | The batch id | int |
  419. +------+-----------------------+-----------------+
  420. | from | offset | int |
  421. +------+-----------------------+-----------------+
  422. | size | total amount of lines | int |
  423. +------+-----------------------+-----------------+
  424. | log | The log lines | list of strings |
  425. +------+-----------------------+-----------------+
  426. REST Objects
  427. ============
  428. Session
  429. -------
  430. Sessions represent an interactive shell.
  431. +----------------+--------------------------------------------------------------------------------+------------------+
  432. | name | description | type |
  433. +================+================================================================================+==================+
  434. | id | The session id | string |
  435. +----------------+--------------------------------------------------------------------------------+------------------+
  436. | state | The state of the session | `session state`_ |
  437. +----------------+--------------------------------------------------------------------------------+------------------+
  438. | kind | The session kind | `session kind`_ |
  439. +----------------+--------------------------------------------------------------------------------+------------------+
  440. | proxyUser | The user running this session | optional string |
  441. +----------------+--------------------------------------------------------------------------------+------------------+
  442. | jars | files to be placed on the java classpath | list of paths |
  443. +----------------+--------------------------------------------------------------------------------+------------------+
  444. | pyFiles | files to be placed on the PYTHONPATH | list of paths |
  445. +----------------+--------------------------------------------------------------------------------+------------------+
  446. | files | files to be placed in executor working directory | list of paths |
  447. +----------------+--------------------------------------------------------------------------------+------------------+
  448. | driverMemory | memory for driver | string |
  449. +----------------+--------------------------------------------------------------------------------+------------------+
  450. | driverCores | number of cores used by driver (YARN mode only) | int |
  451. +----------------+--------------------------------------------------------------------------------+------------------+
  452. | executorMemory | memory for executor | string |
  453. +----------------+--------------------------------------------------------------------------------+------------------+
  454. | executorCores | number of cores used by executor | int |
  455. +----------------+--------------------------------------------------------------------------------+------------------+
  456. | numExecutors | number of executors (YARN mode only) | int |
  457. +----------------+--------------------------------------------------------------------------------+------------------+
  458. | archives | Archives to be uncompressed in the executor working directory (YARN mode only) | list of paths |
  459. +----------------+--------------------------------------------------------------------------------+------------------+
  460. Session State
  461. ^^^^^^^^^^^^^
  462. +-------------+----------------------------------+
  463. | name | description |
  464. +=============+==================================+
  465. | not_started | session has not been started |
  466. +-------------+----------------------------------+
  467. | starting | session is starting |
  468. +-------------+----------------------------------+
  469. | idle | session is waiting for input |
  470. +-------------+----------------------------------+
  471. | busy | session is executing a statement |
  472. +-------------+----------------------------------+
  473. | error | session errored out |
  474. +-------------+----------------------------------+
  475. | dead | session has exited |
  476. +-------------+----------------------------------+
  477. Session Kind
  478. ^^^^^^^^^^^^
  479. +---------+----------------------------------+
  480. | name | description |
  481. +=========+==================================+
  482. | spark | interactive scala/spark session |
  483. +---------+----------------------------------+
  484. | pyspark | interactive python/spark session |
  485. +---------+----------------------------------+
  486. Statement
  487. ---------
  488. Statements represent the result of an execution statement.
  489. +--------+----------------------+---------------------+
  490. | name | description | type |
  491. +========+======================+=====================+
  492. | id | The statement id | integer |
  493. +--------+----------------------+---------------------+
  494. | state | The execution state | `statement state`_ |
  495. +--------+----------------------+---------------------+
  496. | output | The execution output | `statement output`_ |
  497. +--------+----------------------+---------------------+
  498. Statement State
  499. ^^^^^^^^^^^^^^^
  500. +-----------+----------------------------------+
  501. | name | description |
  502. +===========+==================================+
  503. | running | Statement is currently executing |
  504. +-----------+----------------------------------+
  505. | available | Statement has a ready response |
  506. +-----------+----------------------------------+
  507. | error | Statement failed |
  508. +-----------+----------------------------------+
  509. Statement Output
  510. ^^^^^^^^^^^^^^^^
  511. +-----------------+-------------------+----------------------------------+
  512. | name | description | type |
  513. +=================+===================+==================================+
  514. | status | execution status | string |
  515. +-----------------+-------------------+----------------------------------+
  516. | execution_count | a monotomically | integer |
  517. | | increasing number | |
  518. +-----------------+-------------------+----------------------------------+
  519. | data | statement output | an object mapping a mime type to |
  520. | | | the result. If the mime type is |
  521. | | | ``application/json``, the value |
  522. | | | will be a JSON value |
  523. +-----------------+-------------------+----------------------------------+
  524. Batch
  525. -----
  526. +----------------+--------------------------------------------------------------------------------+-----------------+
  527. | name | description | type |
  528. +================+================================================================================+=================+
  529. | file | archive holding the file | path (required) |
  530. +----------------+--------------------------------------------------------------------------------+-----------------+
  531. | args | command line arguments | list of strings |
  532. +----------------+--------------------------------------------------------------------------------+-----------------+
  533. | className | application's java/spark main class | string |
  534. +----------------+--------------------------------------------------------------------------------+-----------------+
  535. | jars | files to be placed on the java classpath | list of paths |
  536. +----------------+--------------------------------------------------------------------------------+-----------------+
  537. | pyFiles | files to be placed on the PYTHONPATH | list of paths |
  538. +----------------+--------------------------------------------------------------------------------+-----------------+
  539. | files | files to be placed in executor working directory | list of paths |
  540. +----------------+--------------------------------------------------------------------------------+-----------------+
  541. | driverMemory | memory for driver | string |
  542. +----------------+--------------------------------------------------------------------------------+-----------------+
  543. | driverCores | number of cores used by driver (YARN mode only) | int |
  544. +----------------+--------------------------------------------------------------------------------+-----------------+
  545. | executorMemory | memory for executor | string |
  546. +----------------+--------------------------------------------------------------------------------+-----------------+
  547. | executorCores | number of cores used by executor | int |
  548. +----------------+--------------------------------------------------------------------------------+-----------------+
  549. | numExecutors | number of executors (YARN mode only) | int |
  550. +----------------+--------------------------------------------------------------------------------+-----------------+
  551. | archives | Archives to be uncompressed in the executor working directory (YARN mode only) | list of paths |
  552. +----------------+--------------------------------------------------------------------------------+-----------------+
  553. License
  554. =======
  555. Apache License, Version 2.0
  556. http://www.apache.org/licenses/LICENSE-2.0