Skip to content

Commit 00e36d5

Browse files
update run_tests scripts based on workload config parsers
1 parent 340fa01 commit 00e36d5

File tree

2 files changed

+103
-60
lines changed

2 files changed

+103
-60
lines changed

perfmetrics/scripts/testing_on_gke/examples/dlio/run_tests.py

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,63 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
"""This program takes in a json dlio test-config file and generates and deploys helm charts."""
19+
20+
import argparse
21+
from collections.abc import Sequence
22+
import os
1823
import subprocess
1924

25+
from absl import app
26+
import dlio_workload
27+
2028

2129
def run_command(command: str):
22-
result = subprocess.run(command.split(" "), capture_output=True, text=True)
30+
result = subprocess.run(command.split(' '), capture_output=True, text=True)
2331
print(result.stdout)
2432
print(result.stderr)
2533

2634

27-
metadataCacheTtlSecs = 6048000
28-
bucketName_numFilesTrain_recordLength_batchSize = [
29-
("gke-dlio-unet3d-100kb-500k", 500000, 102400, 800),
30-
("gke-dlio-unet3d-100kb-500k", 500000, 102400, 128),
31-
("gke-dlio-unet3d-500kb-1m", 1000000, 512000, 800),
32-
("gke-dlio-unet3d-500kb-1m", 1000000, 512000, 128),
33-
("gke-dlio-unet3d-3mb-100k", 100000, 3145728, 200),
34-
("gke-dlio-unet3d-150mb-5k", 5000, 157286400, 4),
35-
]
36-
37-
scenarios = ["gcsfuse-file-cache", "gcsfuse-no-file-cache", "local-ssd"]
38-
39-
for (
40-
bucketName,
41-
numFilesTrain,
42-
recordLength,
43-
batchSize,
44-
) in bucketName_numFilesTrain_recordLength_batchSize:
45-
for scenario in scenarios:
46-
commands = [
47-
f"helm install {bucketName}-{batchSize}-{scenario} unet3d-loading-test",
48-
f"--set bucketName={bucketName}",
49-
f"--set scenario={scenario}",
50-
f"--set dlio.numFilesTrain={numFilesTrain}",
51-
f"--set dlio.recordLength={recordLength}",
52-
f"--set dlio.batchSize={batchSize}",
53-
]
54-
55-
helm_command = " ".join(commands)
56-
57-
run_command(helm_command)
35+
def createHelmInstallCommands(dlioWorkloads):
36+
helm_commands = []
37+
for dlioWorkload in dlioWorkloads:
38+
for batchSize in dlioWorkload.batchSizes:
39+
commands = [
40+
(
41+
'helm install'
42+
f' {dlioWorkload.bucket}-{batchSize}-{dlioWorkload.scenario} unet3d-loading-test'
43+
),
44+
f'--set bucketName={dlioWorkload.bucket}',
45+
f'--set scenario={dlioWorkload.scenario}',
46+
f'--set dlio.numFilesTrain={dlioWorkload.numFilesTrain}',
47+
f'--set dlio.recordLength={dlioWorkload.recordLength}',
48+
f'--set dlio.batchSize={batchSize}',
49+
]
50+
51+
helm_command = ' '.join(commands)
52+
helm_commands.append(helm_command)
53+
return helm_commands
54+
55+
56+
def main(args) -> None:
57+
dlioWorkloads = dlio_workload.ParseTestConfigForDlioWorkloads(
58+
args.workload_config
59+
)
60+
helmInstallCommands = createHelmInstallCommands(dlioWorkloads)
61+
for helmInstallCommand in helmInstallCommands:
62+
print(f'{helmInstallCommand}')
63+
run_command(helmInstallCommand)
64+
65+
66+
if __name__ == '__main__':
67+
parser = argparse.ArgumentParser(
68+
prog='DLIO test runner',
69+
description=(
70+
'This program takes in a json dlio test-config file and generates'
71+
' helm install commands.'
72+
),
73+
# epilog='Text at the bottom of help',
74+
)
75+
parser.add_argument('--workload-config') # positional argument
76+
args = parser.parse_args()
77+
main(args)

