|
18 | 18 | allow you to use the production server.
|
19 | 19 | """
|
20 | 20 |
|
| 21 | +import logging |
21 | 22 | import random
|
22 | 23 | import sys
|
23 | 24 | from argparse import ArgumentParser, Namespace
|
24 | 25 | from typing import Iterator, Optional, Tuple
|
25 | 26 |
|
26 | 27 | import requests
|
27 | 28 |
|
| 29 | +logging.basicConfig(level=logging.INFO) |
| 30 | + |
28 | 31 |
|
29 | 32 | def get_args() -> Namespace:
|
30 | 33 | """Parse command line arguments
|
@@ -223,24 +226,24 @@ def main():
|
223 | 226 |
|
224 | 227 | queues = QueueDataGenerator(num_queues=args.queues)
|
225 | 228 | testflinger_client.post_queue_data(queues=queues)
|
226 |
| - print(f"Created {args.queues} queues") |
| 229 | + logging.info("Created %s queues", args.queues) |
227 | 230 |
|
228 | 231 | valid_queue_names = extract_queue_names(queues=queues)
|
229 | 232 |
|
230 | 233 | agents = AgentDataGenerator(
|
231 | 234 | num_agents=args.agents, queue_list=valid_queue_names
|
232 | 235 | )
|
233 | 236 | testflinger_client.post_agent_data(agents=agents)
|
234 |
| - print(f"Created {args.agents} agents") |
| 237 | + logging.info("Created %s agents", args.agents) |
235 | 238 |
|
236 | 239 | jobs = JobDataGenerator(num_jobs=args.jobs, queue_list=valid_queue_names)
|
237 | 240 | testflinger_client.post_job_data(jobs=jobs)
|
238 |
| - print(f"Created {args.jobs} jobs") |
| 241 | + logging.info("Created %s jobs", args.jobs) |
239 | 242 |
|
240 | 243 |
|
241 | 244 | if __name__ == "__main__":
|
242 | 245 | try:
|
243 | 246 | main()
|
244 | 247 | except requests.exceptions.RequestException as error:
|
245 |
| - print(f"Error: {error}") |
| 248 | + logging.error(error) |
246 | 249 | sys.exit(1)
|
0 commit comments