Fix Prometheus import error when running Porter

Commit a4de8a88 introduced amazing changes and solved linting errors
like F821. To achive it, this change introduced the import of
PrometheusMetricsConfig in lawful.py, which is dependant of
prometheus-client package.

Ursula imports prometheus-client, so no problem with this. But Porter
does not. So a import error is raised when Porter is run.

Also, a remaining TODO comment has been cleaned. This TODO is part of a
larger comment and was introduced in commit 424e373a and solved
afterwards.
pull/3202/head
Manuel Montenegro 2023-08-23 18:18:14 +02:00
parent aa1dbbade3
commit 545fe3b03f
No known key found for this signature in database
GPG Key ID: AB138CC82DC9FAD4
2 changed files with 7 additions and 3 deletions

View File

@ -0,0 +1 @@
Fix Prometheus import error when running Porter

View File

@ -4,6 +4,7 @@ import time
from pathlib import Path
from queue import Queue
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
@ -116,7 +117,9 @@ from nucypher.policy.policies import Policy
from nucypher.utilities.emitters import StdoutEmitter
from nucypher.utilities.logging import Logger
from nucypher.utilities.networking import validate_operator_ip
from nucypher.utilities.prometheus.metrics import PrometheusMetricsConfig
if TYPE_CHECKING:
from nucypher.utilities.prometheus.metrics import PrometheusMetricsConfig
class Alice(Character, actors.PolicyAuthor):
@ -990,13 +993,13 @@ class Ursula(Teacher, Character, actors.Operator, actors.Ritualist):
def run(
self,
emitter: StdoutEmitter = None,
discovery: bool = True, # TODO: see below
discovery: bool = True,
availability: bool = False,
worker: bool = True,
ritualist: bool = True,
hendrix: bool = True,
start_reactor: bool = True,
prometheus_config: PrometheusMetricsConfig = None,
prometheus_config: "PrometheusMetricsConfig" = None,
preflight: bool = True,
block_until_ready: bool = True,
eager: bool = False,