perfmetrics/scripts/testing_on_gke/examples/fio/run_tests.py

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,69 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
"""This program takes in a json fio test-config file and generates and deploys helm charts."""
19+
20+
import argparse
21+
from collections.abc import Sequence
22+
import json
23+
import os
24+
import pprint
1825
import subprocess
1926

27+
from absl import app
28+
import fio_workload
29+
2030

2131
def run_command(command: str):
22-
result = subprocess.run(command.split(" "), capture_output=True, text=True)
32+
result = subprocess.run(command.split(' '), capture_output=True, text=True)
2333
print(result.stdout)
2434
print(result.stderr)
2535

2636

27-
bucketName_fileSize_blockSize = [
28-
("gke-fio-64k-1m", "64K", "64K"),
29-
("gke-fio-128k-1m", "128K", "128K"),
30-
("gke-fio-1mb-1m", "1M", "256K"),
31-
("gke-fio-100mb-50k", "100M", "1M"),
32-
("gke-fio-200gb-1", "200G", "1M"),
33-
]
34-
35-
scenarios = ["gcsfuse-file-cache", "gcsfuse-no-file-cache", "local-ssd"]
36-
37-
for bucketName, fileSize, blockSize in bucketName_fileSize_blockSize:
38-
for readType in ["read", "randread"]:
39-
for scenario in scenarios:
40-
if readType == "randread" and fileSize in ["64K", "128K"]:
41-
continue
42-
37+
def createHelmInstallCommands(fioWorkloads):
38+
helm_commands = []
39+
for fioWorkload in fioWorkloads:
40+
for readType in fioWorkload.readTypes:
4341
commands = [
4442
(
45-
"helm install"
46-
f" fio-loading-test-{fileSize.lower()}-{readType}-{scenario} loading-test"
43+
'helm install'
44+
f' fio-loading-test-{fioWorkload.fileSize.lower()}-{readType}-{fioWorkload.scenario} loading-test'
4745
),
48-
f"--set bucketName={bucketName}",
49-
f"--set scenario={scenario}",
50-
f"--set fio.readType={readType}",
51-
f"--set fio.fileSize={fileSize}",
52-
f"--set fio.blockSize={blockSize}",
46+
f'--set bucketName={fioWorkload.bucket}',
47+
f'--set scenario={fioWorkload.scenario}',
48+
f'--set fio.readType={readType}',
49+
f'--set fio.fileSize={fioWorkload.fileSize}',
50+
f'--set fio.blockSize={fioWorkload.blockSize}',
51+
f'--set fio.filesPerThread={fioWorkload.filesPerThread}',
52+
f'--set fio.numThreads={fioWorkload.numThreads}',
5353
]
5454

55-
if fileSize == "100M":
56-
commands.append("--set fio.filesPerThread=1000")
55+
helm_command = ' '.join(commands)
56+
helm_commands.append(helm_command)
57+
return helm_commands
58+
59+
60+
def main(args) -> None:
61+
fioWorkloads = fio_workload.ParseTestConfigForFioWorkloads(
62+
args.workload_config
63+
)
64+
# for fioWorkload in fioWorkloads:
65+
# fioWorkload.PPrint()
66+
helmInstallCommands = createHelmInstallCommands(fioWorkloads)
67+
for helmInstallCommand in helmInstallCommands:
68+
print(f'{helmInstallCommand}')
69+
run_command(f'{helmInstallCommand}')
5770

58-
helm_command = " ".join(commands)
5971

60-
run_command(helm_command)
72+
if __name__ == '__main__':
73+
parser = argparse.ArgumentParser(
74+
prog='FIO test runner',
75+
description=(
76+
'This program takes in a json fio test-config file and generates'
77+
' helm install commands.'
78+
),
79+
# epilog='Text at the bottom of help',
80+
)
81+
parser.add_argument('--workload-config')
82+
args = parser.parse_args()
83+
main(args)

0 commit comments

Comments
 (0)