From 15618e6b2f37cf9ca3fa378a2f090d194ef19e15 Mon Sep 17 00:00:00 2001 From: Christopher Sherman Date: Mon, 22 Jan 2024 16:01:04 -0800 Subject: [PATCH] Appyling yapf --- geos_ats_package/geos_ats/common_utilities.py | 2 +- .../geos_ats/configuration_record.py | 4 +-- .../geos_ats/helpers/permute_array.py | 2 +- .../geos_ats/helpers/restart_check.py | 10 +++---- .../geos_ats/machines/batchGeosatsMoab.py | 4 +-- .../geos_ats/machines/bgqos_0_ASQ.py | 6 ++-- geos_ats_package/geos_ats/machines/darwin.py | 2 +- .../geosAtsSlurmProcessorScheduled.py | 2 +- geos_ats_package/geos_ats/machines/lassen.py | 4 +-- geos_ats_package/geos_ats/machines/nersc.py | 2 +- geos_ats_package/geos_ats/machines/openmpi.py | 4 +-- geos_ats_package/geos_ats/machines/summit.py | 4 +-- geos_ats_package/geos_ats/main.py | 2 +- geos_ats_package/geos_ats/reporting.py | 28 ++++++++++++------- geos_ats_package/geos_ats/scheduler.py | 6 ++-- geos_ats_package/geos_ats/suite_settings.py | 2 +- geos_ats_package/geos_ats/test_case.py | 8 +++--- geos_ats_package/geos_ats/test_modifier.py | 2 +- geos_ats_package/geos_ats/test_steps.py | 8 +++--- geos_ats_package/geos_ats/user_utilities.py | 2 +- 20 files changed, 56 insertions(+), 48 deletions(-) diff --git a/geos_ats_package/geos_ats/common_utilities.py b/geos_ats_package/geos_ats/common_utilities.py index 0ad4ad8..7543df1 100644 --- a/geos_ats_package/geos_ats/common_utilities.py +++ b/geos_ats_package/geos_ats/common_utilities.py @@ -18,7 +18,7 @@ def Error(msg): def Log(msg): - import ats # type: ignore[import] + import ats # type: ignore[import] testmode = False try: testmode = ats.tests.AtsTest.getOptions().get("testmode") diff --git a/geos_ats_package/geos_ats/configuration_record.py b/geos_ats_package/geos_ats/configuration_record.py index 8d251c5..1d0291d 100644 --- a/geos_ats_package/geos_ats/configuration_record.py +++ b/geos_ats_package/geos_ats/configuration_record.py @@ -90,7 +90,7 @@ def __getattr__(self, name): # The global config object config = Config() # Global testTimings object -globalTestTimings = {} # type: ignore[var-annotated] +globalTestTimings = {} # type: ignore[var-annotated] # Depth of testconfig recursion configDepth = 0 @@ -98,7 +98,7 @@ def __getattr__(self, name): def infoConfigShow(public, outfile=sys.stdout): topic = InfoTopic("config show", outfile) topic.startBanner() - import ats # type: ignore[import] + import ats # type: ignore[import] keys = sorted(config._items.keys()) table = TextTable(3) diff --git a/geos_ats_package/geos_ats/helpers/permute_array.py b/geos_ats_package/geos_ats/helpers/permute_array.py index bbc9491..6f0bfcb 100644 --- a/geos_ats_package/geos_ats/helpers/permute_array.py +++ b/geos_ats_package/geos_ats/helpers/permute_array.py @@ -1,4 +1,4 @@ -import numpy as np # type: ignore[import] +import numpy as np # type: ignore[import] import logging logger = logging.getLogger('geos_ats') diff --git a/geos_ats_package/geos_ats/helpers/restart_check.py b/geos_ats_package/geos_ats/helpers/restart_check.py index 261c3bf..d449e42 100644 --- a/geos_ats_package/geos_ats/helpers/restart_check.py +++ b/geos_ats_package/geos_ats/helpers/restart_check.py @@ -1,6 +1,6 @@ -import h5py # type: ignore[import] -from mpi4py import MPI # type: ignore[import] -import numpy as np # type: ignore[import] +import h5py # type: ignore[import] +from mpi4py import MPI # type: ignore[import] +import numpy as np # type: ignore[import] import sys import os import re @@ -8,10 +8,10 @@ import logging from pathlib import Path try: - from geos_ats.helpers.permute_array import permuteArray # type: ignore[import] + from geos_ats.helpers.permute_array import permuteArray # type: ignore[import] except ImportError: # Fallback method to be used if geos_ats isn't found - from permute_array import permuteArray # type: ignore[import] + from permute_array import permuteArray # type: ignore[import] RTOL_DEFAULT = 0.0 ATOL_DEFAULT = 0.0 diff --git a/geos_ats_package/geos_ats/machines/batchGeosatsMoab.py b/geos_ats_package/geos_ats/machines/batchGeosatsMoab.py index bc5747d..e2bb4e7 100644 --- a/geos_ats_package/geos_ats/machines/batchGeosatsMoab.py +++ b/geos_ats_package/geos_ats/machines/batchGeosatsMoab.py @@ -1,9 +1,9 @@ #BATS:batchGeosatsMoab batchGeosatsMoab BatchGeosatsMoab -1 -from ats import machines, configuration, log, atsut, times, AtsTest # type: ignore[import] +from ats import machines, configuration, log, atsut, times, AtsTest # type: ignore[import] import subprocess, sys, os, time, socket, re import utils # type: ignore[import] -from batch import BatchMachine # type: ignore[import] +from batch import BatchMachine # type: ignore[import] import logging debug = configuration.debug diff --git a/geos_ats_package/geos_ats/machines/bgqos_0_ASQ.py b/geos_ats_package/geos_ats/machines/bgqos_0_ASQ.py index 6c470db..a761ea0 100644 --- a/geos_ats_package/geos_ats/machines/bgqos_0_ASQ.py +++ b/geos_ats_package/geos_ats/machines/bgqos_0_ASQ.py @@ -1,10 +1,10 @@ #ATS:bgqos_0_ASQ machines.bgqos_0_ASQ bgqos_0_ASQMachine 16 -from ats import machines, debug, atsut # type: ignore[import] +from ats import machines, debug, atsut # type: ignore[import] from ats import log, terminal from ats import configuration -from ats.atsut import RUNNING, TIMEDOUT, SKIPPED, BATCHED, INVALID, PASSED, FAILED, CREATED, FILTERED, HALTED, EXPECTED # type: ignore[import] -import utils # type: ignore[import] +from ats.atsut import RUNNING, TIMEDOUT, SKIPPED, BATCHED, INVALID, PASSED, FAILED, CREATED, FILTERED, HALTED, EXPECTED # type: ignore[import] +import utils # type: ignore[import] import time import sys diff --git a/geos_ats_package/geos_ats/machines/darwin.py b/geos_ats_package/geos_ats/machines/darwin.py index af7b8b5..952c345 100644 --- a/geos_ats_package/geos_ats/machines/darwin.py +++ b/geos_ats_package/geos_ats/machines/darwin.py @@ -1,6 +1,6 @@ #ATS:darwin machines.darwin DarwinMachine 16 -from openmpi import OpenmpiMachine # type: ignore[import] +from openmpi import OpenmpiMachine # type: ignore[import] class DarwinMachine(OpenmpiMachine): diff --git a/geos_ats_package/geos_ats/machines/geosAtsSlurmProcessorScheduled.py b/geos_ats_package/geos_ats/machines/geosAtsSlurmProcessorScheduled.py index 1770402..4ac3091 100644 --- a/geos_ats_package/geos_ats/machines/geosAtsSlurmProcessorScheduled.py +++ b/geos_ats_package/geos_ats/machines/geosAtsSlurmProcessorScheduled.py @@ -8,7 +8,7 @@ from geos_ats.scheduler import scheduler from geos_ats.machine_utilities import CheckForEarlyTimeOut -from slurmProcessorScheduled import SlurmProcessorScheduled # type: ignore[import] +from slurmProcessorScheduled import SlurmProcessorScheduled # type: ignore[import] import subprocess import logging diff --git a/geos_ats_package/geos_ats/machines/lassen.py b/geos_ats_package/geos_ats/machines/lassen.py index 1bdd93b..6430ee6 100644 --- a/geos_ats_package/geos_ats/machines/lassen.py +++ b/geos_ats_package/geos_ats/machines/lassen.py @@ -1,11 +1,11 @@ #ATS:SequentialMachine SELF lassenMachine 1 #ATS:lassen SELF lassenMachine 1 -from ats import machines # type: ignore[import] +from ats import machines # type: ignore[import] from ats import machines, debug, atsut from ats import log, terminal from ats import configuration -from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] +from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] from ats import AtsTest import os import subprocess diff --git a/geos_ats_package/geos_ats/machines/nersc.py b/geos_ats_package/geos_ats/machines/nersc.py index 1eb2443..0cd4327 100644 --- a/geos_ats_package/geos_ats/machines/nersc.py +++ b/geos_ats_package/geos_ats/machines/nersc.py @@ -8,7 +8,7 @@ from geos_ats.scheduler import scheduler from geos_ats.machine_utilities import CheckForEarlyTimeOut -from slurmProcessorScheduled import SlurmProcessorScheduled # type: ignore[import] +from slurmProcessorScheduled import SlurmProcessorScheduled # type: ignore[import] import subprocess import logging diff --git a/geos_ats_package/geos_ats/machines/openmpi.py b/geos_ats_package/geos_ats/machines/openmpi.py index 842564d..6ddf0fb 100644 --- a/geos_ats_package/geos_ats/machines/openmpi.py +++ b/geos_ats_package/geos_ats/machines/openmpi.py @@ -1,12 +1,12 @@ #ATS:openmpi machines.openmpi OpenmpiMachine 16 import os -import ats # type: ignore[import] +import ats # type: ignore[import] from ats import machines from ats import terminal from ats import log import shlex -from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] +from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] from ats import AtsTest import logging diff --git a/geos_ats_package/geos_ats/machines/summit.py b/geos_ats_package/geos_ats/machines/summit.py index 07b2c58..1d7b751 100644 --- a/geos_ats_package/geos_ats/machines/summit.py +++ b/geos_ats_package/geos_ats/machines/summit.py @@ -1,11 +1,11 @@ #ATS:SequentialMachine machines.summit summitMachine 1 #ATS:summit machines.summit summitMachine 1 -from ats import machines # type: ignore[import] +from ats import machines # type: ignore[import] from ats import machines, debug, atsut from ats import log, terminal from ats import configuration -from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] +from ats.atsut import RUNNING, TIMEDOUT # type: ignore[import] from ats import AtsTest import os import subprocess diff --git a/geos_ats_package/geos_ats/main.py b/geos_ats_package/geos_ats/main.py index b22af5b..033d0f5 100644 --- a/geos_ats_package/geos_ats/main.py +++ b/geos_ats_package/geos_ats/main.py @@ -327,7 +327,7 @@ def main(): geos_atsStartTime = time.time() # Note: the sys.argv is read here by default - import ats # type: ignore[import] + import ats # type: ignore[import] ats.manager.init() logger.debug('Copying options to the geos_ats config record file') config.copy_values(ats.manager.machine) diff --git a/geos_ats_package/geos_ats/reporting.py b/geos_ats_package/geos_ats/reporting.py index 633f5dd..1b35a0e 100644 --- a/geos_ats_package/geos_ats/reporting.py +++ b/geos_ats_package/geos_ats/reporting.py @@ -7,15 +7,13 @@ import glob import logging from ats.times import hms -from ats import (PASSED, FAILED, TIMEDOUT, EXPECTED, BATCHED, FILTERED, - SKIPPED, CREATED, RUNNING, HALTED, LSFERROR) +from ats import (PASSED, FAILED, TIMEDOUT, EXPECTED, BATCHED, FILTERED, SKIPPED, CREATED, RUNNING, HALTED, LSFERROR) # Get the active logger instance logger = logging.getLogger('geos_ats') # Status value in priority order -STATUS = (EXPECTED, CREATED, BATCHED, FILTERED, SKIPPED, RUNNING, - PASSED, TIMEDOUT, HALTED, LSFERROR, FAILED) +STATUS = (EXPECTED, CREATED, BATCHED, FILTERED, SKIPPED, RUNNING, PASSED, TIMEDOUT, HALTED, LSFERROR, FAILED) COLORS = {} COLORS[EXPECTED.name] = "black" @@ -47,15 +45,27 @@ def __init__(self, test_steps): for t in test_steps: # Parse the test step name - step_name = t.name[t.name.find('(')+1:t.name.rfind('_')] + step_name = t.name[t.name.find('(') + 1:t.name.rfind('_')] test_name = step_name[:step_name.rfind('_')] test_id = t.group.number group_name = test_name[:test_name.rfind('_')] # Save data if test_name not in self.test_results: - self.test_results[test_name] = {'steps': {}, 'status': EXPECTED, 'id': test_id, 'elapsed': 0.0, 'current_step': ' ', 'resources': t.np} - self.test_results[test_name]['steps'][t.name] = {'status': t.status, 'log': t.outname, 'output': t.step_outputs, 'number': t.groupSerialNumber} + self.test_results[test_name] = { + 'steps': {}, + 'status': EXPECTED, + 'id': test_id, + 'elapsed': 0.0, + 'current_step': ' ', + 'resources': t.np + } + self.test_results[test_name]['steps'][t.name] = { + 'status': t.status, + 'log': t.outname, + 'output': t.step_outputs, + 'number': t.groupSerialNumber + } # Check elapsed time elapsed = 0.0 @@ -207,9 +217,7 @@ def writeHeader(self, sp, refresh): username = os.getenv("USER") header += "

