diff --git a/comfy/cmd/main_pre.py b/comfy/cmd/main_pre.py index 4170dce8c..c14bc436f 100644 --- a/comfy/cmd/main_pre.py +++ b/comfy/cmd/main_pre.py @@ -29,13 +29,15 @@ import sys import warnings from opentelemetry import trace +from opentelemetry.semconv import attributes from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.instrumentation.aio_pika import AioPikaInstrumentor from opentelemetry.instrumentation.requests import RequestsInstrumentor +from opentelemetry.metrics import set_meter_provider +from opentelemetry.sdk.metrics import MeterProvider from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor, SpanExporter -from opentelemetry.semconv.resource import ResourceAttributes as ResAttrs from .. import options from ..app import logger @@ -114,8 +116,8 @@ def _fix_pytorch_240(): def _create_tracer(): resource = Resource.create({ - ResAttrs.SERVICE_NAME: args.otel_service_name, - ResAttrs.SERVICE_VERSION: args.otel_service_version, + attributes.SERVICE_NAME: args.otel_service_name, + attributes.SERVICE_VERSION: args.otel_service_version, }) # omit progress spans from aio pika @@ -152,5 +154,11 @@ def _configure_logging(): _configure_logging() _fix_pytorch_240() + +# explicitly disable OpenTelemetry metrics by providing a no-op MeterProvider. +# this prevents the SDK from auto-configuring a default OTLP exporter that +# would try to connect to localhost when no metrics configuration is present. +set_meter_provider(MeterProvider()) + tracer = _create_tracer() __all__ = ["args", "tracer"] diff --git a/tests/conftest.py b/tests/conftest.py index c00686f25..5686ab565 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -11,14 +11,17 @@ from typing import Tuple, List import pytest import requests +os.environ['OTEL_METRICS_EXPORTER'] = 'none' +os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1" +os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1" +# fixes issues with running the testcontainers rabbitmqcontainer on Windows +os.environ["TC_HOST"] = "localhost" + from comfy.cli_args_types import Configuration logging.getLogger("pika").setLevel(logging.CRITICAL + 1) logging.getLogger("aio_pika").setLevel(logging.CRITICAL + 1) -# fixes issues with running the testcontainers rabbitmqcontainer on Windows -os.environ["TC_HOST"] = "localhost" - def run_server(server_arguments: Configuration): from comfy.cmd.main import main diff --git a/tests/unit/test_svg.py b/tests/unit/test_svg.py index 88294021e..ca2f444f6 100644 --- a/tests/unit/test_svg.py +++ b/tests/unit/test_svg.py @@ -3,12 +3,19 @@ import torch from comfy_extras.nodes.nodes_svg import ImageToSVG, SVGToImage +SKIP = False +try: + import skia +except (ImportError, ModuleNotFoundError): + SKIP = True + @pytest.fixture def sample_image(): return torch.rand((1, 64, 64, 3)) +@pytest.mark.skipif(SKIP, reason="skia import error") def test_image_to_svg(sample_image): image_to_svg_node = ImageToSVG() @@ -21,6 +28,7 @@ def test_image_to_svg(sample_image): assert svg_result[0].startswith('