โ03-29-2023 11:59 PM
Hi,
I am running batch job which processes incoming files. I am trying to limit number of files in each batch process so added maxFilesPerTrigger option. But its not working. It processes all incoming files at once.
(spark.readStream.format("delta").load(silver_path)
.writeStream
.option("checkpointLocation", gold_checkpoint_path)
.option("maxFilesPerTrigger", 200)
.trigger(once=True)
.foreachBatch(foreachBatchFunction)
.start()
.awaitTermination()
)
Please suggest.
Regards,
Sanjay
โ03-30-2023 07:02 AM
@Sanjay Jainโ , inside your gold_checkpoint_path, there are a few subfolders.
Go to "commits" and check which is the latest file inside (You can see files named 1,2,3,4,.....50,51 so on. File named with the highest number is the latest one. Assume it is 60 for example. This means micro batch 60 is committed. If no batch is committed yet, you will see no files).
And then check for files inside "offsets" folder. see the latest one in that folder too. That will in almost all cases you will see a file with name = latest batchID found in commits + 1 (61 as per this example. If there were no files at all inside commits, then you will see a file named "0" inside this folder.). And If you see this behavior, take a backup of this latest file and then delete it. Then restart the job. This should help!
โ03-30-2023 07:51 AM
This seems to be manual step, Is there any way I can this automatically like reprocess the file if any updates are made on that particular file.
โ03-30-2023 07:54 AM
that sounds more like the change data feed functionality of delta lake.
https://learn.microsoft.com/en-us/azure/databricks/delta/delta-change-data-feed
โ03-31-2023 07:08 PM
Hi @Sanjay Jainโ
Hope everything is going great.
Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you.
Cheers!
โ04-03-2023 12:04 AM
Hi Vidula,
Above solutions are not working. Please suggest any other solution.
Regards,
Sanjay
โ04-03-2023 03:46 AM
@Sanjay Jainโ sorry missed one thing. .trigger(once=True)โ doesn't support rate limiters. You can use .trigger(availableNow=True)โ instead.
spark.readStream.format("delta")
.option("maxFilesPerTrigger", 200)
.load(silver_path)
.writeStream
.option("checkpointLocation", gold_checkpoint_path)
.trigger(availableNow=True)
.foreachBatch(foreachBatchFunction)
.start()
2 weeks ago
Hi @Sandeep ,
Can we use
spark.readStream.format("delta")
.option("
.load(silver_path)
.writeStream
.option("checkpointLocation", gold_checkpoint_path)
.trigger(availableNow=True)
.foreachBatch(foreachBatchFunction)
.start()
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group