| Total Complexity | 5 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import os |
||
| 2 | from pathlib import Path |
||
| 3 | import platform |
||
| 4 | import subprocess |
||
| 5 | import sys |
||
| 6 | from tabpy.models.utils import setup_utils |
||
| 7 | |||
| 8 | |||
| 9 | def main(): |
||
| 10 | # Determine if we run python or python3 |
||
| 11 | py = "python" if platform.system() == "Windows" else "python3" |
||
| 12 | |||
| 13 | file_path = sys.argv[1] if len(sys.argv) > 1 else setup_utils.get_default_config_file_path() |
||
| 14 | print(f"Using config file at {file_path}") |
||
| 15 | |||
| 16 | port, auth_on, prefix = setup_utils.parse_config(file_path) |
||
| 17 | auth_args = setup_utils.get_creds() if auth_on else [] |
||
| 18 | |||
| 19 | directory = str(Path(__file__).resolve().parent / "scripts") |
||
| 20 | # Deploy each model in the scripts directory |
||
| 21 | for filename in os.listdir(directory): |
||
| 22 | subprocess.run([py, f"{directory}/{filename}", file_path] + auth_args) |
||
| 23 | |||
| 24 | |||
| 25 | if __name__ == "__main__": |
||
| 26 | main() |
||
| 27 |