зеркало из https://github.com/mozilla/treeherder.git
N818: Exception name should be named with an Error suffix
This commit is contained in:
Родитель
40a4c5917f
Коммит
05a7deae77
|
@ -40,7 +40,7 @@ select = [
|
|||
# pyupgrade
|
||||
"UP",
|
||||
# pep-naming
|
||||
"N806", "N803", "N801", "N815", "N811",
|
||||
"N806", "N803", "N801", "N815", "N811", "N818",
|
||||
]
|
||||
|
||||
ignore = [
|
||||
|
|
|
@ -5,7 +5,7 @@ from tests.test_utils import add_log_response
|
|||
from treeherder.log_parser.artifactbuildercollection import (
|
||||
MAX_DOWNLOAD_SIZE_IN_BYTES,
|
||||
ArtifactBuilderCollection,
|
||||
LogSizeException,
|
||||
LogSizeError,
|
||||
)
|
||||
from treeherder.log_parser.artifactbuilders import LogViewerArtifactBuilder
|
||||
|
||||
|
@ -69,5 +69,5 @@ def test_log_download_size_limit():
|
|||
)
|
||||
lpc = ArtifactBuilderCollection(url)
|
||||
|
||||
with pytest.raises(LogSizeException):
|
||||
with pytest.raises(LogSizeError):
|
||||
lpc.parse()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
|
||||
from treeherder.log_parser.parsers import EmptyPerformanceData, PerformanceParser
|
||||
from treeherder.log_parser.parsers import EmptyPerformanceDataError, PerformanceParser
|
||||
|
||||
|
||||
def test_performance_log_parsing_malformed_perfherder_data():
|
||||
|
@ -15,7 +15,7 @@ def test_performance_log_parsing_malformed_perfherder_data():
|
|||
try:
|
||||
# Empty performance data
|
||||
parser.parse_line("PERFHERDER_DATA: {}", 2)
|
||||
except EmptyPerformanceData:
|
||||
except EmptyPerformanceDataError:
|
||||
pass
|
||||
|
||||
valid_perfherder_data = {
|
||||
|
|
|
@ -18,7 +18,7 @@ from treeherder.model.data_cycling.removal_strategies import (
|
|||
StalledDataRemoval,
|
||||
)
|
||||
from treeherder.model.models import Push
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
from treeherder.perf.models import (
|
||||
PerformanceDatum,
|
||||
PerformanceDatumReplicate,
|
||||
|
@ -401,7 +401,7 @@ def test_performance_cycler_quit_indicator(taskcluster_notify_mock):
|
|||
two_seconds_ago = datetime.now() - timedelta(seconds=2)
|
||||
five_minutes = timedelta(minutes=5)
|
||||
|
||||
with pytest.raises(MaxRuntimeExceeded):
|
||||
with pytest.raises(MaxRuntimeExceededError):
|
||||
PerfherderCycler(chunk_size=100, sleep_time=0)
|
||||
|
||||
max_runtime = MaxRuntime(max_runtime=one_second)
|
||||
|
@ -413,7 +413,7 @@ def test_performance_cycler_quit_indicator(taskcluster_notify_mock):
|
|||
max_runtime = MaxRuntime(max_runtime=five_minutes)
|
||||
max_runtime.started_at = two_seconds_ago
|
||||
max_runtime.quit_on_timeout()
|
||||
except MaxRuntimeExceeded:
|
||||
except MaxRuntimeExceededError:
|
||||
pytest.fail("Performance cycling shouldn't have timed out")
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from treeherder.perf.auto_perf_sheriffing.backfill_tool import BackfillTool
|
||||
from treeherder.perf.exceptions import CannotBackfill
|
||||
from treeherder.perf.exceptions import CannotBackfillError
|
||||
from treeherder.services.taskcluster import TaskclusterModelNullObject
|
||||
|
||||
|
||||
|
@ -18,11 +18,11 @@ class TestBackfillTool:
|
|||
def test_backfilling_job_from_try_repo_by_id_raises_exception(self, job_from_try):
|
||||
backfill_tool = BackfillTool(TaskclusterModelNullObject(*self.FAKE_OPTIONS))
|
||||
|
||||
with pytest.raises(CannotBackfill):
|
||||
with pytest.raises(CannotBackfillError):
|
||||
backfill_tool.backfill_job(job_from_try.id)
|
||||
|
||||
def test_backfilling_job_from_try_repo_raises_exception(self, job_from_try):
|
||||
backfill_tool = BackfillTool(TaskclusterModelNullObject(*self.FAKE_OPTIONS))
|
||||
|
||||
with pytest.raises(CannotBackfill):
|
||||
with pytest.raises(CannotBackfillError):
|
||||
backfill_tool.backfill_job(job_from_try)
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.core.management import call_command
|
|||
|
||||
from treeherder.perf.auto_perf_sheriffing.sherlock import Sherlock
|
||||
from treeherder.perf.models import BackfillNotificationRecord
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
|
||||
EPOCH = datetime.utcfromtimestamp(0)
|
||||
|
||||
|
@ -78,7 +78,7 @@ def test_no_email_is_sent_if_runtime_exceeded(
|
|||
sherlock = Sherlock(report_maintainer_mock, backfill_tool_mock, secretary, no_time_left)
|
||||
try:
|
||||
sherlock.sheriff(since=EPOCH, frameworks=["raptor", "talos"], repositories=["autoland"])
|
||||
except MaxRuntimeExceeded:
|
||||
except MaxRuntimeExceededError:
|
||||
pass
|
||||
|
||||
assert BackfillNotificationRecord.objects.count() == 0
|
||||
|
|
|
@ -9,7 +9,7 @@ from tests import settings as test_settings
|
|||
from tests.perf.auto_perf_sheriffing.conftest import prepare_record_with_search_str
|
||||
from treeherder.model.models import Job, Push
|
||||
from treeherder.perf.auto_perf_sheriffing.sherlock import Sherlock
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
from treeherder.perf.models import BackfillRecord, BackfillReport
|
||||
|
||||
EPOCH = datetime.utcfromtimestamp(0)
|
||||
|
@ -95,7 +95,7 @@ def test_assert_can_run_throws_exception_when_runtime_exceeded(
|
|||
no_time_left = timedelta(seconds=0)
|
||||
sherlock_bot = Sherlock(report_maintainer_mock, backfill_tool_mock, secretary, no_time_left)
|
||||
|
||||
with pytest.raises(MaxRuntimeExceeded):
|
||||
with pytest.raises(MaxRuntimeExceededError):
|
||||
sherlock_bot.assert_can_run()
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ def test_assert_can_run_doesnt_throw_exception_when_enough_time_left(
|
|||
|
||||
try:
|
||||
sherlock.assert_can_run()
|
||||
except MaxRuntimeExceeded:
|
||||
except MaxRuntimeExceededError:
|
||||
pytest.fail()
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ def test_records_and_db_limits_remain_unchanged_if_runtime_exceeded(
|
|||
sherlock = Sherlock(report_maintainer_mock, backfill_tool_mock, secretary, no_time_left)
|
||||
try:
|
||||
sherlock.sheriff(since=EPOCH, frameworks=["raptor", "talos"], repositories=["autoland"])
|
||||
except MaxRuntimeExceeded:
|
||||
except MaxRuntimeExceededError:
|
||||
pass
|
||||
|
||||
assert not has_changed(record_ready_for_processing)
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Callable
|
|||
|
||||
from tests.perf.auto_sheriffing_criteria.conftest import CASSETTES_RECORDING_DATE
|
||||
from treeherder.config.settings import BZ_DATETIME_FORMAT
|
||||
from treeherder.perf.exceptions import NoFiledBugs
|
||||
from treeherder.perf.exceptions import NoFiledBugsError
|
||||
from treeherder.perf.sheriffing_criteria import (
|
||||
EngineerTractionFormula,
|
||||
FixRatioFormula,
|
||||
|
@ -166,7 +166,7 @@ def test_breakdown_resets_to_null_when_calculus_errors_out(formula_class, betama
|
|||
|
||||
# now run alternated path calculus
|
||||
with betamax_recorder.use_cassette(f"{cassette_preffix_b}", serialize_with="prettyjson"):
|
||||
with pytest.raises(NoFiledBugs):
|
||||
with pytest.raises(NoFiledBugsError):
|
||||
formula(*test_moniker_b) # intentionally blows up while doing calculus
|
||||
|
||||
# cached breakdown got invalidated & can no longer be obtained
|
||||
|
@ -235,5 +235,5 @@ def test_formula_errors_up_when_no_bugs_were_filed(formula_class, betamax_record
|
|||
with betamax_recorder.use_cassette(
|
||||
f"{nonexistent_framework}-{nonexistent_suite}", serialize_with="prettyjson"
|
||||
):
|
||||
with pytest.raises(NoFiledBugs):
|
||||
with pytest.raises(NoFiledBugsError):
|
||||
formula(nonexistent_framework, nonexistent_suite)
|
||||
|
|
|
@ -12,7 +12,7 @@ import pytest
|
|||
from freezegun import freeze_time
|
||||
|
||||
from tests.perf.auto_sheriffing_criteria.conftest import CASSETTES_RECORDING_DATE
|
||||
from treeherder.perf.exceptions import NoFiledBugs
|
||||
from treeherder.perf.exceptions import NoFiledBugsError
|
||||
from treeherder.perf.sheriffing_criteria import (
|
||||
CriteriaTracker,
|
||||
EngineerTractionFormula,
|
||||
|
@ -223,7 +223,7 @@ def test_record_computer_can_tell_unallowed_data(criteria_record):
|
|||
|
||||
|
||||
@pytest.mark.freeze_time(CASSETTES_RECORDING_DATE) # disable tick
|
||||
@pytest.mark.parametrize("exception", [NoFiledBugs(), Exception()])
|
||||
@pytest.mark.parametrize("exception", [NoFiledBugsError(), Exception()])
|
||||
def test_record_computer_still_updates_if_one_of_the_formulas_fails(exception, db):
|
||||
formula_map = {
|
||||
"EngineerTraction": MagicMock(spec=EngineerTractionFormula, return_value=EXPECTED_VALUE),
|
||||
|
|
|
@ -2,7 +2,7 @@ from threading import local
|
|||
|
||||
import pytest
|
||||
|
||||
from treeherder.etl.exceptions import MissingPushException
|
||||
from treeherder.etl.exceptions import MissingPushError
|
||||
from treeherder.etl.push import store_push_data
|
||||
from treeherder.etl.tasks.pulse_tasks import store_pulse_tasks
|
||||
from treeherder.model.models import Job
|
||||
|
@ -26,7 +26,7 @@ def test_retry_missing_revision_succeeds(
|
|||
orig_retry = store_pulse_tasks.retry
|
||||
|
||||
def retry_mock(exc=None, countdown=None):
|
||||
assert isinstance(exc, MissingPushException)
|
||||
assert isinstance(exc, MissingPushError)
|
||||
thread_data.retries += 1
|
||||
store_push_data(test_repository, [rs])
|
||||
return orig_retry(exc=exc, countdown=countdown)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class CollectionNotStoredException(Exception):
|
||||
class CollectionNotStoredError(Exception):
|
||||
def __init__(self, error_list, *args, **kwargs):
|
||||
"""
|
||||
error_list contains dictionaries, each containing
|
||||
|
@ -16,5 +16,5 @@ class CollectionNotStoredException(Exception):
|
|||
)
|
||||
|
||||
|
||||
class MissingPushException(Exception):
|
||||
class MissingPushError(Exception):
|
||||
pass
|
||||
|
|
|
@ -7,7 +7,7 @@ import slugid
|
|||
|
||||
from treeherder.etl.taskcluster_pulse.handler import ignore_task
|
||||
from treeherder.etl.common import to_timestamp
|
||||
from treeherder.etl.exceptions import MissingPushException
|
||||
from treeherder.etl.exceptions import MissingPushError
|
||||
from treeherder.etl.jobs import store_job_data
|
||||
from treeherder.etl.schema import get_json_schema
|
||||
from treeherder.model.models import Push, Repository
|
||||
|
@ -106,7 +106,7 @@ class JobLoader:
|
|||
task = get_task_definition(repository.tc_root_url, real_task_id)
|
||||
# We do this to prevent raising an exception for a task that will never be ingested
|
||||
if not ignore_task(task, real_task_id, repository.tc_root_url, project):
|
||||
raise MissingPushException(
|
||||
raise MissingPushError(
|
||||
"No push found in {} for revision {} for task {}".format(
|
||||
pulse_job["origin"]["project"], revision, real_task_id
|
||||
)
|
||||
|
|
|
@ -16,7 +16,7 @@ from django.db import connection
|
|||
|
||||
from treeherder.client.thclient import TreeherderClient
|
||||
from treeherder.config.settings import GITHUB_TOKEN
|
||||
from treeherder.etl.job_loader import JobLoader, MissingPushException
|
||||
from treeherder.etl.job_loader import JobLoader, MissingPushError
|
||||
from treeherder.etl.push_loader import PushLoader
|
||||
from treeherder.etl.pushlog import HgPushlogProcess, last_push_id_from_server
|
||||
from treeherder.etl.taskcluster_pulse.handler import EXCHANGE_EVENT_MAP, handleMessage
|
||||
|
@ -226,7 +226,7 @@ def process_job_with_threads(pulse_job, root_url):
|
|||
with Connection():
|
||||
try:
|
||||
JobLoader().process_job(pulse_job, root_url)
|
||||
except MissingPushException:
|
||||
except MissingPushError:
|
||||
logger.warning("The push was not in the DB. We are going to try that first")
|
||||
ingest_push(pulse_job["origin"]["project"], pulse_job["origin"]["revision"])
|
||||
JobLoader().process_job(pulse_job, root_url)
|
||||
|
|
|
@ -5,7 +5,7 @@ import newrelic.agent
|
|||
import requests
|
||||
from django.core.cache import cache
|
||||
|
||||
from treeherder.etl.exceptions import CollectionNotStoredException
|
||||
from treeherder.etl.exceptions import CollectionNotStoredError
|
||||
from treeherder.etl.push import store_push
|
||||
from treeherder.model.models import Repository
|
||||
from treeherder.utils.github import fetch_json
|
||||
|
@ -136,7 +136,7 @@ class HgPushlogProcess:
|
|||
)
|
||||
|
||||
if errors:
|
||||
raise CollectionNotStoredException(errors)
|
||||
raise CollectionNotStoredError(errors)
|
||||
|
||||
if not changeset:
|
||||
# only cache the last push if we're not fetching a specific changeset
|
||||
|
|
|
@ -5,7 +5,7 @@ import newrelic.agent
|
|||
from treeherder.utils.http import make_request
|
||||
|
||||
from .artifactbuilders import LogViewerArtifactBuilder, PerformanceDataArtifactBuilder
|
||||
from .parsers import EmptyPerformanceData
|
||||
from .parsers import EmptyPerformanceDataError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
# Max log size in bytes we will download (prior to decompression).
|
||||
|
@ -92,7 +92,7 @@ class ArtifactBuilderCollection:
|
|||
)
|
||||
|
||||
if download_size_in_bytes > MAX_DOWNLOAD_SIZE_IN_BYTES:
|
||||
raise LogSizeException(
|
||||
raise LogSizeError(
|
||||
"Download size of %i bytes exceeds limit" % download_size_in_bytes
|
||||
)
|
||||
|
||||
|
@ -106,7 +106,7 @@ class ArtifactBuilderCollection:
|
|||
# Using `replace` to prevent malformed unicode (which might possibly exist
|
||||
# in test message output) from breaking parsing of the rest of the log.
|
||||
builder.parse_line(line.decode("utf-8", "replace"))
|
||||
except EmptyPerformanceData:
|
||||
except EmptyPerformanceDataError:
|
||||
logger.warning("We have parsed an empty PERFHERDER_DATA for %s", self.url)
|
||||
|
||||
# gather the artifacts from all builders
|
||||
|
@ -121,5 +121,5 @@ class ArtifactBuilderCollection:
|
|||
self.artifacts[name] = artifact
|
||||
|
||||
|
||||
class LogSizeException(Exception):
|
||||
class LogSizeError(Exception):
|
||||
pass
|
||||
|
|
|
@ -197,7 +197,7 @@ class PerformanceParser(ParserBase):
|
|||
try:
|
||||
data = json.loads(match.group(1))
|
||||
if not bool(data):
|
||||
raise EmptyPerformanceData("The perf data is empty.")
|
||||
raise EmptyPerformanceDataError("The perf data is empty.")
|
||||
validate_perf_data(data)
|
||||
self.artifact.append(data)
|
||||
except ValueError:
|
||||
|
@ -210,5 +210,5 @@ class PerformanceParser(ParserBase):
|
|||
# Don't mark the parser as complete, in case there are multiple performance artifacts.
|
||||
|
||||
|
||||
class EmptyPerformanceData(Exception):
|
||||
class EmptyPerformanceDataError(Exception):
|
||||
pass
|
||||
|
|
|
@ -8,7 +8,7 @@ from requests.exceptions import HTTPError
|
|||
from treeherder.etl.artifact import serialize_artifact_json_blobs, store_job_artifacts
|
||||
from treeherder.log_parser.artifactbuildercollection import (
|
||||
ArtifactBuilderCollection,
|
||||
LogSizeException,
|
||||
LogSizeError,
|
||||
)
|
||||
from treeherder.model.models import Job, JobLog
|
||||
from treeherder.workers.task import retryable_task
|
||||
|
@ -89,7 +89,7 @@ def post_log_artifacts(job_log):
|
|||
|
||||
try:
|
||||
artifact_list = extract_text_log_artifacts(job_log)
|
||||
except LogSizeException as e:
|
||||
except LogSizeError as e:
|
||||
job_log.update_status(JobLog.SKIPPED_SIZE)
|
||||
logger.warning("Skipping parsing log for %s: %s", job_log.id, e)
|
||||
return
|
||||
|
|
|
@ -17,7 +17,7 @@ from treeherder.model.models import (
|
|||
BuildPlatform,
|
||||
MachinePlatform,
|
||||
)
|
||||
from treeherder.perf.exceptions import NoDataCyclingAtAll, MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import NoDataCyclingAtAllError, MaxRuntimeExceededError
|
||||
from treeherder.perf.models import (
|
||||
PerformanceSignature,
|
||||
PerformanceAlertSummary,
|
||||
|
@ -140,11 +140,11 @@ class PerfherderCycler(DataCycler):
|
|||
try:
|
||||
logger.warning(f"Cycling data using {strategy.name}...")
|
||||
self._delete_in_chunks(strategy)
|
||||
except NoDataCyclingAtAll as ex:
|
||||
except NoDataCyclingAtAllError as ex:
|
||||
logger.warning(str(ex))
|
||||
|
||||
self._remove_leftovers()
|
||||
except MaxRuntimeExceeded as ex:
|
||||
except MaxRuntimeExceededError as ex:
|
||||
logger.warning(ex)
|
||||
|
||||
def _remove_leftovers(self):
|
||||
|
@ -236,4 +236,4 @@ class PerfherderCycler(DataCycler):
|
|||
logger.warning(f"{msg}: (Exception: {exception})")
|
||||
else:
|
||||
logger.warning(msg)
|
||||
raise NoDataCyclingAtAll() from exception
|
||||
raise NoDataCyclingAtAllError() from exception
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import datetime, timedelta
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
|
||||
|
||||
class MaxRuntime:
|
||||
|
@ -16,7 +16,7 @@ class MaxRuntime:
|
|||
elapsed_runtime = datetime.now() - self.started_at
|
||||
|
||||
if self.max_runtime < elapsed_runtime:
|
||||
raise MaxRuntimeExceeded("Max runtime for performance data cycling exceeded")
|
||||
raise MaxRuntimeExceededError("Max runtime for performance data cycling exceeded")
|
||||
|
||||
def start_timer(self):
|
||||
self.started_at = datetime.now()
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Optional
|
|||
import simplejson as json
|
||||
from django.db.models import QuerySet, Q, F
|
||||
|
||||
from treeherder.perf.exceptions import MissingRecords
|
||||
from treeherder.perf.exceptions import MissingRecordsError
|
||||
from treeherder.perf.models import (
|
||||
PerformanceAlert,
|
||||
PerformanceDatum,
|
||||
|
@ -302,7 +302,7 @@ class BackfillReportMaintainer:
|
|||
|
||||
try:
|
||||
alert_context_map = self._associate_retrigger_context(important_alerts)
|
||||
except MissingRecords as ex:
|
||||
except MissingRecordsError as ex:
|
||||
self.log.warning(f"Failed to compute report for alert summary {summary}. {ex}")
|
||||
continue
|
||||
|
||||
|
@ -367,7 +367,7 @@ class BackfillReportMaintainer:
|
|||
if incomplete_mapping:
|
||||
expected = len(important_alerts)
|
||||
missing = expected - len(retrigger_map)
|
||||
raise MissingRecords(f"{missing} out of {expected} records are missing!")
|
||||
raise MissingRecordsError(f"{missing} out of {expected} records are missing!")
|
||||
|
||||
return retrigger_map
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
|||
from typing import Union
|
||||
|
||||
from treeherder.model.models import Job
|
||||
from treeherder.perf.exceptions import CannotBackfill
|
||||
from treeherder.perf.exceptions import CannotBackfillError
|
||||
from treeherder.services.taskcluster import TaskclusterModel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -51,7 +51,7 @@ class BackfillTool:
|
|||
|
||||
def assert_backfill_ability(self, over_job: Job):
|
||||
if over_job.repository.is_try_repo:
|
||||
raise CannotBackfill("Try repository isn't suited for backfilling.")
|
||||
raise CannotBackfillError("Try repository isn't suited for backfilling.")
|
||||
|
||||
@staticmethod
|
||||
def _fetch_job_by_id(job_id: str) -> Job:
|
||||
|
|
|
@ -10,7 +10,7 @@ from taskcluster.helper import TaskclusterConfig
|
|||
from treeherder.perf.auto_perf_sheriffing.backfill_reports import BackfillReportMaintainer
|
||||
from treeherder.perf.auto_perf_sheriffing.backfill_tool import BackfillTool
|
||||
from treeherder.perf.auto_perf_sheriffing.secretary import Secretary
|
||||
from treeherder.perf.exceptions import CannotBackfill, MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import CannotBackfillError, MaxRuntimeExceededError
|
||||
from treeherder.perf.models import BackfillRecord, BackfillReport, BackfillNotificationRecord
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -72,7 +72,7 @@ class Sherlock:
|
|||
|
||||
def assert_can_run(self):
|
||||
if self.runtime_exceeded():
|
||||
raise MaxRuntimeExceeded("Sherlock: Max runtime exceeded.")
|
||||
raise MaxRuntimeExceededError("Sherlock: Max runtime exceeded.")
|
||||
|
||||
def _report(
|
||||
self, since: datetime, frameworks: list[str], repositories: list[str]
|
||||
|
@ -143,7 +143,7 @@ class Sherlock:
|
|||
using_job_id = data_point["job_id"]
|
||||
self.backfill_tool.backfill_job(using_job_id)
|
||||
left, consumed = left - 1, consumed + 1
|
||||
except (KeyError, CannotBackfill, Exception) as ex:
|
||||
except (KeyError, CannotBackfillError, Exception) as ex:
|
||||
logger.debug(f"Failed to backfill record {record.alert.id}: {ex}")
|
||||
else:
|
||||
record.try_remembering_job_properties(using_job_id)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class NoDataCyclingAtAll(Exception):
|
||||
class NoDataCyclingAtAllError(Exception):
|
||||
def __str__(self):
|
||||
msg = "No data cycling could be performed."
|
||||
if self.__cause__:
|
||||
|
@ -6,19 +6,19 @@ class NoDataCyclingAtAll(Exception):
|
|||
return msg
|
||||
|
||||
|
||||
class MaxRuntimeExceeded(Exception):
|
||||
class MaxRuntimeExceededError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class MissingRecords(Exception):
|
||||
class MissingRecordsError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CannotBackfill(Exception):
|
||||
class CannotBackfillError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NoFiledBugs(Exception):
|
||||
class NoFiledBugsError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.core.management.base import BaseCommand
|
|||
|
||||
from treeherder.model.models import Repository
|
||||
from treeherder.perf.auto_perf_sheriffing.factories import sherlock_factory
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
from treeherder.perf.models import PerformanceFramework
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -59,7 +59,7 @@ class Command(BaseCommand):
|
|||
sherlock = sherlock_factory(days_to_lookup)
|
||||
try:
|
||||
sherlock.sheriff(since, frameworks, repositories)
|
||||
except MaxRuntimeExceeded as ex:
|
||||
except MaxRuntimeExceededError as ex:
|
||||
logging.info(ex)
|
||||
|
||||
logging.info("Sherlock: Going back to sleep.")
|
||||
|
|
|
@ -10,7 +10,7 @@ from datetime import timedelta
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from treeherder.model.data_cycling import MaxRuntime
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceeded
|
||||
from treeherder.perf.exceptions import MaxRuntimeExceededError
|
||||
from treeherder.perf.models import PerformanceSignature
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Command(BaseCommand):
|
|||
def __enough_work(self) -> bool:
|
||||
try:
|
||||
self.__timer.quit_on_timeout() # check timer
|
||||
except MaxRuntimeExceeded:
|
||||
except MaxRuntimeExceededError:
|
||||
self.__timer.start_timer() # reset & restart it
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.conf import settings
|
|||
from requests import Session
|
||||
|
||||
from treeherder.config.settings import BZ_DATETIME_FORMAT
|
||||
from treeherder.perf.exceptions import NoFiledBugs, BugzillaEndpointError
|
||||
from treeherder.perf.exceptions import NoFiledBugsError, BugzillaEndpointError
|
||||
from treeherder.perf.models import PerformanceAlert
|
||||
|
||||
# Google Doc specification
|
||||
|
@ -77,7 +77,7 @@ class BugzillaFormula(ABC):
|
|||
|
||||
all_filed_bugs = self.__fetch_cooled_down_bugs(framework, suite, test)
|
||||
if len(all_filed_bugs) == 0:
|
||||
raise NoFiledBugs()
|
||||
raise NoFiledBugsError()
|
||||
|
||||
denominator_bugs = self._filter_denominator_bugs(all_filed_bugs)
|
||||
numerator_bugs = self._filter_numerator_bugs(all_filed_bugs)
|
||||
|
|
|
@ -8,7 +8,7 @@ from typing import Union
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from treeherder.perf.exceptions import NoFiledBugs
|
||||
from treeherder.perf.exceptions import NoFiledBugsError
|
||||
from .bugzilla_formulas import BugzillaFormula, EngineerTractionFormula, FixRatioFormula
|
||||
from treeherder.utils import PROJECT_ROOT
|
||||
|
||||
|
@ -83,7 +83,7 @@ class RecordComputer:
|
|||
for form_name, formula in self._formula_map.items():
|
||||
try:
|
||||
result = formula(record.Framework, record.Suite, record.Test)
|
||||
except (NoFiledBugs, Exception) as ex:
|
||||
except (NoFiledBugsError, Exception) as ex:
|
||||
result = "N/A"
|
||||
self.__log_unexpected(ex, form_name, record)
|
||||
|
||||
|
@ -95,7 +95,7 @@ class RecordComputer:
|
|||
return record
|
||||
|
||||
def __log_unexpected(self, exception: Exception, formula_name: str, record: CriteriaRecord):
|
||||
if type(Exception) is NoFiledBugs:
|
||||
if type(Exception) is NoFiledBugsError:
|
||||
# maybe web service problem
|
||||
self.log.info(exception)
|
||||
elif type(exception) is Exception:
|
||||
|
|
|
@ -7,7 +7,7 @@ import newrelic.agent
|
|||
from celery import shared_task
|
||||
from django.db.utils import IntegrityError, ProgrammingError
|
||||
|
||||
from treeherder.etl.exceptions import MissingPushException
|
||||
from treeherder.etl.exceptions import MissingPushError
|
||||
|
||||
|
||||
class retryable_task: # noqa: N801
|
||||
|
@ -28,7 +28,7 @@ class retryable_task: # noqa: N801
|
|||
# For these exceptions, we expect a certain amount of retries
|
||||
# but to report each one is just noise. So don't raise to
|
||||
# New Relic until the retries have been exceeded.
|
||||
HIDE_DURING_RETRIES = (MissingPushException,)
|
||||
HIDE_DURING_RETRIES = (MissingPushError,)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.task_args = args
|
||||
|
|
Загрузка…
Ссылка в новой задаче