当Spark DataFrame write()函数完成执行时,我是否可以认为数据已准备就绪?

时间:2018-08-07 21:32:47

标签: apache-spark elasticsearch amazon-emr

我有作为AWS EMR步骤运行的Python代码,像这样的伪代码:

requests.put(....create an Elasticsearch index...")
spark \
  .sql(...join a few temp views to generate data...) \
  .write \
  .format("org.elasticsearch.spark.sql") \
  .option("es.nodes", host) \
  .option("es.port", port) \
  .option("es.resource", "my_index") \
  .save()
requests.post(....flush the Elasticsearch index...")

简单来说,我使用requests.put()创建索引,使用spark.save()将数据写入索引,毕竟使用requests.post()刷新索引。我希望所有这三个操作均按顺序执行,并且以下操作仅在前一个操作完全完成后才能运行。就是说,在所有数据完全保存到所有EMR执行程序的索引中之前,我不希望刷新索引。我的假设正确吗?

0 个答案:

没有答案