<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Apache Spark Submit using rest API driver state ERROR in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Apache-Spark-Submit-using-rest-API-driver-state-ERROR/m-p/359725#M238174</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a spark cluster deployed on windows. I'm trying to submit a simple spark job using the rest api. The job is just python code that does simple hello world sentence as follows :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyspark.sql import SparkSession
def main(args):
    print('hello world')
    return 0
if __name__ == '__main__':
  main(None)&lt;/LI-CODE&gt;&lt;P&gt;The url Im using to submit the job is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;http://&amp;lt;Master-IP&amp;gt;:6066/v1/submissions/create&lt;/LI-CODE&gt;&lt;P&gt;With the following Post Body:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "appResource": "file:../../helloworld.py",
    "sparkProperties": {
        "spark.executor.memory": "2g",
        "spark.master": "spark://&amp;lt;Master IP&amp;gt;:7077",
        "spark.app.name": "Spark REST API - Hello world",
        "spark.driver.memory": "2g",
        "spark.eventLog.enabled": "false",
        "spark.driver.cores": "2",
        "spark.submit.deployMode": "cluster",
        "spark.driver.supervise": "true"
    },
    "clientSparkVersion": "3.3.1",
    "mainClass": "org.apache.spark.deploy.SparkSubmit",
    "environmentVariables": {
        "SPARK_ENV_LOADED": "1"
    },
    "action": "CreateSubmissionRequest",
    "appArgs": [
        "../../helloworld.py", "80"
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;After I run this post using postmant, I get the following response:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "action": "CreateSubmissionResponse",
    "message": "Driver successfully submitted as driver-20221216112633-0005",
    "serverSparkVersion": "3.3.1",
    "submissionId": "driver-20221216112633-0005",
    "success": true
}&lt;/LI-CODE&gt;&lt;P&gt;However when I try to get the job status using :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;http://&amp;lt;Master-IP&amp;gt;:6066/v1/submissions/status/driver-20221216112633-0005&lt;/LI-CODE&gt;&lt;P&gt;I get the driverState: ERROR , NullPointerException as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "action": "SubmissionStatusResponse",
    "driverState": "ERROR",
    "message": "Exception from the cluster:\njava.lang.NullPointerException\n\torg.apache.spark.deploy.worker.DriverRunner.downloadUserJar(DriverRunner.scala:158)\n\torg.apache.spark.deploy.worker.DriverRunner.prepareAndRunDriver(DriverRunner.scala:179)\n\torg.apache.spark.deploy.worker.DriverRunner$$anon$2.run(DriverRunner.scala:99)",
    "serverSparkVersion": "3.3.1",
    "submissionId": "driver-20221216112633-0005",
    "success": true,
    "workerHostPort": "10.9.8.120:56060",
    "workerId": "worker-20221216093629-&amp;lt;IP&amp;gt;-56060"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why Im getting this error and what it means. Can someone please point me in the right direction or help me at least&amp;nbsp; how I can trouble this farther? Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 17:35:09 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2022-12-16T17:35:09Z</dc:date>
    <item>
      <title>Apache Spark Submit using rest API driver state ERROR</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Apache-Spark-Submit-using-rest-API-driver-state-ERROR/m-p/359725#M238174</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a spark cluster deployed on windows. I'm trying to submit a simple spark job using the rest api. The job is just python code that does simple hello world sentence as follows :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;from pyspark.sql import SparkSession
def main(args):
    print('hello world')
    return 0
if __name__ == '__main__':
  main(None)&lt;/LI-CODE&gt;&lt;P&gt;The url Im using to submit the job is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;http://&amp;lt;Master-IP&amp;gt;:6066/v1/submissions/create&lt;/LI-CODE&gt;&lt;P&gt;With the following Post Body:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "appResource": "file:../../helloworld.py",
    "sparkProperties": {
        "spark.executor.memory": "2g",
        "spark.master": "spark://&amp;lt;Master IP&amp;gt;:7077",
        "spark.app.name": "Spark REST API - Hello world",
        "spark.driver.memory": "2g",
        "spark.eventLog.enabled": "false",
        "spark.driver.cores": "2",
        "spark.submit.deployMode": "cluster",
        "spark.driver.supervise": "true"
    },
    "clientSparkVersion": "3.3.1",
    "mainClass": "org.apache.spark.deploy.SparkSubmit",
    "environmentVariables": {
        "SPARK_ENV_LOADED": "1"
    },
    "action": "CreateSubmissionRequest",
    "appArgs": [
        "../../helloworld.py", "80"
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;After I run this post using postmant, I get the following response:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "action": "CreateSubmissionResponse",
    "message": "Driver successfully submitted as driver-20221216112633-0005",
    "serverSparkVersion": "3.3.1",
    "submissionId": "driver-20221216112633-0005",
    "success": true
}&lt;/LI-CODE&gt;&lt;P&gt;However when I try to get the job status using :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;http://&amp;lt;Master-IP&amp;gt;:6066/v1/submissions/status/driver-20221216112633-0005&lt;/LI-CODE&gt;&lt;P&gt;I get the driverState: ERROR , NullPointerException as follows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "action": "SubmissionStatusResponse",
    "driverState": "ERROR",
    "message": "Exception from the cluster:\njava.lang.NullPointerException\n\torg.apache.spark.deploy.worker.DriverRunner.downloadUserJar(DriverRunner.scala:158)\n\torg.apache.spark.deploy.worker.DriverRunner.prepareAndRunDriver(DriverRunner.scala:179)\n\torg.apache.spark.deploy.worker.DriverRunner$$anon$2.run(DriverRunner.scala:99)",
    "serverSparkVersion": "3.3.1",
    "submissionId": "driver-20221216112633-0005",
    "success": true,
    "workerHostPort": "10.9.8.120:56060",
    "workerId": "worker-20221216093629-&amp;lt;IP&amp;gt;-56060"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure why Im getting this error and what it means. Can someone please point me in the right direction or help me at least&amp;nbsp; how I can trouble this farther? Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 17:35:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Apache-Spark-Submit-using-rest-API-driver-state-ERROR/m-p/359725#M238174</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2022-12-16T17:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Apache Spark Submit using rest API driver state ERROR</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Apache-Spark-Submit-using-rest-API-driver-state-ERROR/m-p/361296#M238553</link>
      <description>&lt;P&gt;I was finally able to figure out the problem. To resolve this issue basically it seems like the py\jar file as specified in the "appResource" &amp;amp; ""spark.jars" needs to be accessible by all nodes in the cluster, for example if you have network path you can specify the network path in both attributes as follows:&lt;BR /&gt;"appResource": "file:////Servername/somefolder/HelloWorld.jar",&lt;BR /&gt;...&lt;BR /&gt;"spark.jars": "file:////Servername/someFolder/HelloWorld.jar",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note sure why if the job is being submitted to the master. If anybody knows please help me understand.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 14:53:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Apache-Spark-Submit-using-rest-API-driver-state-ERROR/m-p/361296#M238553</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-01-13T14:53:58Z</dc:date>
    </item>
  </channel>
</rss>

