From 09f705d968d9ef95fd2ada57fdc2f9976784ffa1 Mon Sep 17 00:00:00 2001 From: Simon Westphahl Date: Thu, 26 Jan 2023 08:45:55 +0100 Subject: [PATCH] Set arrival timestamp for timer trigger events By addding timer trigger events directly to the pipeline event queues (added in I6b4b77a82aac6d2c3441ace9f64dc9b4a80c5856) we no longer use the `addTriggerEvent()` method of the scheduler which was setting the `arrived_at_scheduler_timestamp` of the event. This will lead to an exception when reporting pipeline stats for the added item: ERROR zuul.Pipeline.tenant.periodic_5_min: Exception reporting pipeline stats Traceback (most recent call last): File "/opt/zuul/lib/python3.10/site-packages/zuul/manager/__init__.py", line 2208, in reportStats processing = (now - arrived) * 1000 TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' This changes sets the missing timestamp when creating the event in the timer driver. Change-Id: Ic6fe39637935405dd0df6c9bac2e3bf313656a63 --- zuul/driver/timer/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zuul/driver/timer/__init__.py b/zuul/driver/timer/__init__.py index 57cf999a37..dcc0137883 100644 --- a/zuul/driver/timer/__init__.py +++ b/zuul/driver/timer/__init__.py @@ -226,6 +226,7 @@ class TimerDriver(Driver, TriggerInterface): event.branch = branch event.zuul_event_id = str(uuid4().hex) event.timestamp = time.time() + event.arrived_at_scheduler_timestamp = event.timestamp # Refresh the branch in order to update the item in the # change cache. change_key = project.source.getChangeKey(event)