|
15 | 15 | # See the License for the specific language governing permissions and
|
16 | 16 | # limitations under the License.
|
17 | 17 |
|
| 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 |
18 | 25 | import subprocess
|
19 | 26 |
|
| 27 | +from absl import app |
| 28 | +import fio_workload |
| 29 | + |
20 | 30 |
|
21 | 31 | 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) |
23 | 33 | print(result.stdout)
|
24 | 34 | print(result.stderr)
|
25 | 35 |
|
26 | 36 |
|
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: |
43 | 41 | commands = [
|
44 | 42 | (
|
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' |
47 | 45 | ),
|
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}', |
53 | 53 | ]
|
54 | 54 |
|
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}') |
57 | 70 |
|
58 |
| - helm_command = " ".join(commands) |
59 | 71 |
|
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