112112
113113
114114@transforms .add
115- def rewrite_when_to_optimization (config , jobs ):
116- for job in jobs :
115+ async def rewrite_when_to_optimization (config , jobs ):
116+ async for job in jobs :
117117 when = job .pop ("when" , {})
118118 if not when :
119119 yield job
@@ -132,8 +132,8 @@ def rewrite_when_to_optimization(config, jobs):
132132
133133
134134@transforms .add
135- def set_implementation (config , jobs ):
136- for job in jobs :
135+ async def set_implementation (config , jobs ):
136+ async for job in jobs :
137137 impl , os = worker_type_implementation (config .graph_config , job ["worker-type" ])
138138 if os :
139139 job .setdefault ("tags" , {})["os" ] = os
@@ -148,8 +148,8 @@ def set_implementation(config, jobs):
148148
149149
150150@transforms .add
151- def set_label (config , jobs ):
152- for job in jobs :
151+ async def set_label (config , jobs ):
152+ async for job in jobs :
153153 if "label" not in job :
154154 if "name" not in job :
155155 raise Exception ("job has neither a name nor a label" )
@@ -160,8 +160,8 @@ def set_label(config, jobs):
160160
161161
162162@transforms .add
163- def add_resource_monitor (config , jobs ):
164- for job in jobs :
163+ async def add_resource_monitor (config , jobs ):
164+ async for job in jobs :
165165 if job .get ("attributes" , {}).get ("resource-monitor" ):
166166 worker_implementation , worker_os = worker_type_implementation (
167167 config .graph_config , job ["worker-type" ]
@@ -204,13 +204,13 @@ def get_attribute(dict, key, attributes, attribute_name):
204204
205205
206206@transforms .add
207- def use_fetches (config , jobs ):
207+ async def use_fetches (config , jobs ):
208208 artifact_names = {}
209209 aliases = {}
210210 extra_env = {}
211211
212+ jobs = [j async for j in jobs ]
212213 if config .kind in ("toolchain" , "fetch" ):
213- jobs = list (jobs )
214214 for job in jobs :
215215 run = job .get ("run" , {})
216216 label = job ["label" ]
@@ -353,12 +353,12 @@ def cmp_artifacts(a):
353353
354354
355355@transforms .add
356- def make_task_description (config , jobs ):
356+ async def make_task_description (config , jobs ):
357357 """Given a build description, create a task description"""
358358 # import plugin modules first, before iterating over jobs
359359 import_sibling_modules (exceptions = ("common.py" ,))
360360
361- for job in jobs :
361+ async for job in jobs :
362362 # always-optimized tasks never execute, so have no workdir
363363 if job ["worker" ]["implementation" ] in ("docker-worker" , "generic-worker" ):
364364 job ["run" ].setdefault ("workdir" , "/builds/worker" )
0 commit comments