@@ -20,32 +20,12 @@ class BuildkiteCommandStep(BaseModel):
2020 env : Optional [Dict [str , str ]] = None
2121 parallelism : Optional [int ] = None
2222
23- def to_yaml (self ):
24- return {
25- "label" : self .label ,
26- "group" : self .group ,
27- "commands" : self .commands ,
28- "depends_on" : self .depends_on ,
29- "soft_fail" : self .soft_fail ,
30- "retry" : self .retry ,
31- "plugins" : self .plugins ,
32- "env" : self .env ,
33- "retry" : self .retry ,
34- "parallelism" : self .parallelism
35- }
3623
3724class BuildkiteBlockStep (BaseModel ):
3825 block : str
3926 depends_on : Optional [Union [str , List [str ]]] = None
4027 key : Optional [str ] = None
4128
42- def to_yaml (self ):
43- return {
44- "block" : self .block ,
45- "depends_on" : self .depends_on ,
46- "key" : self .key
47- }
48-
4929class BuildkiteGroupStep (BaseModel ):
5030 group : str
5131 steps : List [Union [BuildkiteCommandStep , BuildkiteBlockStep ]]
@@ -57,29 +37,27 @@ def _get_step_plugin(step: Step):
5737 else :
5838 return {"docker#v5.2.0" : get_docker_plugin (step , get_image (step .no_gpu ))}
5939
40+ _GPU_TO_QUEUE = {
41+ GPUType .A100 .value : AgentQueue .A100_QUEUE ,
42+ GPUType .H100 .value : AgentQueue .MITHRIL_H100_POOL ,
43+ GPUType .H200 .value : AgentQueue .SKYLAB_H200 ,
44+ GPUType .B200 .value : AgentQueue .B200 ,
45+ }
46+
47+
6048def get_agent_queue (step : Step ):
6149 branch = get_global_config ()["branch" ]
6250 if step .label .startswith (":docker:" ):
63- if branch == "main" :
64- return AgentQueue .CPU_QUEUE_POSTMERGE_US_EAST_1
65- else :
66- return AgentQueue .CPU_QUEUE_PREMERGE_US_EAST_1
67- elif step .label == "Documentation Build" :
51+ return AgentQueue .CPU_QUEUE_POSTMERGE_US_EAST_1 if branch == "main" else AgentQueue .CPU_QUEUE_PREMERGE_US_EAST_1
52+ if step .label == "Documentation Build" :
6853 return AgentQueue .SMALL_CPU_QUEUE_PREMERGE
69- elif step .no_gpu :
54+ if step .no_gpu :
7055 return AgentQueue .CPU_QUEUE_PREMERGE_US_EAST_1
71- elif step .gpu == GPUType .A100 :
72- return AgentQueue .A100_QUEUE
73- elif step .gpu == GPUType .H100 :
74- return AgentQueue .MITHRIL_H100_POOL
75- elif step .gpu == GPUType .H200 :
76- return AgentQueue .SKYLAB_H200
77- elif step .gpu == GPUType .B200 :
78- return AgentQueue .B200
79- elif step .num_gpus == 2 or step .num_gpus == 4 :
56+ if step .gpu in _GPU_TO_QUEUE :
57+ return _GPU_TO_QUEUE [step .gpu ]
58+ if step .num_gpus in (2 , 4 ):
8059 return AgentQueue .GPU_4_QUEUE
81- else :
82- return AgentQueue .GPU_1_QUEUE
60+ return AgentQueue .GPU_1_QUEUE
8361
8462def _get_variables_to_inject () -> Dict [str , str ]:
8563 global_config = get_global_config ()
@@ -189,12 +167,15 @@ def _step_should_run(step: Step, list_file_diff: List[str]) -> bool:
189167 return False
190168 if global_config ["run_all" ]:
191169 return True
192- if step .source_file_dependencies :
193- for source_file in step .source_file_dependencies :
194- for diff_file in list_file_diff :
195- if source_file in diff_file :
196- return True
197- return True
170+ # If no dependencies specified, always run
171+ if not step .source_file_dependencies :
172+ return True
173+ # Only run if at least one dependency matches a changed file
174+ for source_file in step .source_file_dependencies :
175+ for diff_file in list_file_diff :
176+ if source_file in diff_file :
177+ return True
178+ return False
198179
199180def _generate_step_key (step_label : str ) -> str :
200181 return (
0 commit comments