Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>tags/1.9.0
| def _log(message: str): | def _log(message: str): | ||||
| print(message, flush=True) | |||||
| _logger.debug(message) | |||||
| # grpc gevent | # grpc gevent |
| if jina_plugin_id not in installed_plugins_ids: | if jina_plugin_id not in installed_plugins_ids: | ||||
| if jina_plugin_unique_identifier: | if jina_plugin_unique_identifier: | ||||
| # install jina plugin | # install jina plugin | ||||
| print(jina_plugin_unique_identifier) | |||||
| logger.debug("Installing Jina plugin %s", jina_plugin_unique_identifier) | |||||
| PluginService.install_from_marketplace_pkg(tenant_id, [jina_plugin_unique_identifier]) | PluginService.install_from_marketplace_pkg(tenant_id, [jina_plugin_unique_identifier]) | ||||
| auth_count = 0 | auth_count = 0 |
| import json | import json | ||||
| import logging | |||||
| import threading | import threading | ||||
| from collections.abc import Mapping, MutableMapping | from collections.abc import Mapping, MutableMapping | ||||
| from pathlib import Path | from pathlib import Path | ||||
| class SchemaRegistry: | class SchemaRegistry: | ||||
| """Schema registry manages JSON schemas with version support""" | """Schema registry manages JSON schemas with version support""" | ||||
| logger: ClassVar[logging.Logger] = logging.getLogger(__name__) | |||||
| _default_instance: ClassVar[Optional["SchemaRegistry"]] = None | _default_instance: ClassVar[Optional["SchemaRegistry"]] = None | ||||
| _lock: ClassVar[threading.Lock] = threading.Lock() | _lock: ClassVar[threading.Lock] = threading.Lock() | ||||
| self.metadata[uri] = metadata | self.metadata[uri] = metadata | ||||
| except (OSError, json.JSONDecodeError) as e: | except (OSError, json.JSONDecodeError) as e: | ||||
| print(f"Warning: failed to load schema {version}/{schema_name}: {e}") | |||||
| self.logger.warning("Failed to load schema %s/%s: %s", version, schema_name, e) | |||||
| def get_schema(self, uri: str) -> Any | None: | def get_schema(self, uri: str) -> Any | None: | ||||
| """Retrieves a schema by URI with version support""" | """Retrieves a schema by URI with version support""" |
| import json | import json | ||||
| import logging | |||||
| from datetime import UTC, datetime | from datetime import UTC, datetime | ||||
| from pathlib import Path | from pathlib import Path | ||||
| from uuid import uuid4 | from uuid import uuid4 | ||||
| from services.plugin.plugin_migration import PluginMigration | from services.plugin.plugin_migration import PluginMigration | ||||
| from services.plugin.plugin_service import PluginService | from services.plugin.plugin_service import PluginService | ||||
| logger = logging.getLogger(__name__) | |||||
| class RagPipelineTransformService: | class RagPipelineTransformService: | ||||
| def transform_dataset(self, dataset_id: str): | def transform_dataset(self, dataset_id: str): | ||||
| if plugin_unique_identifier: | if plugin_unique_identifier: | ||||
| need_install_plugin_unique_identifiers.append(plugin_unique_identifier) | need_install_plugin_unique_identifiers.append(plugin_unique_identifier) | ||||
| if need_install_plugin_unique_identifiers: | if need_install_plugin_unique_identifiers: | ||||
| print(need_install_plugin_unique_identifiers) | |||||
| logger.debug("Installing missing pipeline plugins %s", need_install_plugin_unique_identifiers) | |||||
| PluginService.install_from_marketplace_pkg(tenant_id, need_install_plugin_unique_identifiers) | PluginService.install_from_marketplace_pkg(tenant_id, need_install_plugin_unique_identifiers) | ||||
| def _transfrom_to_empty_pipeline(self, dataset: Dataset): | def _transfrom_to_empty_pipeline(self, dataset: Dataset): |