@@ -835,11 +835,11 @@ def build_dummy_payload(config, task, task_def):
835835
836836
837837@transforms .add
838- def set_implementation (config , tasks ):
838+ async def set_implementation (config , tasks ):
839839 """
840840 Set the worker implementation based on the worker-type alias.
841841 """
842- for task in tasks :
842+ async for task in tasks :
843843 worker = task .setdefault ("worker" , {})
844844 if "implementation" in task ["worker" ]:
845845 yield task
@@ -859,8 +859,8 @@ def set_implementation(config, tasks):
859859
860860
861861@transforms .add
862- def set_defaults (config , tasks ):
863- for task in tasks :
862+ async def set_defaults (config , tasks ):
863+ async for task in tasks :
864864 task .setdefault ("always-target" , False )
865865 task .setdefault ("optimization" , None )
866866 task .setdefault ("needs-sccache" , False )
@@ -903,8 +903,8 @@ def set_defaults(config, tasks):
903903
904904
905905@transforms .add
906- def task_name_from_label (config , tasks ):
907- for task in tasks :
906+ async def task_name_from_label (config , tasks ):
907+ async for task in tasks :
908908 if "label" not in task :
909909 if "name" not in task :
910910 raise Exception ("task has neither a name nor a label" )
@@ -915,8 +915,8 @@ def task_name_from_label(config, tasks):
915915
916916
917917@transforms .add
918- def validate (config , tasks ):
919- for task in tasks :
918+ async def validate (config , tasks ):
919+ async for task in tasks :
920920 validate_schema (
921921 task_description_schema ,
922922 task ,
@@ -953,8 +953,8 @@ def add_generic_index_routes(config, task):
953953
954954
955955@transforms .add
956- def process_treeherder_metadata (config , tasks ):
957- for task in tasks :
956+ async def process_treeherder_metadata (config , tasks ):
957+ async for task in tasks :
958958 routes = task .get ("routes" , [])
959959 extra = task .get ("extra" , {})
960960 task_th = task .get ("treeherder" )
@@ -1025,8 +1025,8 @@ def process_treeherder_metadata(config, tasks):
10251025
10261026
10271027@transforms .add
1028- def add_index_routes (config , tasks ):
1029- for task in tasks :
1028+ async def add_index_routes (config , tasks ):
1029+ async for task in tasks :
10301030 index = task .get ("index" , {})
10311031
10321032 # The default behavior is to rank tasks according to their tier
@@ -1057,8 +1057,8 @@ def add_index_routes(config, tasks):
10571057
10581058
10591059@transforms .add
1060- def build_task (config , tasks ):
1061- for task in tasks :
1060+ async def build_task (config , tasks ):
1061+ async for task in tasks :
10621062 level = str (config .params ["level" ])
10631063
10641064 provisioner_id , worker_type = get_worker_type (
@@ -1219,24 +1219,24 @@ def build_task(config, tasks):
12191219
12201220
12211221@transforms .add
1222- def add_github_checks (config , tasks ):
1222+ async def add_github_checks (config , tasks ):
12231223 """
12241224 For git repositories, add checks route to all tasks.
12251225
12261226 This will be replaced by a configurable option in the future.
12271227 """
12281228 if config .params ["repository_type" ] != "git" :
1229- for task in tasks :
1229+ async for task in tasks :
12301230 yield task
12311231
1232- for task in tasks :
1232+ async for task in tasks :
12331233 task ["task" ]["routes" ].append ("checks" )
12341234 yield task
12351235
12361236
12371237@transforms .add
1238- def chain_of_trust (config , tasks ):
1239- for task in tasks :
1238+ async def chain_of_trust (config , tasks ):
1239+ async for task in tasks :
12401240 if task ["task" ].get ("payload" , {}).get ("features" , {}).get ("chainOfTrust" ):
12411241 image = task .get ("dependencies" , {}).get ("docker-image" )
12421242 if image :
@@ -1250,12 +1250,12 @@ def chain_of_trust(config, tasks):
12501250
12511251
12521252@transforms .add
1253- def check_task_identifiers (config , tasks ):
1253+ async def check_task_identifiers (config , tasks ):
12541254 """Ensures that all tasks have well defined identifiers:
12551255 ``^[a-zA-Z0-9_-]{1,38}$``
12561256 """
12571257 e = re .compile ("^[a-zA-Z0-9_-]{1,38}$" )
1258- for task in tasks :
1258+ async for task in tasks :
12591259 for attrib in ("workerType" , "provisionerId" ):
12601260 if not e .match (task ["task" ][attrib ]):
12611261 raise Exception (
@@ -1267,9 +1267,9 @@ def check_task_identifiers(config, tasks):
12671267
12681268
12691269@transforms .add
1270- def check_task_dependencies (config , tasks ):
1270+ async def check_task_dependencies (config , tasks ):
12711271 """Ensures that tasks don't have more than 100 dependencies."""
1272- for task in tasks :
1272+ async for task in tasks :
12731273 number_of_dependencies = (
12741274 len (task ["dependencies" ])
12751275 + len (task ["if-dependencies" ])
@@ -1315,7 +1315,7 @@ def check_caches_are_volumes(task):
13151315
13161316
13171317@transforms .add
1318- def check_run_task_caches (config , tasks ):
1318+ async def check_run_task_caches (config , tasks ):
13191319 """Audit for caches requiring run-task.
13201320
13211321 run-task manages caches in certain ways. If a cache managed by run-task
@@ -1340,7 +1340,7 @@ def check_run_task_caches(config, tasks):
13401340
13411341 suffix = _run_task_suffix ()
13421342
1343- for task in tasks :
1343+ async for task in tasks :
13441344 payload = task ["task" ].get ("payload" , {})
13451345 command = payload .get ("command" ) or ["" ]
13461346
0 commit comments