multiple_run.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ##################################################################
  4. #
  5. # Copyright (c) 2023 CICV, Inc. All Rights Reserved
  6. #
  7. ##################################################################
  8. """
  9. @Authors: yangzihao(yangzihao@china-icv.cn)
  10. @Data: 2024/01/30
  11. @Last Modified: 2024/01/30
  12. @Summary: Evaluateion functions
  13. """
  14. import os
  15. import sys
  16. import time
  17. from multiple_case_eval import multiple_cases_eval
  18. import log
  19. # logger = log.get_logger()
  20. if __name__ == "__main__":
  21. from warnings import simplefilter
  22. # simplefilter(action="ignore", category=FutureWarning)
  23. simplefilter(action="ignore")
  24. if len(sys.argv) >= 5:
  25. configPath = sys.argv[1]
  26. singleReportPath = sys.argv[2]
  27. reportPath = sys.argv[3]
  28. logPath = sys.argv[4]
  29. log.setup_logger(logPath)
  30. logger = log.get_logger()
  31. if not os.path.exists(configPath):
  32. print('Invalid configPath!')
  33. logger.error("MULTIPLE_CASES_EVAL: Invalid configPath!")
  34. sys.exit(-1)
  35. elif not os.path.exists(singleReportPath):
  36. print('Invalid singleReportPath!')
  37. logger.error("MULTIPLE_CASES_EVAL: Invalid singleReportPath!")
  38. sys.exit(-1)
  39. else:
  40. try:
  41. logger.info("MULTIPLE_CASES_EVAL: Start evaluating:")
  42. print("MULTIPLE_CASES_EVAL程序开始运行:")
  43. print(f" configPath: {configPath},\n singleReportPath: {singleReportPath},\n reportPath: {reportPath}")
  44. t1 = time.time()
  45. multiple_cases_eval(configPath, singleReportPath, reportPath)
  46. t2 = time.time()
  47. print(f"程序结束,执行时间:{int(t2 - t1)} s")
  48. logger.info("MULTIPLE_CASES_EVAL: End.")
  49. sys.exit(0)
  50. except Exception as e:
  51. print("异常,退出...")
  52. print(repr(e))
  53. sys.exit(-1)
  54. else:
  55. print('No enough arguments!')
  56. logPath = sys.argv[4]
  57. log.setup_logger(logPath)
  58. logger = log.get_logger()
  59. logger.error("MULTIPLE_CASES_EVAL: No enough arguments!")
  60. sys.exit(-1)
  61. # num = "0123"
  62. # configPath = rf"./config_combined/config{num}.json"
  63. # singleReportPath = rf"./demoReportCombine/cases_dict-0423-{num}.json"
  64. # reportPath = rf"./result/report_mul-0423-{num}.json"
  65. # configPath = r"./config.json"
  66. # singleReportPath = r"./reportTest/cases_dict-0419.json"
  67. # reportPath = r"./result/report_mul-0419.json"
  68. #
  69. # logPath = './log.log'
  70. # log.setup_logger(logPath)
  71. # logger = log.get_logger()
  72. #
  73. # if not os.path.exists(configPath):
  74. # print('Invalid configPath!')
  75. # logger.error("MULTIPLE_CASES_EVAL: Invalid configPath!")
  76. # elif not os.path.exists(singleReportPath):
  77. # print('Invalid singleReportPath!')
  78. # logger.error("MULTIPLE_CASES_EVAL: Invalid singleReportPath!")
  79. # else:
  80. # # logger.info("MULTIPLE_CASES_EVAL: Start evaluating:")
  81. # print("MULTIPLE_CASES_EVAL程序开始运行:")
  82. # print(f" configPath: {configPath}, \n singleReportPath: {singleReportPath}, \n reportPath: {reportPath}")
  83. # t1 = time.time()
  84. # multiple_cases_eval(configPath, singleReportPath, reportPath)
  85. # t2 = time.time()
  86. # print(f"程序结束,执行时间:{int(t2 - t1)} s")
  87. # logger.info("MULTIPLE_CASES_EVAL: End.")