Skip to content

Commit ba64a8f

Browse files
committed
Lint and formatting
1 parent 8a0a19a commit ba64a8f

File tree

11 files changed

+50
-89
lines changed

11 files changed

+50
-89
lines changed

buildkite/pipeline_generator/ci/ci_pipeline.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
from typing import Any, Dict, List, Union
44

55
from ..core.amd_tests import generate_amd_group
6-
from ..core.docker_builds import (
7-
generate_cpu_build_step,
8-
generate_cu118_build_steps,
9-
generate_main_build_step,
10-
)
6+
from ..core.docker_builds import generate_cpu_build_step, generate_cu118_build_steps, generate_main_build_step
117
from ..core.hardware_tests import generate_all_hardware_tests
128
from ..core.manual_trigger_rules import should_block_ci_test
139
from ..core.test_step_converter import convert_test_step_to_buildkite_step
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
"""Core pipeline generation modules - unified CI and Fastcheck logic."""
2-

buildkite/pipeline_generator/core/amd_tests.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ def get_amd_queue_ci(label: str, num_gpus: Optional[int] = None) -> str:
4040
def generate_amd_group(test_steps: List[TestStep], config: PipelineGeneratorConfig) -> Dict[str, Any]:
4141
"""
4242
Generate the AMD tests group.
43-
43+
4444
CI mode: All matching tests, no blocks, soft_fail=false, uses AMD MI325 queues
4545
Fastcheck mode: Only Basic Correctness Test, has block, soft_fail=true, uses MI300_1 queue
4646
"""
4747
amd_steps = []
4848

4949
# Add AMD build step (now returns dict directly)
5050
amd_build_dict = generate_amd_build_step(config)
51-
51+
5252
# Fastcheck needs depends_on: null explicitly
5353
if config.pipeline_mode == PipelineMode.FASTCHECK:
5454
amd_build_dict["depends_on"] = None
55-
55+
5656
amd_steps.append(amd_build_dict)
5757

