瀏覽代碼

增加选择开始函数

xueyiming 2 周之前
父節點
當前提交
de1dcc5dff
共有 1 個文件被更改,包括 15 次插入1 次删除
  1. 15 1
      ad/pai_flow_operator2.py

+ 15 - 1
ad/pai_flow_operator2.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 import os
 import re
+import sys
 import time
 import json
 import pandas as pd
@@ -707,7 +708,20 @@ def validate_model_data_accuracy():
 if __name__ == '__main__':
     start_time = int(time.time())
     functions = [shuffle_table, shuffle_train_model, export_model, get_validate_model_data]
-    for func in functions:
+    function_names = [func.__name__ for func in functions]
+
+    start_function = None
+    if len(sys.argv) > 1:
+        start_function = sys.argv[1]
+        if start_function not in function_names:
+            print(f"指定的起始函数 {start_function} 不存在,请选择以下函数之一:{', '.join(function_names)}")
+            sys.exit(1)
+
+    start_index = 0
+    if start_function:
+        start_index = function_names.index(start_function)
+
+    for func in functions[start_index:]:
         if not func():
             print(f"{func.__name__} 执行失败,后续函数不再执行。")
             break