diff --git a/dev/determine_shards.py b/dev/determine_shards.py index d1ea82c..80c374f 100644 --- a/dev/determine_shards.py +++ b/dev/determine_shards.py @@ -1,14 +1,17 @@ import argparse import asyncio +import math import re import statistics -import math -import rich - from typing import * +import rich + from utils import forward from utils.forward import * +from utils.net import init +from utils.schema import Build, Stage +from utils.utils import init_log def is_parallelizable(name: str, desc: str) -> bool: diff --git a/dev/utils/__init__.py b/dev/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dev/utils/db.py b/dev/utils/db.py index c993002..c30178d 100644 --- a/dev/utils/db.py +++ b/dev/utils/db.py @@ -1,6 +1,6 @@ import os -from sqlalchemy import create_engine +from sqlalchemy import create_engine from sqlalchemy.dialects.postgresql import insert diff --git a/dev/utils/forward.py b/dev/utils/forward.py index f0dc36d..7cac1c1 100644 --- a/dev/utils/forward.py +++ b/dev/utils/forward.py @@ -1,26 +1,26 @@ """ Scrape Jenkins, send build data to Loki and Postgres """ -import dataclasses -import aiohttp +import argparse import asyncio +import dataclasses import datetime -import sys -import os -import time import json -import argparse +import logging +import os import subprocess +import sys +import time from pathlib import Path +from typing import * -# from sqlalchemy import select -from .utils import * +import aiohttp + +from . import db, schema from .net import * -from typing import * -from . import db -from . import schema -import logging +# from sqlalchemy import select +from .utils import * SESSION = None DEBUG = os.getenv("DEBUG", "0") == "1" diff --git a/dev/utils/net.py b/dev/utils/net.py index 674f9a4..4616492 100644 --- a/dev/utils/net.py +++ b/dev/utils/net.py @@ -1,9 +1,9 @@ -import requests -import subprocess -import os import logging +import os +import subprocess from pathlib import Path +import requests CACHE_DIR = None DEBUG = os.getenv("DEBUG", "0") == "1" diff --git a/dev/utils/schema.py b/dev/utils/schema.py index 7aa9e25..21ae5fc 100644 --- a/dev/utils/schema.py +++ b/dev/utils/schema.py @@ -1,20 +1,21 @@ +from typing import Any, Dict + import sqlalchemy -from sqlalchemy.orm import declarative_base from sqlalchemy import ( + JSON, + Boolean, Column, + DateTime, Integer, String, - Boolean, - DateTime, - JSON, Text, + column, + table, ) +from sqlalchemy.orm import declarative_base from sqlalchemy.sql.sqltypes import Float -from sqlalchemy import table, column from . import db -from typing import Dict, Any - Base = declarative_base() diff --git a/dev/utils/utils.py b/dev/utils/utils.py index 6f8b286..34eface 100644 --- a/dev/utils/utils.py +++ b/dev/utils/utils.py @@ -1,10 +1,9 @@ -import json -import sys import asyncio +import json import logging +import sys from pathlib import Path - REPO_ROOT = Path(__file__).resolve().parent