Skip to content

Commit

Permalink
Format imports with isort
Browse files Browse the repository at this point in the history
Signed-off-by: Jordà Polo <[email protected]>
  • Loading branch information
jordap authored and koomie committed Jan 10, 2025
1 parent 364b306 commit dd2c7f0
Show file tree
Hide file tree
Showing 20 changed files with 68 additions and 53 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import subprocess as sp
import sys

sys.path.insert(0, os.path.abspath(".."))

Expand Down
3 changes: 1 addition & 2 deletions grafana/scripts/filter-dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@
# 3. Rewrite dashboard UID and update all URLs accordingly.

import argparse
import json
import re
import sys

import json


def panel_contains_pattern(panel, pattern):
for target in panel.get("targets", []):
Expand Down
2 changes: 1 addition & 1 deletion omnistat/annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"""

import argparse
import time
import json
import os
import time


class omnistat_annotate:
Expand Down
10 changes: 6 additions & 4 deletions omnistat/collector_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
# SOFTWARE.
# -------------------------------------------------------------------------------

from amdsmi import *
from amdsmi import amdsmi_interface
import _thread
import time
import logging
import os
import sys
import time

from amdsmi import *
from amdsmi import amdsmi_interface
from prometheus_client import CollectorRegistry, Gauge, generate_latest

from omnistat.collector_base import Collector
from prometheus_client import Gauge, generate_latest, CollectorRegistry


class ROCMEvents(Collector):
Expand Down
2 changes: 1 addition & 1 deletion omnistat/collector_rms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
user-provided annotation timestamps.
"""

import sys
import json
import logging
import os
import platform
import sys

from prometheus_client import Gauge

Expand Down
3 changes: 2 additions & 1 deletion omnistat/collector_smi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
import os
import sys
from enum import IntEnum
from prometheus_client import Gauge, generate_latest, CollectorRegistry

from prometheus_client import CollectorRegistry, Gauge, generate_latest

from omnistat.collector_base import Collector
from omnistat.utils import gpu_index_mapping_based_on_guids
Expand Down
11 changes: 9 additions & 2 deletions omnistat/collector_smi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@
"""

import logging
from omnistat.collector_base import Collector

from amdsmi import (
amdsmi_get_gpu_process_info,
amdsmi_get_gpu_process_list,
amdsmi_get_processor_handles,
amdsmi_init,
)
from prometheus_client import Gauge

from omnistat.collector_base import Collector
from omnistat.utils import GPU_MAPPING_ORDER
from amdsmi import amdsmi_init, amdsmi_get_processor_handles, amdsmi_get_gpu_process_list, amdsmi_get_gpu_process_info


def get_gpu_processes(device):
Expand Down
6 changes: 4 additions & 2 deletions omnistat/collector_smi_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@
"""

import logging
import packaging.version
import statistics
import sys

import amdsmi as smi
from omnistat.collector_base import Collector
import packaging.version
from prometheus_client import Gauge

from omnistat.collector_base import Collector
from omnistat.utils import convert_bdf_to_gpuid, gpu_index_mapping_based_on_bdfs


Expand Down
4 changes: 2 additions & 2 deletions omnistat/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
import platform
import re
import sys

from pathlib import Path
from prometheus_client import generate_latest, CollectorRegistry

from prometheus_client import CollectorRegistry, generate_latest

from omnistat import utils

Expand Down
3 changes: 1 addition & 2 deletions omnistat/node_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
import sys

import gunicorn.app.base

from flask import Flask, request, abort, jsonify
from flask import Flask, abort, jsonify, request

from omnistat import utils
from omnistat.monitor import Monitor
Expand Down
6 changes: 3 additions & 3 deletions omnistat/omni_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# -------------------------------------------------------------------------------

import argparse
import importlib.resources
import getpass
import importlib.resources
import logging
import os
import platform
Expand All @@ -35,10 +35,10 @@
import sys
import tempfile
import time
import yaml

