Skip to content

Commit

Permalink
Fix argparser and dry-run support in run_tests scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
gargnitingoogle committed Aug 7, 2024
1 parent 5865dac commit 2f15628
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
21 changes: 13 additions & 8 deletions perfmetrics/scripts/testing_on_gke/examples/dlio/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
"""This program takes in a json dlio test-config file and generates and deploys helm charts."""

import argparse
from collections.abc import Sequence
import os
import subprocess

from absl import app
import dlio_workload


Expand Down Expand Up @@ -60,18 +56,27 @@ def main(args) -> None:
helmInstallCommands = createHelmInstallCommands(dlioWorkloads)
for helmInstallCommand in helmInstallCommands:
print(f'{helmInstallCommand}')
run_command(helmInstallCommand)
if not args.dry_run:
run_command(helmInstallCommand)


if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog='DLIO test runner',
prog='DLIO Unet3d test runner',
description=(
'This program takes in a json dlio test-config file and generates'
' helm install commands.'
' helm install commands to execute them using the active GKE cluster.'
),
# epilog='Text at the bottom of help',
)
parser.add_argument('--workload-config') # positional argument
parser.add_argument(
'-n',
'--dry-run',
action='store_true',
help=(
'Only print out the test configurations that will run,'
' not actually run them.'
),
)
args = parser.parse_args()
main(args)
25 changes: 13 additions & 12 deletions perfmetrics/scripts/testing_on_gke/examples/fio/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
"""This program takes in a json fio test-config file and generates and deploys helm charts."""

import argparse
from collections.abc import Sequence
import json
import os
import pprint
import subprocess

from absl import app
import fio_workload


Expand Down Expand Up @@ -61,23 +55,30 @@ def main(args) -> None:
fioWorkloads = fio_workload.ParseTestConfigForFioWorkloads(
args.workload_config
)
# for fioWorkload in fioWorkloads:
# fioWorkload.PPrint()
helmInstallCommands = createHelmInstallCommands(fioWorkloads)
for helmInstallCommand in helmInstallCommands:
print(f'{helmInstallCommand}')
run_command(f'{helmInstallCommand}')
if not args.dry_run:
run_command(helmInstallCommand)


if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog='FIO test runner',
description=(
'This program takes in a json fio test-config file and generates'
' helm install commands.'
'This program takes in a json test-config file and generates'
' helm install commands to execute them using the active GKE cluster.'
),
# epilog='Text at the bottom of help',
)
parser.add_argument('--workload-config')
parser.add_argument(
'-n',
'--dry-run',
action='store_true',
help=(
'Only print out the test configurations that will run,'
' not actually run them.'
),
)
args = parser.parse_args()
main(args)

0 comments on commit 2f15628

Please sign in to comment.