New to Kestra?
Use blueprints to kickstart your first workflows.
Orchestrate Dataproc Serverless with Kestra. Check BigQuery for fresh source rows, then submit a PySpark batch only when the data has landed.
Run a Dataproc Serverless PySpark batch only after the upstream data is proven ready, instead of firing a scheduled Spark job blindly against missing or stale source tables. This blueprint orchestrates a BigQuery readiness check, a conditional gate, and a Dataproc Serverless PySpark submission, then reports the outcome to Discord. It solves a common data engineering problem: scheduled Spark batches that waste serverless compute, produce empty rollups, or corrupt downstream tables because they ran before today's data landed.
daily io.kestra.plugin.core.trigger.Schedule trigger fires the flow on a cron cadence (0 5 * * *, shipped disabled: true so you can review it first).check_readiness task (io.kestra.plugin.gcp.bigquery.Query) runs a FETCH_ONE query that counts today's rows in the analytics.source_events table for event_date = CURRENT_DATE().gate task (io.kestra.plugin.core.flow.If) evaluates {{ outputs.check_readiness.row.cnt > 0 }}.submit_pyspark (io.kestra.plugin.gcp.dataproc.batches.PySparkSubmit) launches the batch from mainPythonFileUri on Dataproc Serverless, and notify_submitted posts a confirmation via io.kestra.plugin.discord.DiscordIncomingWebhook.notify_skipped reports the skipped run to Discord.errors handler (alert_on_failure) alerts Discord if the readiness check or batch fails. A pluginDefaults block injects projectId and serviceAccount into every GCP task.pluginDefaults so individual tasks stay clean.Dataproc Serverless can run a PySpark batch, but its own scheduler cannot express "only run if the upstream BigQuery data has actually landed." Kestra adds that gate declaratively in YAML: an event or schedule trigger, a readiness query, and an If condition that branches before any compute starts. You also get retries, failure alerting, full execution lineage across BigQuery and Dataproc in one place, and the freedom to swap the schedule trigger for an event trigger without rewriting the job.
source_events table in the analytics dataset with an event_date column.jobs/daily_rollup.py).GCP_PROJECT_ID: GCP project hosting Dataproc, GCS, and BigQuery.GCP_SERVICE_ACCOUNT: service account key JSON with Dataproc, GCS, and BigQuery access.GCP_REGION: region for the serverless batch.GCS_BUCKET: bucket holding the PySpark job file.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.If condition to match your freshness rule.mainPythonFileUri at your PySpark job in GCS.daily schedule._SUCCESS marker check.submit_pyspark to load batch results back into BigQuery.