Neo4j DAG Cycle Breach and Hierarchy Integrity Gate
Detect directed cycle breaches in Neo4j hierarchy graphs, persist JSON audit certificates, and conditionally sever culprit back-edges.
Audit Apache Livy Spark batches for failure and SLA breaches, detect orphaned interactive sessions, alert on Slack, and safely reclaim cluster resources.
Apache Livy is the standard open-source REST service for interacting with Apache Spark clusters, enabling easy submission of Spark batch jobs and stateful interactive sessions across multi-tenant data platforms. In production analytics environments, Spark workloads submitted through Livy frequently face two silent operational failure modes: batch jobs that crash into a dead state due to driver OutOfMemory (OOM) errors without notifying downstream owners, and long-running interactive PySpark sessions abandoned by data scientists that remain idle while permanently hoarding executor memory and CPU cores on Kubernetes or YARN. This blueprint implements an automated sentinel that continuously audits Livy endpoints, inspects batch and session registries, dispatches actionable Slack alerts, and provides guarded automated reclamation of orphaned sessions.
periodic_livy_audit (io.kestra.plugin.core.trigger.Schedule) triggers every 15 minutes with configurable endpoint and threshold inputs. Shipped disabled so initial manual verification can be performed first.probe_spark_batches (io.kestra.plugin.core.http.Request) invokes GET /batches to retrieve all registered Spark batch jobs, execution states, and application IDs.probe_spark_sessions (io.kestra.plugin.core.http.Request) invokes GET /sessions to inspect active interactive Spark sessions and their idle states.classify_spark_workloads (io.kestra.plugin.core.flow.Switch) evaluates probe responses:DEAD_BATCH_DETECTED: Triggered when any Spark batch enters dead or error state. Dispatches an incident alert to Slack via io.kestra.plugin.slack.notifications.SlackIncomingWebhook directing on-call engineers to driver failure diagnostics.ORPHANED_SESSION_DETECTED: Triggered when interactive sessions remain idle past threshold limits. Dispatches a resource leak warning to Slack, and if auto_kill_orphaned_sessions is enabled with dry_run disabled, executes reclaim_orphaned_session (DELETE /sessions/{id}) to free executor RAM.HEALTHY: Confirms all batch and session states are operating within normal parameters.log_audit_summary (io.kestra.plugin.core.log.Log) records an immutable audit trail capturing evaluated workload counts and sentinel classification.errors handler catches connection drops or network partitions, dispatching an immediate Slack notification if the Livy server is unreachable.dry_run defaults to true to ensure full audit safety during rollout.Apache Livy provides raw REST endpoints but lacks built-in alerting, scheduling, or self-healing policy enforcement. Relying on ad-hoc cron jobs or custom Python scripts leads to unmonitored scripts, credential exposure, and lack of audit history. Kestra delivers a declarative, version-controlled blueprint with native scheduling, credential protection through secret masking, conditional routing, and complete execution observability.
apache/livy:latest) requiring no commercial licenses.SLACK_WEBHOOK_URL: Slack incoming webhook URL for routing dead batch and orphaned session alerts.docker run -d --name livy-test -p 8998:8998 jahstreet/spark-livy:latest
SLACK_WEBHOOK_URL secret in your Kestra namespace.dry_run: true).log_healthy_cluster logs nominal batch and session counts.curl -X POST http://localhost:8998/sessions -H "Content-Type: application/json" -d '{"kind": "pyspark"}'
alert_orphaned_session_slack firing.periodic_livy_audit to activate recurring 15-minute surveillance.io.kestra.plugin.prometheus to track active Spark batch and session counts over time.io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for production SLA breaches.io.kestra.plugin.aws.s3.Upload when a batch crashes to preserve driver logs before Livy container rotation.