|
65 | 65 | )
|
66 | 66 | subparsers = parser.add_subparsers(dest="role", help="Role of the execution")
|
67 | 67 |
|
| 68 | +################################################################################ |
| 69 | +# Run Parameters |
| 70 | +################################################################################ |
68 | 71 | parser_run: argparse.ArgumentParser = subparsers.add_parser(
|
69 | 72 | "run", help="Single run options"
|
70 | 73 | )
|
|
83 | 86 | required=False,
|
84 | 87 | default=None,
|
85 | 88 | )
|
| 89 | +parser_run.add_argument( |
| 90 | + "--print-report", help="Prints the report JSON to stdout", action="store_true" |
| 91 | +) |
| 92 | +parser_run.add_argument( |
| 93 | + "--export", |
| 94 | + help="Export the report JSON to a file", |
| 95 | + type=str, |
| 96 | + required=False, |
| 97 | + default="", |
| 98 | +) |
86 | 99 |
|
| 100 | +################################################################################ |
| 101 | +# Worker Parameters |
| 102 | +################################################################################ |
87 | 103 | parser_worker: argparse.ArgumentParser = subparsers.add_parser(
|
88 | 104 | "worker", help="Worker node options"
|
89 | 105 | )
|
|
101 | 117 | type=str,
|
102 | 118 | )
|
103 | 119 |
|
| 120 | +################################################################################ |
| 121 | +# Coordinator Parameters |
| 122 | +################################################################################ |
104 | 123 | parser_coordinator: argparse.ArgumentParser = subparsers.add_parser(
|
105 | 124 | "coordinator", help="Coordinator node options"
|
106 | 125 | )
|
|
127 | 146 | parser.print_help()
|
128 | 147 |
|
129 | 148 | if args.role == "run":
|
130 |
| - # TODO: Give option to specify config files |
131 | 149 | fio = Fio()
|
132 |
| - config = args.config if args.config is not None else "job_files/default.ini" |
133 |
| - config = FioConfig(config) |
134 |
| - config.print_job_runtime() |
135 |
| - res: FioResult = fio.run(config, args.directory) |
136 |
| - res.print_table() |
| 150 | + config_str: str = args.config or "job_files/default.ini" |
| 151 | + config: FioConfig = FioConfig(config_str).print_job_runtime() |
| 152 | + res: FioResult = fio.run(config, args.directory).print_table() |
| 153 | + if args.print_report: |
| 154 | + print(res.get_json()) |
| 155 | + if args.export != "": |
| 156 | + res.export_json(args.export) |
137 | 157 |
|
138 | 158 | if args.role == "worker":
|
139 | 159 | if args.hostname is None:
|
140 | 160 | args.hostname = hostname
|
141 | 161 | worker.register_worker(args.group, args.hostname).start_worker()
|
142 | 162 |
|
143 | 163 | if args.role == "coordinator":
|
144 |
| - Coordinator().set_worker_groups(args.groups).set_filename(args.filename).run() |
| 164 | + Coordinator().set_worker_groups(args.groups).set_filename( |
| 165 | + args.filename |
| 166 | + ).trigger_benchmark() |
0 commit comments