title: Container killed by the ApplicationMaster Exit code is 143 in python script
body: <p>I have the following error launching a pyspark script using oozie and with a shell.</p>
  
  <pre><code>Container killed on request. Exit code is 143
  Container exited with a non-zero exit code 143
  </code></pre>
  
  <p>In the script I read and I add a record from/to Hive tables.</p>
  
  <p>I have tried to set more memory but it does not function. Even, I don't believe it is memory because I am just adding one record to Hive table!</p>
  
  <pre><code>    spark_conf = SparkConf().setAppName("KB").setAll(settings)
      spark = SparkSession.builder. \
      config(conf = spark_conf). \
      enableHiveSupport(). \
      getOrCreate()
  
  
      id=sys.argv[1]     
      importdate = datetime.now().strftime("%Y%m%d")
      query1 = "SELECT * FROM knowledge_blocks.ingestion WHERE id = "+id+""
  
      ingested = spark.sql(query1)
      title = ingested.select('title').collect()[0]['title']
      content = ingested.select('content').collect()[0]['content']
  
     ......
  
      query2 = "INSERT INTO knowledge_blocks.preprocessed PARTITION 
      (creation_date='"+importdate+"') VALUES ('"+str(id)+"', 
      '"+tokens_title+"', 
      '"+tokens_content+"', '"+tokens_content_soft+"')"
  
      rows = zip([id],[tokens_title],[tokens_content],[tokens_content_soft], 
      [importdate])
  
      df_spark = spark.createDataFrame(rows, schema=['id','tokens_title','tokens_content','tokens_content_soft','creation_date'])
      df_spark.show()
      df_spark.write.saveAsTable('knowledge_blocks.preprocessed', format='hive', mode='append', partitionBy='creation_date')
  
       spark.stop()
  </code></pre>