Skip to content

Commit 821d2bf

Browse files
Address code review feedback: move imports to top, improve comments
Co-authored-by: functionstackx <47992694+functionstackx@users.noreply.github.com>
1 parent 59dbbb0 commit 821d2bf

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/workflows/example-batched-matrix.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
strategy:
4848
matrix:
4949
# Generate array [0, 1, 2, ..., batch-count-1]
50+
# This expression creates a comma-separated list of indices and wraps it in an array
51+
# Example: if batch-count=3, this generates: [0, 1, 2]
52+
# Note: This is a workaround for GitHub Actions' lack of native range array generation
5053
batch-index: ${{ fromJson(format('[{0}]', join(range(0, fromJson(needs.get-batch-count.outputs.batch-count)), ','))) }}
5154
outputs:
5255
# Each batch gets its own output

utils/matrix-logic/generate_sweep_configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import yaml
33
import argparse
4+
import math
45
from pydantic import BaseModel, Field, ValidationError, ConfigDict
56
from typing import List
67

@@ -980,7 +981,6 @@ def main():
980981
validate_matrix_output(matrix_values)
981982

982983
# Calculate number of batches
983-
import math
984984
total_batches = math.ceil(len(matrix_values) / args.max_batch_size)
985985

986986
# If only batch count requested, output it and exit

utils/matrix-logic/test_generate_sweep_configs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import yaml
3+
import math
34
from unittest.mock import patch
45
from generate_sweep_configs import (
56
validate_master_configs_structure,
@@ -1669,7 +1670,6 @@ def test_main_with_get_batch_count(temp_config_files):
16691670
'--get-batch-count']):
16701671
batch_count = main()
16711672

1672-
import math
16731673
expected_batches = math.ceil(len(all_results) / 2)
16741674
assert batch_count == expected_batches
16751675

@@ -1699,7 +1699,6 @@ def test_main_batch_covers_all_configs(temp_config_files):
16991699

17001700
# Get results in batches of 2
17011701
batch_size = 2
1702-
import math
17031702
num_batches = math.ceil(len(all_results) / batch_size)
17041703

17051704
batched_results = []

0 commit comments

Comments
 (0)