from pathlib import Path

import yaml

# Use libssh instead of the default libssh2 to avoid issues with certain keys
# and newer versions of SSH.
from pssh.clients.ssh.parallel import ParallelSSHClient
Expand Down
32 changes: 21 additions & 11 deletions omnistat/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,37 @@
# SOFTWARE.
# -------------------------------------------------------------------------------

from prometheus_api_client import PrometheusConnect, MetricSnapshotDataFrame
from prometheus_api_client.utils import parse_datetime
from datetime import datetime, timedelta
import argparse
import logging
import numpy as np
import os
import shutil
import subprocess
import sys
import timeit
import matplotlib.pylab as plt
import matplotlib.dates as mdates
import shutil
from datetime import datetime, timedelta
from pathlib import Path

import matplotlib.dates as mdates
import matplotlib.pylab as plt
import numpy as np
from prometheus_api_client import MetricSnapshotDataFrame, PrometheusConnect
from prometheus_api_client.utils import parse_datetime
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter, landscape
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle, PageBreak, HRFlowable
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import landscape, letter
from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet
from reportlab.lib.units import inch
from reportlab.pdfgen import canvas
from reportlab.platypus import (
HRFlowable,
Image,
PageBreak,
Paragraph,
SimpleDocTemplate,
Spacer,
Table,
TableStyle,
)

from omnistat import utils

Expand Down
2 changes: 1 addition & 1 deletion omnistat/rms_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
# Default path for output_file: /tmp/omni_rmsjobinfo
# -------------------------------------------------------------------------------

import argparse
import fcntl
import json
import os
import subprocess
import sys
import argparse


def main():
Expand Down
10 changes: 5 additions & 5 deletions omnistat/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
import logging
import os
import platform
import requests
import sys
import signal
import sys
import threading
import time
import warnings
from datetime import datetime, timezone
from flask import Flask, request, jsonify, abort
from prometheus_client import Gauge, REGISTRY

import requests
from flask import Flask, abort, jsonify, request
from prometheus_client import REGISTRY, Gauge

# Ensure current directory is part of Python's path; allows direct execution
# from the top directory of the project when package is not installed.
Expand All @@ -52,7 +53,6 @@
from omnistat import utils
from omnistat.monitor import Monitor


app = Flask(__name__)
terminateFlagEvent = threading.Event()
dataDeliveredEvent = threading.Event()
Expand Down
1 change: 0 additions & 1 deletion omnistat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import shutil
import subprocess
import sys

from importlib.metadata import version
from pathlib import Path

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ filterwarnings = [
[tool.black]
line-length = 120
include = '\.py$'

[tool.isort]
profile = "black"
4 changes: 1 addition & 3 deletions test/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import config
import pytest
import requests

from prometheus_api_client import PrometheusConnect

import config


class TestIntegration:
def test_request(self):
Expand Down
5 changes: 2 additions & 3 deletions test/test_job_system.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import os
import pytest
import time

from prometheus_api_client import PrometheusConnect

import config
import pytest
from prometheus_api_client import PrometheusConnect


class TestJobSystem:
Expand Down
6 changes: 2 additions & 4 deletions test/test_job_user_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@
# server, allowing further validation of the trace.

import os
import pytest
import re
import subprocess
import time

from string import Template

from prometheus_api_client import PrometheusConnect

import config
import pytest
from prometheus_api_client import PrometheusConnect

slurm_job_template = """\
#!/bin/bash
Expand Down
6 changes: 2 additions & 4 deletions test/test_job_user_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@
# server, allowing further validation of the trace.

import os
import pytest
import re
import subprocess
import time

from string import Template

from prometheus_api_client import PrometheusConnect

import config
import pytest
from prometheus_api_client import PrometheusConnect

slurm_job_template = """\
#!/bin/bash
Expand Down

0 comments on commit dd2c7f0

Please sign in to comment.