GEOS ATS Report

\n

Configuration

\n" - table = [['Test Results', gentime], - ['User', username], - ['Platform', platform]] + table = [['Test Results', gentime], ['User', username], ['Platform', platform]] header += tabulate(table, tablefmt='html') header += '\n' sp.write(header) diff --git a/geos_ats_package/geos_ats/scheduler.py b/geos_ats_package/geos_ats/scheduler.py index 108deab..b7cf544 100644 --- a/geos_ats_package/geos_ats/scheduler.py +++ b/geos_ats_package/geos_ats/scheduler.py @@ -4,9 +4,9 @@ import time from geos_ats.configuration_record import config from geos_ats.common_utilities import Log -from ats.log import log # type: ignore[import] -from ats.atsut import PASSED, FAILED, CREATED, EXPECTED, TIMEDOUT # type: ignore[import] -from ats.schedulers import StandardScheduler # type: ignore[import] +from ats.log import log # type: ignore[import] +from ats.atsut import PASSED, FAILED, CREATED, EXPECTED, TIMEDOUT # type: ignore[import] +from ats.schedulers import StandardScheduler # type: ignore[import] class GeosAtsScheduler(StandardScheduler): diff --git a/geos_ats_package/geos_ats/suite_settings.py b/geos_ats_package/geos_ats/suite_settings.py index 824079f..594bc51 100644 --- a/geos_ats_package/geos_ats/suite_settings.py +++ b/geos_ats_package/geos_ats/suite_settings.py @@ -3,7 +3,7 @@ testLabels = [ "geos", - "auto", # label used when the tests were automatically converted. Will be deprecated. + "auto", # label used when the tests were automatically converted. Will be deprecated. ] testOwners = [("corbett5", "Ben Corbett")] diff --git a/geos_ats_package/geos_ats/test_case.py b/geos_ats_package/geos_ats/test_case.py index a7a751a..2a43658 100644 --- a/geos_ats_package/geos_ats/test_case.py +++ b/geos_ats_package/geos_ats/test_case.py @@ -1,4 +1,4 @@ -import ats # type: ignore[import] +import ats # type: ignore[import] import os import shutil import logging @@ -33,8 +33,8 @@ def __init__(self, enabled=True, duration="1h", ppn=0, altname=None): logger.error(e) Error("bad time specification: %s" % duration) - self.ppn = ppn # processor per node - self.altname = altname # alternate name to use when launcing the batch job + self.ppn = ppn # processor per node + self.altname = altname # alternate name to use when launcing the batch job class TestCase(object): @@ -263,7 +263,7 @@ def _remove(path): else: os.remove(p) except OSError: - pass # so that two simultaneous clean operations don't fail + pass # so that two simultaneous clean operations don't fail # clean self.testClean() diff --git a/geos_ats_package/geos_ats/test_modifier.py b/geos_ats_package/geos_ats/test_modifier.py index c6d7cb2..b625be4 100644 --- a/geos_ats_package/geos_ats/test_modifier.py +++ b/geos_ats_package/geos_ats/test_modifier.py @@ -1,4 +1,4 @@ -import ats # type: ignore[import] +import ats # type: ignore[import] from geos_ats import common_utilities from geos_ats.configuration_record import config from geos_ats import test_steps diff --git a/geos_ats_package/geos_ats/test_steps.py b/geos_ats_package/geos_ats/test_steps.py index b1aa190..3f471de 100644 --- a/geos_ats_package/geos_ats/test_steps.py +++ b/geos_ats_package/geos_ats/test_steps.py @@ -1,5 +1,5 @@ import os -import ats # type: ignore[import] +import ats # type: ignore[import] import glob import shutil import sys @@ -265,7 +265,7 @@ def _remove(self, paths, noclean): else: os.remove(p) except OSError as e: - logger.debug(e) # so that two simultaneous clean operations don't fail + logger.debug(e) # so that two simultaneous clean operations don't fail def getCheckOption(self): return ats.tests.AtsTest.getOptions().get("checkoption") @@ -388,8 +388,8 @@ class geos(TestStepBase): params = TestStepBase.defaultParams + ( TestStepBase.commonParams["name"], TestStepBase.commonParams["deck"], TestStepBase.commonParams["np"], TestStepBase.commonParams["ngpu"], TestStepBase.commonParams["check"], - TestStepBase.commonParams["test_directory"], TestStepBase.commonParams["baseline_directory"], TestStepBase.commonParams["output_directory"], - TestParam("restart_file", "The name of the restart file."), + TestStepBase.commonParams["test_directory"], TestStepBase.commonParams["baseline_directory"], + TestStepBase.commonParams["output_directory"], TestParam("restart_file", "The name of the restart file."), TestParam("x_partitions", "The number of partitions in the x direction."), TestParam("y_partitions", "The number of partitions in the y direction."), TestParam("z_partitions", diff --git a/geos_ats_package/geos_ats/user_utilities.py b/geos_ats_package/geos_ats/user_utilities.py index 775e3a1..24ebd89 100644 --- a/geos_ats_package/geos_ats/user_utilities.py +++ b/geos_ats_package/geos_ats/user_utilities.py @@ -1,4 +1,4 @@ -import ats # type: ignore[import] +import ats # type: ignore[import] import os