New to Kestra?
Use blueprints to kickstart your first workflows.
Audit TorchServe model server availability, verify registered PyTorch inference model readiness, and alert via Slack to prevent AI prediction outages.
TorchServe is an open-source, performant model serving framework for PyTorch developed by AWS and the PyTorch Foundation. Designed for production MLOps and deep learning platforms, TorchServe delivers low-latency model inference, multi-model serving, batch prediction, and management APIs. In production deep learning environments, unhandled CUDA Out-Of-Memory (OOM) exceptions, model initialization timeouts, or memory leaks within Python backend workers can cause inference worker processes to terminate abruptly, leading to failed prediction requests across downstream applications. This blueprint deploys an automated operational sentinel that continuously verifies TorchServe daemon responsiveness, audits registered PyTorch model readiness, routes structured incident alerts to Slack, and maintains execution audit lineage.
periodic_torchserve_audit (io.kestra.plugin.core.trigger.Schedule) initiates scheduled monitoring every 15 minutes. Shipped disabled so initial connectivity can be verified manually.probe_server_ping (io.kestra.plugin.core.http.Request) invokes GET /ping on the inference port to confirm model server daemon uptime and JVM-Python worker communication.probe_registered_models (io.kestra.plugin.core.http.Request) invokes GET /models on the management port to inspect loaded PyTorch model artifacts and worker allocations.classify_server_health (io.kestra.plugin.core.flow.Switch) evaluates probe results:SERVER_UNHEALTHY: Fires if /ping returns non-200 or unhealthy status, dispatching a high-severity incident notification via io.kestra.plugin.slack.notifications.SlackIncomingWebhook.NO_MODELS_LOADED: Fires when the server is running but zero models are registered in memory, alerting the MLOps team of potential deployment errors.HEALTHY: Confirms that both daemon runtime and model inference pipelines operate nominally.log_sentinel_audit_summary (io.kestra.plugin.core.log.Log) writes an immutable execution log recording evaluated status codes and audit lineage.errors handler catches network connection drops, timeouts, or container crashes, firing an emergency outage alert to Slack.dry_run: true prevents automated mutations during cluster audits.TorchServe exposes REST management and inference endpoints but lacks built-in alerting, cron scheduling, and multi-channel incident escalation. Relying on custom shell scripts or ad-hoc cron jobs introduces maintenance overhead, hard-coded credentials, and zero execution visibility. Kestra provides a declarative YAML blueprint featuring scheduled triggers, masked secret management, conditional branching, and comprehensive execution observability.
pytorch/torchserve:latest-cpu) requiring zero commercial licensing.SLACK_WEBHOOK_URL: Slack incoming webhook URL for operational notifications and incident routing.docker run -d --name torchserve-test -p 8080:8080 -p 8081:8081 pytorch/torchserve:latest-cpu torchserve --start --model-store /home/model-server/model-store
SLACK_WEBHOOK_URL in your Kestra namespace secrets.dry_run: true).log_healthy_state records a successful health check response (status: Healthy).docker stop torchserve-test) and re-running the flow to verify alert_torchserve_network_failure.periodic_torchserve_audit to activate recurring 15-minute surveillance.POST /predictions/{model_name} to benchmark inference latency against SLA thresholds.io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for high-severity model serving outages.io.kestra.plugin.prometheus.