@@ -72,28 +72,26 @@ async def produce_event_for_build(
7272 build_db : Any = await master .data .get (("builds" , str (build .buildid )))
7373 if result is not None :
7474 build_db ["results" ] = result
75- master .mq .produce (
76- ("builds" , str (build .buildid ), event .name ), copy .deepcopy (build_db )
77- )
75+ event_key = ("builds" , str (build .buildid ), event .value )
76+ master .mq .produce (event_key , copy .deepcopy (build_db ))
7877 elif isinstance (build , dict ):
7978 if result is not None :
8079 build ["results" ] = result
81- master .mq .produce (
82- ("builds" , str (build ["buildid" ]), event .name ), copy .deepcopy (build )
83- )
80+ event_key = ("builds" , str (build ["buildid" ]), event .value )
81+ master .mq .produce (event_key , copy .deepcopy (build ))
8482
8583
8684@implementer (IReportGenerator )
8785class BuildNixEvalStatusGenerator (BuildStatusGeneratorMixin ):
8886 wanted_event_keys : ClassVar [list [Any ]] = [
89- ("builds" , None , str ( CombinedBuildEvent .STARTED_NIX_EVAL .name ) ),
90- ("builds" , None , str ( CombinedBuildEvent .FINISHED_NIX_EVAL .name ) ),
91- ("builds" , None , str ( CombinedBuildEvent .STARTED_NIX_BUILD .name ) ),
92- ("builds" , None , str ( CombinedBuildEvent .FINISHED_NIX_BUILD .name ) ),
93- ("builds" , None , str ( CombinedBuildEvent .STARTED_NIX_EFFECTS .name ) ),
94- ("builds" , None , str ( CombinedBuildEvent .FINISHED_NIX_EFFECTS .name ) ),
95- ("buildrequests" , None , str ( CombinedBuildEvent .STARTED_NIX_BUILD .name ) ),
96- ("buildrequests" , None , str ( CombinedBuildEvent .FINISHED_NIX_BUILD .name ) ),
87+ ("builds" , None , CombinedBuildEvent .STARTED_NIX_EVAL .value ),
88+ ("builds" , None , CombinedBuildEvent .FINISHED_NIX_EVAL .value ),
89+ ("builds" , None , CombinedBuildEvent .STARTED_NIX_BUILD .value ),
90+ ("builds" , None , CombinedBuildEvent .FINISHED_NIX_BUILD .value ),
91+ ("builds" , None , CombinedBuildEvent .STARTED_NIX_EFFECTS .value ),
92+ ("builds" , None , CombinedBuildEvent .FINISHED_NIX_EFFECTS .value ),
93+ ("buildrequests" , None , CombinedBuildEvent .STARTED_NIX_BUILD .value ),
94+ ("buildrequests" , None , CombinedBuildEvent .FINISHED_NIX_BUILD .value ),
9795 ]
9896
9997 compare_attrs : ClassVar [list [str ]] = ["start_formatter" , "end_formatter" ]
@@ -185,9 +183,14 @@ async def generate(
185183 ) -> None | dict [str , Any ]:
186184 what , _ , event = key
187185 if what == "builds" :
188- is_new = event == "new"
186+ # Check if this is a start event
187+ is_start_event = event in [
188+ CombinedBuildEvent .STARTED_NIX_EVAL .value ,
189+ CombinedBuildEvent .STARTED_NIX_BUILD .value ,
190+ CombinedBuildEvent .STARTED_NIX_EFFECTS .value ,
191+ ]
189192
190- formatter = self .start_formatter if is_new else self .end_formatter
193+ formatter = self .start_formatter if is_start_event else self .end_formatter
191194
192195 await getDetailsForBuild (
193196 master ,
@@ -204,9 +207,8 @@ async def generate(
204207 report : dict [str , Any ] = await self .build_message (
205208 formatter , master , reporter , data
206209 )
207-
208- event_typed : CombinedBuildEvent = CombinedBuildEvent .__members__ [event ]
209- match event_typed :
210+ event_type = CombinedBuildEvent (event )
211+ match event_type :
210212 case (
211213 CombinedBuildEvent .STARTED_NIX_EVAL
212214 | CombinedBuildEvent .FINISHED_NIX_EVAL
@@ -236,10 +238,10 @@ async def generate(
236238 "generator" ,
237239 )
238240 case _:
239- msg = f"Unexpected event: { event_typed } "
241+ msg = f"Unexpected event: { event_type } "
240242 raise ValueError (msg )
241243
242- match event_typed :
244+ match event_type :
243245 case (
244246 CombinedBuildEvent .FINISHED_NIX_EVAL
245247 | CombinedBuildEvent .FINISHED_NIX_BUILD
0 commit comments