← Documentation
ADS-IDAC Engine 5.0.0
Notification.cpp File Reference

Send completion notifications via ntfy.sh or Discord webhooks using curl. More...

#include "Notification.h"
#include <cstdlib>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#include <unistd.h>
Include dependency graph for Notification.cpp:

Go to the source code of this file.

Functions

static std::string format_time (double seconds)
 Format wall time as human-readable string. More...
 
static std::string project_name (const std::string &path)
 Extract the last path component as the project name. More...
 
static void send_ntfy (const std::string &topic, const RunSummary &summary)
 
static void send_discord (const std::string &webhook_url, const RunSummary &summary)
 
std::string auto_ntfy_topic ()
 Generate a default ntfy topic name: "ads" + 4 hex chars from hostname hash. Example: "ads7f3a". More...
 
void send_completion_notification (const RunSummary &summary)
 Send completion notifications to all configured targets. Non-fatal: prints a warning if curl fails, never throws. More...
 

Variables

std::string notify_ntfy_topic
 Global notification targets (set by Scheduler::parseOptions). More...
 
std::string notify_discord_webhook
 

Detailed Description

Send completion notifications via ntfy.sh or Discord webhooks using curl.

Definition in file Notification.cpp.

Function Documentation

◆ auto_ntfy_topic()

std::string auto_ntfy_topic ( )

Generate a default ntfy topic name: "ads" + 4 hex chars from hostname hash. Example: "ads7f3a".

Definition at line 101 of file Notification.cpp.

Referenced by Scheduler::parseOptions().

Here is the caller graph for this function:

◆ format_time()

static std::string format_time ( double  seconds)
static

Format wall time as human-readable string.

Definition at line 17 of file Notification.cpp.

Referenced by send_discord(), and send_ntfy().

Here is the caller graph for this function:

◆ project_name()

static std::string project_name ( const std::string &  path)
static

Extract the last path component as the project name.

Definition at line 34 of file Notification.cpp.

Referenced by send_discord(), and send_ntfy().

Here is the caller graph for this function:

◆ send_completion_notification()

void send_completion_notification ( const RunSummary &  summary)

Send completion notifications to all configured targets. Non-fatal: prints a warning if curl fails, never throws.

Definition at line 111 of file Notification.cpp.

References notify_discord_webhook, notify_ntfy_topic, send_discord(), and send_ntfy().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_discord()

static void send_discord ( const std::string &  webhook_url,
const RunSummary &  summary 
)
static

Definition at line 68 of file Notification.cpp.

References format_time(), RunSummary::project, project_name(), RunSummary::ranks, RunSummary::sequences, RunSummary::solver, RunSummary::truncation_time, and RunSummary::wall_seconds.

Referenced by send_completion_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_ntfy()

static void send_ntfy ( const std::string &  topic,
const RunSummary &  summary 
)
static

Definition at line 41 of file Notification.cpp.

References format_time(), RunSummary::project, project_name(), RunSummary::ranks, RunSummary::sequences, and RunSummary::wall_seconds.

Referenced by send_completion_notification().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ notify_discord_webhook

std::string notify_discord_webhook

Definition at line 14 of file Notification.cpp.

Referenced by Scheduler::parseOptions(), and send_completion_notification().

◆ notify_ntfy_topic

std::string notify_ntfy_topic

Global notification targets (set by Scheduler::parseOptions).

Definition at line 13 of file Notification.cpp.

Referenced by Scheduler::parseOptions(), and send_completion_notification().