enable ruff isort and additional checks

Assisted-By: claude-code sonnet 4.6
Change-Id: I1a53c923fc45e25f8da6836c0b17c985353fe697
Signed-off-by: Sean Mooney <work@seanmooney.info>
This commit is contained in:
Sean Mooney
2026-03-20 19:11:20 +00:00
parent 13fb52e508
commit c66dceb705
329 changed files with 841 additions and 451 deletions
+1 -1
View File
@@ -17,8 +17,8 @@ import importlib
import inspect
from docutils import nodes
from docutils.parsers import rst
from docutils import statemachine
from docutils.parsers import rst
from watcher.version import version_string
+1 -1
View File
@@ -20,8 +20,8 @@ It is used via a single directive in the .rst file
"""
from docutils.parsers.rst import Directive
from docutils import nodes
from docutils.parsers.rst import Directive
from watcher.notifications import base as notification
from watcher.objects import base
+1
View File
@@ -16,6 +16,7 @@ import sys
from watcher import objects
objects.register_all()
# If extensions (or modules to document with autodoc) are in another directory,
+21 -1
View File
@@ -7,7 +7,8 @@ line-length = 79
target-version = "py310"
[tool.ruff.lint]
select = ["E4", "E5", "E7", "E9", "F", "S", "UP", "W", "C90"]
select = ["C90","E4", "E5", "E7", "E9", "F", "G", "I", "LOG","S", "UP", "W"]
external = ["H"]
ignore = [
# we only use asserts for type narrowing
"S101",
@@ -21,6 +22,10 @@ ignore = [
"S106",
# S110 `try`-`except`-`pass` detected, consider logging the exception
"S110",
# UP031 % format — defer f-string migration to a later pass
"UP031",
# UP032 f-string — defer migration to a later pass
"UP032",
]
[tool.ruff.lint.per-file-ignores]
"watcher/tests/*" = ["S"]
@@ -34,3 +39,18 @@ max-complexity = 20
[tool.bandit]
exclude_dirs = ['tests']
skips = ['B101', 'B311', 'B320']
[tool.ruff.lint.isort]
known-first-party = ["watcher"]
force-single-line = true
lines-after-imports = 2
lines-between-types = 1
section-order = ["future", "standard-library", "third-party", "first-party"]
# this is the default but just being explicit about the behavior
# in case that ever changes.
force-sort-within-sections = false
[tool.ruff.format]
quote-style = "preserve"
docstring-code-format = true
skip-magic-trailing-comma = true
+1
View File
@@ -15,6 +15,7 @@
import setuptools
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)
+4 -1
View File
@@ -135,7 +135,10 @@ commands =
filename = *.py,app.wsgi
show-source=True
# W504 line break after binary operator
ignore= H105,E123,E226,N320,H202,W504
# H301 one import per line incorrectly triggers when
# imports need to be wrapped in () due to line length
# H306 ruff handles imports
ignore= H105,E123,E226,N320,H202,W504,W503,H306,H301
builtins= _
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes
+2
View File
@@ -14,8 +14,10 @@
# limitations under the License.
#
import oslo_i18n
from oslo_i18n import _lazy
# The domain is the name of the App which is used to generate the folder
# containing the translation files (i.e. the .pot file and the various locales)
DOMAIN = "watcher"
+2 -1
View File
@@ -17,8 +17,9 @@
"""Access Control Lists (ACL's) control access the API server."""
from watcher.api.middleware import auth_token
from watcher import conf
from watcher.api.middleware import auth_token
CONF = conf.CONF
+4 -2
View File
@@ -15,15 +15,17 @@
# under the License.
import pecan
from oslo_middleware import cors
from oslo_middleware import http_proxy_to_wsgi
from oslo_middleware import request_id
import pecan
from watcher import conf
from watcher.api import acl
from watcher.api import config as api_config
from watcher.api.middleware import parsable_error
from watcher import conf
CONF = conf.CONF
+1
View File
@@ -20,4 +20,5 @@ Use this file for deploying the API service under Apache2 mod_wsgi.
# Please switch to automatically generated watcher-api-wsgi script instead.
from watcher.api import wsgi
application = wsgi.initialize_wsgi_app(show_deprecated=True)
+2
View File
@@ -13,8 +13,10 @@
# limitations under the License.
from oslo_config import cfg
from watcher.api import hooks
# Server Specific Configurations
# See https://pecan.readthedocs.org/en/latest/configuration.html#server-configuration # noqa
server = {
+2 -1
View File
@@ -16,8 +16,9 @@ import datetime
import functools
import microversion_parse
from webob import exc
import wsme
from webob import exc
from wsme import types as wtypes
+1
View File
@@ -15,6 +15,7 @@
# limitations under the License.
import pecan
from wsme import types as wtypes
from watcher.api.controllers import base
+2 -1
View File
@@ -16,9 +16,10 @@
import importlib
import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from watcher.api.controllers import base
from watcher.api.controllers import link
+3 -2
View File
@@ -22,11 +22,12 @@ NOTE: IN PROGRESS AND NOT FULLY IMPLEMENTED.
import datetime
import pecan
import wsme
import wsmeext.pecan as wsme_pecan
from pecan import rest
from webob import exc
import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from watcher.api.controllers import base
from watcher.api.controllers import link
+5 -4
View File
@@ -58,13 +58,15 @@ possible to :ref:`develop new implementations <implement_action_plugin>` which
are dynamically loaded by Watcher at launch time.
"""
from oslo_utils import timeutils
import pecan
from pecan import rest
import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from oslo_utils import timeutils
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher._i18n import _
from watcher.api.controllers import base
from watcher.api.controllers import link
@@ -73,7 +75,6 @@ from watcher.api.controllers.v1 import types
from watcher.api.controllers.v1 import utils as api_utils
from watcher.common import exception
from watcher.common import policy
from watcher import objects
def hide_fields_in_newer_versions(obj):
+8 -5
View File
@@ -54,14 +54,17 @@ state machine <action_plan_state_machine>`.
"""
from http import HTTPStatus
from oslo_log import log
from oslo_utils import timeutils
import pecan
from pecan import rest
import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from oslo_log import log
from oslo_utils import timeutils
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher._i18n import _
from watcher.api.controllers import base
from watcher.api.controllers import link
@@ -73,9 +76,9 @@ from watcher.applier import rpcapi
from watcher.common import exception
from watcher.common import policy
from watcher.common import utils
from watcher import objects
from watcher.objects import action_plan as ap_objects
LOG = log.getLogger(__name__)
+10 -7
View File
@@ -29,19 +29,22 @@ states, visit :ref:`the Audit State machine <audit_state_machine>`.
"""
import datetime
from datetime import timezone
from datetime import timezone
from http import HTTPStatus
import jsonschema
from oslo_log import log
from oslo_utils import timeutils
import pecan
from pecan import rest
import wsme
from wsme import types as wtypes
from wsme import utils as wutils
import wsmeext.pecan as wsme_pecan
from oslo_log import log
from oslo_utils import timeutils
from pecan import rest
from wsme import types as wtypes
from wsme import utils as wutils
from watcher import objects
from watcher._i18n import _
from watcher.api.controllers import base
from watcher.api.controllers import link
@@ -52,7 +55,7 @@ from watcher.common import exception
from watcher.common import policy
from watcher.common import utils
from watcher.decision_engine import rpcapi
from watcher import objects
LOG = log.getLogger(__name__)
+6 -4
View File
@@ -43,13 +43,16 @@ will be launched automatically or will need a manual confirmation from the
"""
from http import HTTPStatus
from oslo_utils import timeutils
import pecan
from pecan import rest
import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from oslo_utils import timeutils
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher._i18n import _
from watcher.api.controllers import base
from watcher.api.controllers import link
@@ -61,7 +64,6 @@ from watcher.common import exception
from watcher.common import policy
from watcher.common import utils as common_utils
from watcher.decision_engine.loading import default as default_loading
from watcher import objects
def hide_fields_in_newer_versions(obj):
+1
View File
@@ -15,6 +15,7 @@
# limitations under the License.
import pecan
from wsme import types as wtypes
from watcher.api.controllers import base
+2 -1
View File
@@ -18,9 +18,10 @@ An Interface for users and admin to List Data Model.
"""
import pecan
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from watcher.api.controllers.v1 import types
from watcher.api.controllers.v1 import utils
@@ -34,8 +34,8 @@ import numbers
from wsme import types as wtypes
from watcher.api.controllers import base
from watcher import objects
from watcher.api.controllers import base
class EfficacyIndicator(base.APIBase):
+4 -3
View File
@@ -32,10 +32,12 @@ Here are some examples of :ref:`Goals <goal_definition>`:
"""
import pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher.api.controllers import base
from watcher.api.controllers import link
from watcher.api.controllers.v1 import collection
@@ -43,7 +45,6 @@ from watcher.api.controllers.v1 import types
from watcher.api.controllers.v1 import utils as api_utils
from watcher.common import exception
from watcher.common import policy
from watcher import objects
def hide_fields_in_newer_versions(obj):
+4 -3
View File
@@ -27,10 +27,12 @@ be needed by the user of a given scoring engine.
"""
import pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher.api.controllers import base
from watcher.api.controllers import link
from watcher.api.controllers.v1 import collection
@@ -38,7 +40,6 @@ from watcher.api.controllers.v1 import types
from watcher.api.controllers.v1 import utils as api_utils
from watcher.common import exception
from watcher.common import policy
from watcher import objects
def hide_fields_in_newer_versions(obj):
+5 -3
View File
@@ -18,14 +18,17 @@ Service mechanism provides ability to monitor Watcher services state.
"""
import datetime
import pecan
import wsmeext.pecan as wsme_pecan
from oslo_config import cfg
from oslo_log import log
from oslo_utils import timeutils
import pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from watcher import objects
from watcher.api.controllers import base
from watcher.api.controllers import link
from watcher.api.controllers.v1 import collection
@@ -33,7 +36,6 @@ from watcher.api.controllers.v1 import utils as api_utils
from watcher.common import context
from watcher.common import exception
from watcher.common import policy
from watcher import objects
CONF = cfg.CONF
+4 -3
View File
@@ -27,10 +27,12 @@ to find an optimal :ref:`Solution <solution_definition>`.
"""
import pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher.api.controllers import base
from watcher.api.controllers import link
from watcher.api.controllers.v1 import collection
@@ -40,7 +42,6 @@ from watcher.common import exception
from watcher.common import policy
from watcher.common import utils as common_utils
from watcher.decision_engine import rpcapi
from watcher import objects
def hide_fields_in_newer_versions(obj):
+2 -1
View File
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import wsme
from oslo_serialization import jsonutils
from oslo_utils import strutils
import wsme
from wsme import types as wtypes
from watcher._i18n import _
+6 -4
View File
@@ -16,16 +16,18 @@
from operator import attrgetter
import jsonpatch
from oslo_config import cfg
from oslo_utils import reflection
from oslo_utils import uuidutils
import pecan
import wsme
from oslo_config import cfg
from oslo_utils import reflection
from oslo_utils import uuidutils
from watcher import objects
from watcher._i18n import _
from watcher.api.controllers.v1 import versions
from watcher.common import utils
from watcher import objects
CONF = cfg.CONF
+7 -4
View File
@@ -15,17 +15,20 @@ Webhook endpoint for Watcher v1 REST API.
"""
from http import HTTPStatus
from oslo_log import log
import pecan
from pecan import rest
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from oslo_log import log
from pecan import rest
from wsme import types as wtypes
from watcher import objects
from watcher.api.controllers.v1 import types
from watcher.api.controllers.v1 import utils
from watcher.common import exception
from watcher.decision_engine import rpcapi
from watcher import objects
LOG = log.getLogger(__name__)
+1
View File
@@ -15,6 +15,7 @@
from http import HTTPStatus
from oslo_config import cfg
from pecan import hooks
+2 -2
View File
@@ -14,14 +14,14 @@
import re
from oslo_log import log
from keystonemiddleware import auth_token
from oslo_log import log
from watcher._i18n import _
from watcher.common import exception
from watcher.common import utils
LOG = log.getLogger(__name__)
+4 -2
View File
@@ -21,12 +21,14 @@ Based on pecan.middleware.errordocument
from xml import etree as et
from oslo_log import log
from oslo_serialization import jsonutils
import webob
from oslo_log import log
from oslo_serialization import jsonutils
from watcher._i18n import _
LOG = log.getLogger(__name__)
+2 -1
View File
@@ -13,8 +13,9 @@
import sys
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_config import cfg
from oslo_log import log
from watcher.api import app
+5 -4
View File
@@ -18,14 +18,15 @@
from oslo_config import cfg
from oslo_log import log
from watcher._i18n import _
from watcher.applier.action_plan import base
from watcher.applier import default
from watcher.common import exception
from watcher import notifications
from watcher import objects
from watcher._i18n import _
from watcher.applier import default
from watcher.applier.action_plan import base
from watcher.common import exception
from watcher.objects import fields
CONF = cfg.CONF
LOG = log.getLogger(__name__)
@@ -26,6 +26,7 @@ from watcher.common import exception
from watcher.common.metal_helper import constants as metal_constants
from watcher.common.metal_helper import factory as metal_helper_factory
LOG = log.getLogger(__name__)
+1
View File
@@ -18,6 +18,7 @@ from oslo_log import log
from watcher.applier.loading import default
LOG = log.getLogger(__name__)
+2
View File
@@ -18,11 +18,13 @@
from oslo_log import log
from watcher._i18n import _
from watcher.applier.actions import base
from watcher.common import exception
from watcher.common import nova_helper
LOG = log.getLogger(__name__)
+1
View File
@@ -21,6 +21,7 @@ from oslo_log import log
from watcher.applier.actions import base
from watcher.common import exception
LOG = log.getLogger(__name__)
+1
View File
@@ -23,6 +23,7 @@ from watcher.applier.actions import base
from watcher.common import exception
from watcher.common import nova_helper
LOG = log.getLogger(__name__)
+2
View File
@@ -19,8 +19,10 @@
import time
from oslo_log import log
from watcher.applier.actions import base
LOG = log.getLogger(__name__)
+1
View File
@@ -20,6 +20,7 @@ from watcher.applier.actions import base
from watcher.common import exception
from watcher.common import nova_helper
LOG = log.getLogger(__name__)
+6 -4
View File
@@ -18,12 +18,13 @@ import jsonschema
from cinderclient import exceptions as cinder_exception
from oslo_log import log
from watcher import conf
from watcher._i18n import _
from watcher.applier.actions import base
from watcher.common import cinder_helper
from watcher.common import exception
from watcher.common import nova_helper
from watcher import conf
CONF = conf.CONF
LOG = log.getLogger(__name__)
@@ -138,7 +139,7 @@ class VolumeMigrate(base.BaseAction):
# if the volume is in-use. If the volume has no attachments
# allow cinder to decided if it can be migrated.
if not volume.attachments:
LOG.debug(f"volume: {volume.id} has no attachments")
LOG.debug("volume: %s has no attachments", volume.id)
return True
# since it has attachments we need to validate nova's constraints
@@ -153,8 +154,9 @@ class VolumeMigrate(base.BaseAction):
return False
instance_status = instance.status
LOG.debug(
f"volume: {volume.id} is attached to instance: {instance_id} "
f"in instance status: {instance_status}")
"volume: %s is attached to instance: %s "
"in instance status: %s",
volume.id, instance_id, instance_status)
# NOTE(sean-k-mooney): This used to allow RESIZED which
# is the resize_verify task state, that is not an acceptable time
# to migrate volumes, if nova does not block this in the API
+2 -1
View File
@@ -18,9 +18,10 @@
from oslo_config import cfg
from oslo_log import log
from watcher import objects
from watcher.applier import base
from watcher.applier.loading import default
from watcher import objects
LOG = log.getLogger(__name__)
CONF = cfg.CONF
+1 -1
View File
@@ -17,10 +17,10 @@
# limitations under the License.
#
from watcher import conf
from watcher.applier.messaging import trigger
from watcher.common import service_manager
from watcher import conf
CONF = conf.CONF
+2 -1
View File
@@ -18,9 +18,10 @@
from oslo_config import cfg
from oslo_log import log
from watcher import objects
from watcher.applier.action_plan import default
from watcher.common import executor
from watcher import objects
LOG = log.getLogger(__name__)
CONF = cfg.CONF
+1 -1
View File
@@ -16,12 +16,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from watcher import conf
from watcher.common import exception
from watcher.common import service
from watcher.common import service_manager
from watcher.common import utils
from watcher import conf
CONF = conf.CONF
+2 -2
View File
@@ -17,12 +17,12 @@
from oslo_config import cfg
from oslo_log import log
from watcher import notifications
from watcher import objects
from watcher.applier import rpcapi
from watcher.applier import sync
from watcher.common import service
from watcher import notifications
from watcher import objects
CONF = cfg.CONF
LOG = log.getLogger(__name__)
+1 -1
View File
@@ -17,10 +17,10 @@
from oslo_config import cfg
from oslo_log import log
from watcher import objects
from watcher.applier.loading import default
from watcher.common import context
from watcher.common import exception
from watcher import objects
CONF = cfg.CONF
+2 -2
View File
@@ -20,13 +20,13 @@ import abc
from oslo_log import log
from taskflow import task as flow_task
from watcher import notifications
from watcher import objects
from watcher._i18n import _
from watcher.applier.actions import factory
from watcher.common import clients
from watcher.common import exception
from watcher.common.loader import loadable
from watcher import notifications
from watcher import objects
from watcher.objects import fields
+4 -3
View File
@@ -19,14 +19,15 @@ from oslo_config import cfg
from oslo_log import log
from taskflow import engines
from taskflow import exceptions as tf_exception
from taskflow.patterns import graph_flow as gf
from taskflow import task as flow_task
from taskflow.patterns import graph_flow as gf
from watcher.applier.workflow_engine import base
from watcher.common import exception
from watcher import conf
from watcher import eventlet as eventlet_helper
from watcher import objects
from watcher.applier.workflow_engine import base
from watcher.common import exception
CONF = conf.CONF
+2 -1
View File
@@ -22,11 +22,12 @@ import sys
from oslo_config import cfg
from watcher.common import service
from watcher import conf
from watcher.common import service
from watcher.db import migration
from watcher.db import purge
CONF = conf.CONF
+3 -1
View File
@@ -25,8 +25,10 @@
# That is problematic and can lead to errors on python 3.12+.
# The maas support added asyncio to the codebase which is unsafe to mix
# with eventlets by default.
from watcher.common import oslo_service_helper as helper
from watcher import eventlet
from watcher.common import oslo_service_helper as helper
eventlet.patch()
# NOTE(dviroel): oslo service backend needs to be initialize
+2 -1
View File
@@ -21,8 +21,9 @@ import sys
from oslo_config import cfg
from oslo_log import log
from watcher.common import service
from watcher import conf
from watcher.common import service
LOG = log.getLogger(__name__)
CONF = conf.CONF
+2 -1
View File
@@ -21,10 +21,11 @@ import sys
from oslo_log import log
from watcher import conf
from watcher.applier import service as applier_service
from watcher.applier import sync
from watcher.common import service as watcher_service
from watcher import conf
LOG = log.getLogger(__name__)
CONF = conf.CONF
+2 -1
View File
@@ -21,12 +21,13 @@ import sys
from oslo_log import log
from watcher.common import service as watcher_service
from watcher import conf
from watcher.common import service as watcher_service
from watcher.decision_engine import gmr
from watcher.decision_engine import service as decision_engine_service
from watcher.decision_engine import sync
LOG = log.getLogger(__name__)
CONF = conf.CONF
+2 -1
View File
@@ -17,9 +17,10 @@ import sys
from oslo_upgradecheck import common_checks
from oslo_upgradecheck import upgradecheck
from watcher import conf
from watcher._i18n import _
from watcher.common import clients
from watcher import conf
CONF = conf.CONF
+2 -1
View File
@@ -21,10 +21,11 @@ import sys
from oslo_log import log
from watcher.common import service
from watcher import conf
from watcher.common import service
from watcher.decision_engine import sync
LOG = log.getLogger(__name__)
CONF = conf.CONF
+7 -6
View File
@@ -14,14 +14,15 @@
import time
from oslo_log import log
from cinderclient import exceptions as cinder_exception
from cinderclient.v3.volumes import Volume
from oslo_log import log
from watcher import conf
from watcher._i18n import _
from watcher.common import clients
from watcher.common import exception
from watcher import conf
CONF = conf.CONF
LOG = log.getLogger(__name__)
@@ -138,9 +139,9 @@ class CinderHelper:
# not defined in the pool, so the type can't be used in the
# pool
LOG.debug(
f"property {field_name} with value {field_value} "
f"does not match value {pool_value} from pool "
f"{pool['name']}"
"property %s with value %s does not match value "
"%s from pool %s",
field_name, field_value, pool_value, pool['name']
)
return False
return True
+4 -2
View File
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import warnings
import debtcollector
import microversion_parse
from oslo_config import cfg
import warnings
from cinderclient import client as ciclient
from gnocchiclient import client as gnclient
@@ -23,11 +23,13 @@ from keystoneauth1 import loading as ka_loading
from keystoneauth1 import session as ka_session
from keystoneclient import client as keyclient
from openstack import connection
from oslo_config import cfg
from watcher.common import context
from watcher.common import exception
from watcher.common import utils
try:
from maas import client as maas_client
except ImportError:
+1 -1
View File
@@ -18,8 +18,8 @@
from oslo_config import cfg
from oslo_middleware import cors
from watcher.common import rpc
from watcher import version
from watcher.common import rpc
def set_lib_defaults():
+2
View File
@@ -25,12 +25,14 @@ import functools
import sys
from http import HTTPStatus
from keystoneclient import exceptions as keystone_exceptions
from oslo_config import cfg
from oslo_log import log
from watcher._i18n import _
LOG = log.getLogger(__name__)
CONF = cfg.CONF
+16 -16
View File
@@ -12,13 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from apscheduler.executors import pool as pool_executor
import futurist
from apscheduler.executors import pool as pool_executor
from oslo_config import cfg
from oslo_log import log
from watcher import eventlet as eventlet_helper
LOG = log.getLogger(__name__)
CONF = cfg.CONF
@@ -50,24 +52,22 @@ def log_executor_stats(executor, name="unknown"):
try:
if isinstance(executor, futurist.ThreadPoolExecutor):
LOG.debug(
f"State of {name} ThreadPoolExecutor when submitting a new "
f"task: max_workers: {executor._max_workers:d}, "
f"workers: {len(executor._workers):d}, "
"idle workers: "
f"{len([w for w in executor._workers if w.idle]):d}, "
f"queued work: {executor._work_queue.qsize():d}, "
f"stats: {stats}")
"State of %s ThreadPoolExecutor when submitting a new "
"task: max_workers: %d, workers: %d, idle workers: %d, "
"queued work: %d, stats: %s",
name, executor._max_workers, len(executor._workers),
len([w for w in executor._workers if w.idle]),
executor._work_queue.qsize(), stats)
elif isinstance(executor, futurist.GreenThreadPoolExecutor):
LOG.debug(
f"State of {name} GreenThreadPoolExecutor when submitting a "
"new task: "
f"workers: {len(executor._pool.coroutines_running):d}, "
f"max_workers: {executor._pool.size:d}, "
f"work queued length: "
f"{executor._delayed_work.unfinished_tasks:d}, "
f"stats: {stats}")
"State of %s GreenThreadPoolExecutor when submitting a "
"new task: workers: %d, max_workers: %d, "
"work queued length: %d, stats: %s",
name, len(executor._pool.coroutines_running),
executor._pool.size,
executor._delayed_work.unfinished_tasks, stats)
except Exception as e:
LOG.debug(f"Failed to log executor stats for {name}: {e}")
LOG.debug("Failed to log executor stats for %s: %s", name, e)
class APSchedulerThreadPoolExecutor(pool_executor.BasePoolExecutor):
+1
View File
@@ -22,6 +22,7 @@ from watcher.common import clients
from watcher.common import exception
from watcher.common import utils
LOG = log.getLogger(__name__)
+5 -4
View File
@@ -12,13 +12,14 @@
# limitations under the License.
#
from keystoneauth1.exceptions import http as ks_exceptions
from oslo_log import log
from keystoneauth1.exceptions import http as ks_exceptions
from watcher import conf
from watcher._i18n import _
from watcher.common import clients
from watcher.common import exception
from watcher import conf
CONF = conf.CONF
LOG = log.getLogger(__name__)
@@ -93,10 +94,10 @@ class KeystoneHelper:
services = self.keystone.services.list(type=svc_type)
svcs_enabled = [svc for svc in services if svc.enabled]
if len(svcs_enabled) == 0:
LOG.warning(f"Service enabled not found for type: {svc_type}")
LOG.warning("Service enabled not found for type: %s", svc_type)
return False
elif len(svcs_enabled) > 1:
LOG.warning(f"Multiple services found for type: {svc_type}")
LOG.warning("Multiple services found for type: %s", svc_type)
return False
# if there is only one enabled service, consider it a valid
# case
+2 -1
View File
@@ -19,8 +19,9 @@ from stevedore import driver as drivermanager
from stevedore import extension as extensionmanager
from watcher.common import exception
from watcher.common.loader import base
from watcher.common import utils
from watcher.common.loader import base
LOG = log.getLogger(__name__)
+1 -1
View File
@@ -16,8 +16,8 @@
import abc
from watcher.common import exception
from watcher.common.metal_helper import constants as metal_constants
from watcher.common import nova_helper
from watcher.common.metal_helper import constants as metal_constants
class BaseMetalNode(abc.ABC):
+1
View File
@@ -19,6 +19,7 @@ from watcher.common import clients
from watcher.common.metal_helper import ironic
from watcher.common.metal_helper import maas
CONF = cfg.CONF
+1
View File
@@ -18,6 +18,7 @@ from oslo_log import log
from watcher.common.metal_helper import base
from watcher.common.metal_helper import constants as metal_constants
LOG = log.getLogger(__name__)
POWER_STATES_MAP = {
+2 -1
View File
@@ -17,9 +17,10 @@ from oslo_config import cfg
from oslo_log import log
from watcher.common import exception
from watcher.common import utils
from watcher.common.metal_helper import base
from watcher.common.metal_helper import constants as metal_constants
from watcher.common import utils
CONF = cfg.CONF
LOG = log.getLogger(__name__)
+5 -2
View File
@@ -21,16 +21,19 @@ import functools
import time
import uuid
import microversion_parse
from keystoneauth1 import exceptions as ksa_exc
from keystoneauth1 import loading as ks_loading
import microversion_parse
from openstack import exceptions as sdk_exc
from oslo_log import log
from watcher import conf
from watcher.common import clients
from watcher.common import exception
from watcher import conf
from watcher.conf import clients_auth
LOG = log.getLogger(__name__)
CONF = conf.CONF
+1
View File
@@ -17,6 +17,7 @@ from oslo_service import backend
from watcher import eventlet as eventlet_helper
LOG = log.getLogger(__name__)
+2
View File
@@ -12,11 +12,13 @@
# limitations under the License.
from http import HTTPStatus
from oslo_config import cfg
from oslo_log import log as logging
from watcher.common import clients
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
ACTION = 'action:%s'
rules = [
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
ACTION_PLAN = 'action_plan:%s'
rules = [
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
AUDIT = 'audit:%s'
rules = [
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
AUDIT_TEMPLATE = 'audit_template:%s'
rules = [
+1
View File
@@ -12,6 +12,7 @@
from oslo_policy import policy
RULE_ADMIN_API = 'rule:admin_api'
ROLE_ADMIN_OR_ADMINISTRATOR = 'role:admin or role:administrator'
ALWAYS_DENY = '!'
+1
View File
@@ -16,6 +16,7 @@ from oslo_policy import policy
from watcher.common.policies import base
DATA_MODEL = 'data_model:%s'
rules = [
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
GOAL = 'goal:%s'
rules = [
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
SCORING_ENGINE = 'scoring_engine:%s'
rules = [
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
SERVICE = 'service:%s'
rules = [
+1
View File
@@ -14,6 +14,7 @@ from oslo_policy import policy
from watcher.common.policies import base
STRATEGY = 'strategy:%s'
rules = [
+1
View File
@@ -23,6 +23,7 @@ from oslo_policy import policy
from watcher.common import exception
from watcher.common import policies
_ENFORCER = None
CONF = cfg.CONF
+3 -2
View File
@@ -13,15 +13,16 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log
import oslo_messaging as messaging
from oslo_config import cfg
from oslo_log import log
from oslo_messaging.rpc import dispatcher
from watcher.common import context as watcher_context
from watcher.common import exception
__all__ = [
'init',
'cleanup',
+2 -2
View File
@@ -17,11 +17,11 @@
from apscheduler import events
from apscheduler.schedulers import background
from oslo_service import service
from watcher.common import executor
from watcher import eventlet as eventlet_helper
from watcher.common import executor
job_events = events
+4 -3
View File
@@ -17,17 +17,20 @@ import abc
import datetime
import socket
import oslo_messaging as messaging
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import _options
from oslo_log import log
import oslo_messaging as messaging
from oslo_reports import guru_meditation_report as gmr
from oslo_reports import opts as gmr_opts
from oslo_service import service
from oslo_service import wsgi
from oslo_utils import timeutils
from watcher import objects
from watcher import version
from watcher._i18n import _
from watcher.api import app
from watcher.common import config
@@ -35,10 +38,8 @@ from watcher.common import context
from watcher.common import rpc
from watcher.common import scheduling
from watcher.conf import plugins as plugins_conf
from watcher import objects
from watcher.objects import base
from watcher.objects import fields as wfields
from watcher import version
NOTIFICATION_OPTS = [
+3 -2
View File
@@ -20,10 +20,10 @@ import datetime
import inspect
import re
from croniter import croniter
import eventlet
from eventlet import tpool
from croniter import croniter
from eventlet import tpool
from jsonschema import validators
from oslo_config import cfg
from oslo_log import log
@@ -32,6 +32,7 @@ from oslo_utils import uuidutils
from watcher.common import exception
CONF = cfg.CONF
LOG = log.getLogger(__name__)
+1
View File
@@ -43,6 +43,7 @@ from watcher.conf import planner
from watcher.conf import prometheus_client
from watcher.conf import service
CONF = cfg.CONF
service.register_opts(CONF)
+1
View File
@@ -15,6 +15,7 @@
from oslo_config import cfg
aetos_client = cfg.OptGroup(name='aetos_client',
title='Configuration Options for Aetos',
help="See https://docs.openstack.org/watcher/"
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
api = cfg.OptGroup(name='api',
title='Options for the Watcher API service')
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
watcher_applier = cfg.OptGroup(name='watcher_applier',
title='Options for the Applier messaging '
'core')
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
cinder_client = cfg.OptGroup(name='cinder_client',
title='Configuration Options for Cinder')
+1
View File
@@ -17,6 +17,7 @@
from keystoneauth1 import loading as ka_loading
WATCHER_CLIENTS_AUTH = 'watcher_clients_auth'
+1
View File
@@ -20,6 +20,7 @@ from oslo_config import cfg
from watcher.decision_engine.datasources import manager
from watcher.decision_engine.datasources import prometheus
datasources = cfg.OptGroup(name='watcher_datasources',
title='Configuration Options for watcher'
' datasources')
+1
View File
@@ -20,6 +20,7 @@ from oslo_db import options as oslo_db_options
from watcher.conf import paths
_DEFAULT_SQL_CONNECTION = 'sqlite:///{}'.format(
paths.state_path_def('watcher.sqlite'))
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
EXC_LOG_OPTS = [
cfg.BoolOpt('fatal_exception_format_errors',
default=False,
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
gnocchi_client = cfg.OptGroup(name='gnocchi_client',
title='Configuration Options for Gnocchi')
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
grafana_client = cfg.OptGroup(name='grafana_client',
title='Configuration Options for Grafana',
help="See https://docs.openstack.org/watcher/lat"
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
grafana_translators = cfg.OptGroup(name='grafana_translators',
title='Configuration Options for Grafana '
'transalators')
+1
View File
@@ -17,6 +17,7 @@
from oslo_config import cfg
ironic_client = cfg.OptGroup(name='ironic_client',
title='Configuration Options for Ironic')

Some files were not shown because too many files have changed in this diff Show More