From 8a18326f2be202d671144fe0723ad13bcc5ee95f Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 7 Feb 2022 15:55:29 -0500 Subject: [PATCH 1/4] Sort notification classes / events --- src/lib/Hydra/Event.pm | 8 ++++---- t/scripts/hydra-eval-jobset/notifications.t | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/Hydra/Event.pm b/src/lib/Hydra/Event.pm index 9efeda67..86cf9055 100644 --- a/src/lib/Hydra/Event.pm +++ b/src/lib/Hydra/Event.pm @@ -2,20 +2,20 @@ package Hydra::Event; use strict; use warnings; -use Hydra::Event::CachedBuildFinished; -use Hydra::Event::CachedBuildQueued; use Hydra::Event::BuildFinished; use Hydra::Event::BuildQueued; use Hydra::Event::BuildStarted; +use Hydra::Event::CachedBuildFinished; +use Hydra::Event::CachedBuildQueued; use Hydra::Event::StepFinished; my %channels_to_events = ( + build_finished => \&Hydra::Event::BuildFinished::parse, build_queued => \&Hydra::Event::BuildQueued::parse, build_started => \&Hydra::Event::BuildStarted::parse, - step_finished => \&Hydra::Event::StepFinished::parse, - build_finished => \&Hydra::Event::BuildFinished::parse, cached_build_finished => \&Hydra::Event::CachedBuildFinished::parse, cached_build_queued => \&Hydra::Event::CachedBuildQueued::parse, + step_finished => \&Hydra::Event::StepFinished::parse, ); diff --git a/t/scripts/hydra-eval-jobset/notifications.t b/t/scripts/hydra-eval-jobset/notifications.t index d0bbb3af..8fe5d0f4 100644 --- a/t/scripts/hydra-eval-jobset/notifications.t +++ b/t/scripts/hydra-eval-jobset/notifications.t @@ -17,14 +17,14 @@ path_input_cache_validity_seconds = 0 my $dbh = $ctx->db()->storage->dbh; my $listener = Hydra::PostgresListener->new($dbh); +$listener->subscribe("build_queued"); +$listener->subscribe("builds_added"); $listener->subscribe("cached_build_finished"); $listener->subscribe("cached_build_queued"); -$listener->subscribe("build_queued"); -$listener->subscribe("eval_failed"); -$listener->subscribe("eval_cached"); $listener->subscribe("eval_added"); +$listener->subscribe("eval_cached"); +$listener->subscribe("eval_failed"); $listener->subscribe("eval_started"); -$listener->subscribe("builds_added"); my $jobsetdir = $ctx->tmpdir . '/jobset'; From 7107ce2bc73465ff64092e69373f5f2bc2a62eed Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 7 Feb 2022 14:11:01 -0500 Subject: [PATCH 2/4] t/Event/* -> t/Hydra/Event/ --- t/{ => Hydra}/Event/CachedBuildFinished.t | 0 t/{ => Hydra}/Event/CachedBuildQueued.t | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename t/{ => Hydra}/Event/CachedBuildFinished.t (100%) rename t/{ => Hydra}/Event/CachedBuildQueued.t (100%) diff --git a/t/Event/CachedBuildFinished.t b/t/Hydra/Event/CachedBuildFinished.t similarity index 100% rename from t/Event/CachedBuildFinished.t rename to t/Hydra/Event/CachedBuildFinished.t diff --git a/t/Event/CachedBuildQueued.t b/t/Hydra/Event/CachedBuildQueued.t similarity index 100% rename from t/Event/CachedBuildQueued.t rename to t/Hydra/Event/CachedBuildQueued.t From f648e914876d2fb425e4146b60089f8f26606b36 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 7 Feb 2022 14:57:51 -0500 Subject: [PATCH 3/4] StepFinished.t: fixup use --- t/Hydra/Event/StepFinished.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/Hydra/Event/StepFinished.t b/t/Hydra/Event/StepFinished.t index 08726566..1d18e9b1 100644 --- a/t/Hydra/Event/StepFinished.t +++ b/t/Hydra/Event/StepFinished.t @@ -7,7 +7,7 @@ my %ctx = test_init(); require Hydra::Schema; require Hydra::Model::DB; use Hydra::Event; -use Hydra::Event::BuildStarted; +use Hydra::Event::StepFinished; use Test2::V0; use Test2::Tools::Exception; From c0eb873379d12f0065f98835563c661d4344ca00 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 7 Feb 2022 12:41:23 -0500 Subject: [PATCH 4/4] notifications: document eval_* --- doc/manual/src/notifications.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/manual/src/notifications.md b/doc/manual/src/notifications.md index 2423670c..0c666559 100644 --- a/doc/manual/src/notifications.md +++ b/doc/manual/src/notifications.md @@ -55,6 +55,30 @@ After processing, the row's `notificationspendingsince` column is set to null. It is possible for subsequent deliveries of the same `build_finished` data to imply different outcomes. For example, if the build fails, is restarted, and then succeeds. In this scenario the `build_finished` events will be delivered at least twice, once for the failure and then once for the success. +### `eval_started` + +* **Payload:** Exactly three values, separated by the two-character string `\t` (ie: not a tab): an opaque trace ID representing this evaluation, the name of the project, and the name of the jobset. +* **When:** At the beginning of the evaluation phase for the jobset, before any work is done. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_added` + +* **Payload:** Exactly two values, separated by the two-character string `\t` (ie: not a tab): an opaque trace ID representing this evaluation, and the ID of the JobsetEval record. +* **When:** After the evaluator fetches inputs and completes the evaluation successfully. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_cached` + +* **Payload:** Exactly one value: an opaque trace ID representing this evaluation. +* **When:** After the evaluator fetches inputs, if none of the inputs changed. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + +### `eval_failed` + +* **Payload:** Exactly one value: an opaque trace ID representing this evaluation. +* **When:** After any fetching any input fails, or any other evaluation error occurs. +* **Delivery Semantics:** Ephemeral. `hydra-notify` must be running to react to this event. No record of this event is stored. + ## Development Notes ### Re-sending a notification