5858
# Add AMD mirror tests
@@ -65,7 +65,7 @@ def generate_amd_group(test_steps: List[TestStep], config: PipelineGeneratorConf
6565
if config.pipeline_mode == PipelineMode.FASTCHECK:
6666
if test_step.label != TestLabels.BASIC_CORRECTNESS_TEST:
6767
continue
68-
68+
6969
# Fastcheck adds a block for Basic Correctness Test
7070
block_key = f"block-amd-{get_step_key(test_step.label)}"
7171
amd_steps.append(
@@ -105,4 +105,3 @@ def generate_amd_group(test_steps: List[TestStep], config: PipelineGeneratorConf
105105
amd_steps.append(amd_step_dict)
106106

107107
return {"group": "AMD Tests", "depends_on": None, "steps": amd_steps}
108-

buildkite/pipeline_generator/core/docker_builds.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Unified Docker build step generation for both CI and Fastcheck modes."""
22

3-
from typing import Any, Dict, List, Optional, Union
3+
from typing import Dict, List, Optional, Union
44

55
from ..data_models.buildkite_step import BuildkiteBlockStep, BuildkiteStep
66
from ..docker_build_configs import (
@@ -18,10 +18,10 @@
1818
def generate_main_build_step(config: PipelineGeneratorConfig) -> Union[BuildkiteStep, Dict]:
1919
"""
2020
Build the main Docker CUDA image.
21-
21+
2222
CI: Uses postmerge/test repo based on branch
2323
Fastcheck: Always uses test-repo with premerge queue
24-
24+
2525
Returns dict directly to preserve all fields (especially 'key')
2626
"""
2727
if config.pipeline_mode == PipelineMode.FASTCHECK:
@@ -52,12 +52,12 @@ def generate_cu118_build_steps(
5252
) -> List[Union[BuildkiteStep, BuildkiteBlockStep]]:
5353
"""
5454
Build the CUDA 11.8 Docker image.
55-
55+
5656
CI only - returns empty list for Fastcheck mode.
5757
"""
5858
if config.pipeline_mode == PipelineMode.FASTCHECK:
5959
return [] # Fastcheck doesn't build cu118
60-
60+
6161
# CI mode
6262
queue = AgentQueue.CPU_QUEUE_POSTMERGE_US_EAST_1 if config.branch == "main" else AgentQueue.CPU_QUEUE_PREMERGE_US_EAST_1
6363

@@ -80,13 +80,13 @@ def generate_cu118_build_steps(
8080
def generate_cpu_build_step(config: PipelineGeneratorConfig) -> Optional[Dict]:
8181
"""
8282
Build the CPU Docker image.
83-
83+
8484
CI only - returns None for Fastcheck mode.
8585
Returns dict directly to preserve all fields.
8686
"""
8787
if config.pipeline_mode == PipelineMode.FASTCHECK:
8888
return None # Fastcheck doesn't build CPU image
89-
89+
9090
# CI mode
9191
queue = AgentQueue.CPU_QUEUE_POSTMERGE_US_EAST_1 if config.branch == "main" else AgentQueue.CPU_QUEUE_PREMERGE_US_EAST_1
9292

@@ -99,7 +99,7 @@ def generate_cpu_build_step(config: PipelineGeneratorConfig) -> Optional[Dict]:
9999
def generate_torch_nightly_build_step(config: PipelineGeneratorConfig, depends_on: Optional[str]) -> Dict:
100100
"""
101101
Build the torch nightly Docker image.
102-
102+
103103
CI only - should not be called in Fastcheck mode.
104104
Returns dict directly to preserve all fields.
105105
"""
@@ -124,7 +124,7 @@ def generate_torch_nightly_build_step(config: PipelineGeneratorConfig, depends_o
124124
def generate_amd_build_step(config: PipelineGeneratorConfig) -> Dict:
125125
"""
126126
Build the AMD Docker image.
127-
127+
128128
Different configurations for CI vs Fastcheck.
129129
Returns dict directly to preserve all fields.
130130
"""
@@ -137,4 +137,3 @@ def generate_amd_build_step(config: PipelineGeneratorConfig) -> Dict:
137137

138138
# Return dict directly
139139
return amd_config.to_buildkite_step()
140-

buildkite/pipeline_generator/core/docker_plugins.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def build_full_docker_command(test_step: TestStep, config: PipelineGeneratorConf
7474
docker_command = build_docker_command_fastcheck(test_step, config)
7575
else: # CI mode
7676
docker_command = build_docker_command_ci(test_step, config)
77-
77+
7878
working_dir = test_step.working_dir or DEFAULT_WORKING_DIR
7979
return f"{ShellCommands.CHECK_NVIDIA_GPU} && {ShellCommands.SETUP_DEPRECATED_BEAM_SEARCH} && cd {working_dir} && {docker_command}"
8080

@@ -116,12 +116,12 @@ def build_environment(test_step: TestStep, config: PipelineGeneratorConfig) -> D
116116
def build_docker_plugin(test_step: TestStep, container_image: str, config: PipelineGeneratorConfig) -> Dict:
117117
"""Build standard Docker plugin configuration."""
118118
full_command = build_full_docker_command(test_step, config)
119-
119+
120120
# CI mode adds trailing space; Fastcheck doesn't
121121
if config.pipeline_mode == PipelineMode.CI:
122122
if full_command and not full_command.endswith(" "):
123123
full_command += " "
124-
124+
125125
bash_flags = "-xce" if config.fail_fast else "-xc"
126126

127127
# Build environment configuration (mode-aware)
@@ -132,9 +132,9 @@ def build_docker_plugin(test_step: TestStep, container_image: str, config: Pipel
132132

133133
# Determine if mount_buildkite_agent is needed
134134
if config.pipeline_mode == PipelineMode.FASTCHECK:
135-
mount_agent = test_step.label == TestLabels.BENCHMARKS or test_step.mount_buildkite_agent
135+
mount_agent = test_step.label == TestLabels.BENCHMARKS or bool(test_step.mount_buildkite_agent)
136136
else: # CI mode
137-
mount_agent = test_step.label == TestLabels.BENCHMARKS or test_step.mount_buildkite_agent or config.cov_enabled
137+
mount_agent = test_step.label == TestLabels.BENCHMARKS or bool(test_step.mount_buildkite_agent) or config.cov_enabled
138138

139139
docker_config = StandardDockerConfig(
140140
image=container_image,
@@ -152,12 +152,12 @@ def build_docker_plugin(test_step: TestStep, container_image: str, config: Pipel
152152
def build_special_gpu_plugin(test_step: TestStep, container_image: str, config: PipelineGeneratorConfig) -> Dict:
153153
"""Build Docker plugin for special GPUs (H200, B200)."""
154154
full_command = build_full_docker_command(test_step, config)
155-
155+
156156
# CI mode adds trailing space
157157
if config.pipeline_mode == PipelineMode.CI:
158158
if full_command and not full_command.endswith(" "):
159159
full_command += " "
160-
160+
161161
bash_flags = "-xce" if config.fail_fast else "-xc"
162162

163163
gpu_type = test_step.gpu.value if test_step.gpu else "h200"
@@ -191,7 +191,7 @@ def build_special_gpu_plugin(test_step: TestStep, container_image: str, config:
191191
def build_fastcheck_a100_kubernetes_plugin(test_step: TestStep, container_image: str) -> Dict:
192192
"""Build Kubernetes plugin for A100 in fastcheck mode (fastcheck-specific)."""
193193
# Build command without coverage
194-
commands = flatten_commands(test_step.commands)
194+
commands = flatten_commands(test_step.commands or [])
195195
commands = normalize_commands(commands)
196196
docker_command = " && ".join(commands)
197197
working_dir = test_step.working_dir or DEFAULT_WORKING_DIR
@@ -282,7 +282,7 @@ def build_plugin_for_test_step(test_step: TestStep, container_image: str, config
282282
return build_fastcheck_a100_kubernetes_plugin(test_step, container_image)
283283
# All other GPUs (H100, H200, B200, etc.) use standard Docker in fastcheck
284284
return build_docker_plugin(test_step, container_image, config)
285-
285+
286286
# CI mode: special handling for multiple GPU types
287287
# CI mode uses Kubernetes for H100 and A100
288288
if test_step.gpu in [GPUType.H100, GPUType.A100]:
@@ -294,4 +294,3 @@ def build_plugin_for_test_step(test_step: TestStep, container_image: str, config
294294

295295
# Standard Docker for all others
296296
return build_docker_plugin(test_step, container_image, config)
297-

buildkite/pipeline_generator/core/hardware_tests.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
get_tpu_notification_config,
1919
get_tpu_v0_notification_config,
2020
)
21-
from ..utils.constants import AgentQueue, BlockLabels, HardwareLabels, PipelineMode, Scripts
21+
from ..utils.constants import AgentQueue, BlockLabels, HardwareLabels, Scripts
2222

2323

2424
def generate_all_hardware_tests(branch: str, nightly: bool) -> List[Dict[str, Any]]:
2525
"""
2626
Generate all hardware-specific test steps using data-driven configuration.
27-
27+
2828
Used by CI mode. Returns CI-specific hardware tests without blocking steps.
2929
"""
3030
steps = []
@@ -68,7 +68,9 @@ def generate_all_hardware_tests(branch: str, nightly: bool) -> List[Dict[str, An
6868
if branch == "main":
6969
tpu_depends_on = get_tpu_notification_config()
7070
# Build notification command with proper indentation
71-
tpu_notif_command = """if [[ $$(buildkite-agent step get "outcome" --step "run-tpu-v1-test") != "passed" || $$(buildkite-agent step get "outcome" --step "run-tpu-v1-test-part2") != "passed" ]]; then
71+
tpu_notif_command = (
72+
"""if [[ $$(buildkite-agent step get "outcome" --step "run-tpu-v1-test") != "passed" || """
73+
"""$$(buildkite-agent step get "outcome" --step "run-tpu-v1-test-part2") != "passed" ]]; then
7274
cat <<- YAML | buildkite-agent pipeline upload
7375
steps:
7476
- label: "Notify owners about failing test"
@@ -81,6 +83,7 @@ def generate_all_hardware_tests(branch: str, nightly: bool) -> List[Dict[str, An
8183
- "vllm#tpu-ci-notifications"
8284
YAML
8385
fi"""
86+
)
8487
steps.append(
8588
{
8689
"label": "TPU V1 Test Notification",
@@ -205,4 +208,3 @@ def add_neuron_test_fastcheck(steps: List) -> None:
205208
}
206209
steps.append(neuron_block)
207210
steps.append(neuron_test)
208-

buildkite/pipeline_generator/core/manual_trigger_rules.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,10 @@ def should_block_torch_nightly_test(test_step: TestStep, config: PipelineGenerat
9393
def should_block_test(test_step: TestStep, config: PipelineGeneratorConfig) -> bool:
9494
"""
9595
Unified function to determine if a test needs a manual trigger block.
96-
96+
9797
Routes to mode-specific logic based on config.pipeline_mode.
9898
"""
9999
if config.pipeline_mode == PipelineMode.FASTCHECK:
100100
return should_block_fastcheck_test(test_step, config)
101101
else: # CI mode
102102
return should_block_ci_test(test_step, config)
103-

buildkite/pipeline_generator/core/test_filtering.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
from ..data_models.test_step import TestStep
66
from ..pipeline_config import PipelineGeneratorConfig
7-
from ..utils.constants import PipelineMode
87

98

109
def should_run_step(test_step: TestStep, config: PipelineGeneratorConfig) -> bool:
1110
"""
1211
Determine if a step should run based on configuration and file changes.
13-
12+
1413
Used by CI mode for intelligent test selection.
1514
"""
1615
# Always run if run_all or nightly is enabled
@@ -176,4 +175,3 @@ def extract_pytest_markers(commands) -> str:
176175
return f" -m {marker}"
177176

178177
return ""
179-

buildkite/pipeline_generator/core/test_step_converter.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@
66
from ..data_models.test_step import TestStep
77
from ..pipeline_config import PipelineGeneratorConfig
88
from ..utils.agent_queues import get_agent_queue
9-
from ..utils.constants import (
10-
DEFAULT_WORKING_DIR,
11-
AgentQueue,
12-
GPUType,
13-
PipelineMode,
14-
PriorityValues,
15-
RetryConfig,
16-
Scripts,
17-
TestLabels,
18-
)
9+
from ..utils.constants import DEFAULT_WORKING_DIR, AgentQueue, GPUType, PipelineMode, PriorityValues, RetryConfig, Scripts, TestLabels
1910
from .docker_plugins import build_plugin_for_test_step
2011

2112

@@ -30,8 +21,8 @@ def convert_multi_node_test_step_ci(test_step: TestStep, container_image: str, c
3021
node_commands = test_step.commands # type: ignore
3122
else:
3223
# Fallback: use the same commands for all nodes
33-
simple_commands: List[str] = test_step.commands if test_step.commands else []
34-
node_commands = [simple_commands] * (test_step.num_nodes or 2)
24+
simple_commands = test_step.commands if test_step.commands else []
25+
node_commands = [simple_commands] * (test_step.num_nodes or 2) # type: ignore
3526

3627
# Build the multi-node command
3728
quoted_node_commands = []
@@ -78,8 +69,8 @@ def convert_multi_node_test_step_fastcheck(test_step: TestStep, container_image:
7869
if test_step.commands and len(test_step.commands) > 0 and isinstance(test_step.commands[0], list):
7970
node_commands = test_step.commands # type: ignore
8071
else:
81-
simple_commands: List[str] = test_step.commands if test_step.commands else []
82-
node_commands = [simple_commands] * (test_step.num_nodes or 2)
72+
simple_commands = test_step.commands if test_step.commands else []
73+
node_commands = [simple_commands] * (test_step.num_nodes or 2) # type: ignore
8374

8475
# Build the multi-node command
8576
quoted_node_commands = []
@@ -123,7 +114,7 @@ def get_agent_queue_fastcheck(test_step: TestStep) -> str:
123114
def convert_test_step_to_buildkite_step(test_step: TestStep, container_image: str, config: PipelineGeneratorConfig) -> BuildkiteStep:
124115
"""
125116
Unified function to convert TestStep into BuildkiteStep.
126-
117+
127118
Routes to mode-specific logic based on config.pipeline_mode.
128119
"""
129120
# Check if this is a multi-node test
@@ -143,10 +134,10 @@ def convert_test_step_to_buildkite_step(test_step: TestStep, container_image: st
143134
agent_queue = AgentQueue.A100_QUEUE
144135
else:
145136
agent_queue = get_agent_queue_fastcheck(test_step)
146-
137+
147138
# Fastcheck uses retry_limit = 5 (except for A100 which is handled below)
148139
retry_limit = 5
149-
140+
150141
# A100 in fastcheck has special handling
151142
if test_step.gpu == GPUType.A100:
152143
return BuildkiteStep(
@@ -192,4 +183,3 @@ def convert_test_step_to_buildkite_step(test_step: TestStep, container_image: st
192183
)
193184

194185
return buildkite_step
195-

buildkite/pipeline_generator/data_models/docker_config.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ def to_plugin_dict(self) -> Dict[str, Any]:
214214
},
215215
{"name": "NCCL_CUMEM_HOST_ENABLE", "value": "0"},
216216
{"name": "HF_HOME", "value": HF_HOME},
217+
{
218+
"name": "HF_TOKEN",
219+
"valueFrom": {
220+
"secretKeyRef": {
221+
"name": KubernetesConstants.HF_TOKEN_SECRET_NAME,
222+
"key": KubernetesConstants.HF_TOKEN_SECRET_KEY,
223+
}
224+
},
225+
},
217226
],
218227
}
219228
],
@@ -235,18 +244,6 @@ def to_plugin_dict(self) -> Dict[str, Any]:
235244

236245
if self.priority_class:
237246
pod_spec["priorityClassName"] = self.priority_class
238-
# Add HF_TOKEN secret for A100
239-
pod_spec["containers"][0]["env"].append(
240-
{
241-
"name": "HF_TOKEN",
242-
"valueFrom": {
243-
"secretKeyRef": {
244-
"name": KubernetesConstants.HF_TOKEN_SECRET_NAME,
245-
"key": KubernetesConstants.HF_TOKEN_SECRET_KEY,
246-
}
247-
},
248-
}
249-
)
250247

251248
return {PluginNames.KUBERNETES: {"podSpec": pod_spec}}
252249

0 commit comments

Comments
 (0)