@@ -113,6 +113,7 @@ async def process_transform(
113113 location = f"{ transform .file_path .value } ::{ transform .class_name .value } " ,
114114 data = data ,
115115 client = service .client ,
116+ convert_query_response = transform .convert_query_response .value ,
116117 ) # type: ignore[misc]
117118
118119 await service .client .execute_graphql (
@@ -301,15 +302,24 @@ async def computed_attribute_setup_jinja2(
301302
302303 triggers = await gather_trigger_computed_attribute_jinja2 ()
303304
304- for trigger in triggers :
305- if event_name != BranchDeletedEvent .event_name and trigger .branch == branch_name :
305+ # Since we can have multiple trigger per NodeKind
306+ # we need to extract the list of unique node that should be processed
307+ # also
308+ # Because the automation in Prefect doesn't capture all information about the computed attribute
309+ # we can't tell right now if a given computed attribute has changed and need to be updated
310+ unique_nodes : set [tuple [str , str , str ]] = {
311+ (trigger .branch , trigger .computed_attribute .kind , trigger .computed_attribute .attribute .name )
312+ for trigger in triggers
313+ }
314+ for branch , kind , attribute_name in unique_nodes :
315+ if event_name != BranchDeletedEvent .event_name and branch == branch_name :
306316 await service .workflow .submit_workflow (
307317 workflow = TRIGGER_UPDATE_JINJA_COMPUTED_ATTRIBUTES ,
308318 context = context ,
309319 parameters = {
310- "branch_name" : trigger . branch ,
311- "computed_attribute_name" : trigger . computed_attribute . attribute . name ,
312- "computed_attribute_kind" : trigger . computed_attribute . kind ,
320+ "branch_name" : branch ,
321+ "computed_attribute_name" : attribute_name ,
322+ "computed_attribute_kind" : kind ,
313323 },
314324 )
315325
@@ -319,6 +329,7 @@ async def computed_attribute_setup_jinja2(
319329 client = prefect_client ,
320330 triggers = triggers ,
321331 trigger_type = TriggerType .COMPUTED_ATTR_JINJA2 ,
332+ force_update = False ,
322333 ) # type: ignore[misc]
323334
324335 log .info (f"{ len (triggers )} Computed Attribute for Jinja2 automation configuration completed" )
@@ -346,18 +357,29 @@ async def computed_attribute_setup_python(
346357
347358 triggers_python , triggers_python_query = await gather_trigger_computed_attribute_python (db = db )
348359
349- for trigger in triggers_python :
350- if event_name != BranchDeletedEvent .event_name and trigger .branch == branch_name :
351- log .info (
352- f"Triggering update for { trigger .computed_attribute .computed_attribute .attribute .name } on { branch_name } "
353- )
360+ # Since we can have multiple trigger per NodeKind
361+ # we need to extract the list of unique node that should be processed
362+ # also
363+ # Because the automation in Prefect doesn't capture all information about the computed attribute
364+ # we can't tell right now if a given computed attribute has changed and need to be updated
365+ unique_nodes : set [tuple [str , str , str ]] = {
366+ (
367+ trigger .branch ,
368+ trigger .computed_attribute .computed_attribute .kind ,
369+ trigger .computed_attribute .computed_attribute .attribute .name ,
370+ )
371+ for trigger in triggers_python
372+ }
373+ for branch , kind , attribute_name in unique_nodes :
374+ if event_name != BranchDeletedEvent .event_name and branch == branch_name :
375+ log .info (f"Triggering update for { kind } .{ attribute_name } on { branch } " )
354376 await service .workflow .submit_workflow (
355377 workflow = TRIGGER_UPDATE_PYTHON_COMPUTED_ATTRIBUTES ,
356378 context = context ,
357379 parameters = {
358380 "branch_name" : branch_name ,
359- "computed_attribute_name" : trigger . computed_attribute . computed_attribute . attribute . name ,
360- "computed_attribute_kind" : trigger . computed_attribute . computed_attribute . kind ,
381+ "computed_attribute_name" : attribute_name ,
382+ "computed_attribute_kind" : kind ,
361383 },
362384 )
363385
0 commit comments