unrealon 1.0.9__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unrealon/__init__.py +23 -21
- unrealon-1.1.1.dist-info/METADATA +722 -0
- unrealon-1.1.1.dist-info/RECORD +82 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info}/WHEEL +1 -1
- unrealon-1.1.1.dist-info/entry_points.txt +9 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info/licenses}/LICENSE +1 -1
- unrealon_bridge/__init__.py +114 -0
- unrealon_bridge/cli.py +316 -0
- unrealon_bridge/client/__init__.py +93 -0
- unrealon_bridge/client/base.py +78 -0
- unrealon_bridge/client/commands.py +89 -0
- unrealon_bridge/client/connection.py +90 -0
- unrealon_bridge/client/events.py +65 -0
- unrealon_bridge/client/health.py +38 -0
- unrealon_bridge/client/html_parser.py +146 -0
- unrealon_bridge/client/logging.py +139 -0
- unrealon_bridge/client/proxy.py +70 -0
- unrealon_bridge/client/scheduler.py +450 -0
- unrealon_bridge/client/session.py +70 -0
- unrealon_bridge/configs/__init__.py +14 -0
- unrealon_bridge/configs/bridge_config.py +212 -0
- unrealon_bridge/configs/bridge_config.yaml +39 -0
- unrealon_bridge/models/__init__.py +138 -0
- unrealon_bridge/models/base.py +28 -0
- unrealon_bridge/models/command.py +41 -0
- unrealon_bridge/models/events.py +40 -0
- unrealon_bridge/models/html_parser.py +79 -0
- unrealon_bridge/models/logging.py +55 -0
- unrealon_bridge/models/parser.py +63 -0
- unrealon_bridge/models/proxy.py +41 -0
- unrealon_bridge/models/requests.py +95 -0
- unrealon_bridge/models/responses.py +88 -0
- unrealon_bridge/models/scheduler.py +592 -0
- unrealon_bridge/models/session.py +28 -0
- unrealon_bridge/server/__init__.py +91 -0
- unrealon_bridge/server/base.py +171 -0
- unrealon_bridge/server/handlers/__init__.py +23 -0
- unrealon_bridge/server/handlers/command.py +110 -0
- unrealon_bridge/server/handlers/html_parser.py +139 -0
- unrealon_bridge/server/handlers/logging.py +95 -0
- unrealon_bridge/server/handlers/parser.py +95 -0
- unrealon_bridge/server/handlers/proxy.py +75 -0
- unrealon_bridge/server/handlers/scheduler.py +545 -0
- unrealon_bridge/server/handlers/session.py +66 -0
- unrealon_browser/__init__.py +61 -18
- unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
- unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
- unrealon_browser/{src/core → core}/browser_manager.py +2 -2
- unrealon_browser/{src/managers → managers}/captcha.py +1 -1
- unrealon_browser/{src/managers → managers}/cookies.py +1 -1
- unrealon_browser/managers/logger_bridge.py +231 -0
- unrealon_browser/{src/managers → managers}/profile.py +1 -1
- unrealon_driver/__init__.py +73 -19
- unrealon_driver/browser/__init__.py +8 -0
- unrealon_driver/browser/config.py +74 -0
- unrealon_driver/browser/manager.py +416 -0
- unrealon_driver/exceptions.py +28 -0
- unrealon_driver/parser/__init__.py +55 -0
- unrealon_driver/parser/cli_manager.py +141 -0
- unrealon_driver/parser/daemon_manager.py +227 -0
- unrealon_driver/parser/managers/__init__.py +46 -0
- unrealon_driver/parser/managers/browser.py +51 -0
- unrealon_driver/parser/managers/config.py +281 -0
- unrealon_driver/parser/managers/error.py +412 -0
- unrealon_driver/parser/managers/html.py +732 -0
- unrealon_driver/parser/managers/logging.py +609 -0
- unrealon_driver/parser/managers/result.py +321 -0
- unrealon_driver/parser/parser_manager.py +628 -0
- unrealon/sdk_config.py +0 -88
- unrealon-1.0.9.dist-info/METADATA +0 -810
- unrealon-1.0.9.dist-info/RECORD +0 -246
- unrealon_browser/pyproject.toml +0 -182
- unrealon_browser/src/__init__.py +0 -62
- unrealon_browser/src/managers/logger_bridge.py +0 -395
- unrealon_driver/README.md +0 -204
- unrealon_driver/pyproject.toml +0 -187
- unrealon_driver/src/__init__.py +0 -90
- unrealon_driver/src/cli/__init__.py +0 -10
- unrealon_driver/src/cli/main.py +0 -66
- unrealon_driver/src/cli/simple.py +0 -510
- unrealon_driver/src/config/__init__.py +0 -11
- unrealon_driver/src/config/auto_config.py +0 -478
- unrealon_driver/src/core/__init__.py +0 -18
- unrealon_driver/src/core/exceptions.py +0 -289
- unrealon_driver/src/core/parser.py +0 -638
- unrealon_driver/src/dto/__init__.py +0 -66
- unrealon_driver/src/dto/cli.py +0 -119
- unrealon_driver/src/dto/config.py +0 -18
- unrealon_driver/src/dto/events.py +0 -237
- unrealon_driver/src/dto/execution.py +0 -313
- unrealon_driver/src/dto/services.py +0 -311
- unrealon_driver/src/execution/__init__.py +0 -23
- unrealon_driver/src/execution/daemon_mode.py +0 -317
- unrealon_driver/src/execution/interactive_mode.py +0 -88
- unrealon_driver/src/execution/modes.py +0 -45
- unrealon_driver/src/execution/scheduled_mode.py +0 -209
- unrealon_driver/src/execution/test_mode.py +0 -250
- unrealon_driver/src/logging/__init__.py +0 -24
- unrealon_driver/src/logging/driver_logger.py +0 -512
- unrealon_driver/src/services/__init__.py +0 -24
- unrealon_driver/src/services/browser_service.py +0 -726
- unrealon_driver/src/services/llm/__init__.py +0 -15
- unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
- unrealon_driver/src/services/llm/llm.py +0 -195
- unrealon_driver/src/services/logger_service.py +0 -232
- unrealon_driver/src/services/metrics_service.py +0 -185
- unrealon_driver/src/services/scheduler_service.py +0 -489
- unrealon_driver/src/services/websocket_service.py +0 -362
- unrealon_driver/src/utils/__init__.py +0 -16
- unrealon_driver/src/utils/service_factory.py +0 -317
- unrealon_driver/src/utils/time_formatter.py +0 -338
- unrealon_llm/README.md +0 -44
- unrealon_llm/__init__.py +0 -26
- unrealon_llm/pyproject.toml +0 -154
- unrealon_llm/src/__init__.py +0 -228
- unrealon_llm/src/cli/__init__.py +0 -0
- unrealon_llm/src/core/__init__.py +0 -11
- unrealon_llm/src/core/smart_client.py +0 -438
- unrealon_llm/src/dto/__init__.py +0 -155
- unrealon_llm/src/dto/models/__init__.py +0 -0
- unrealon_llm/src/dto/models/config.py +0 -343
- unrealon_llm/src/dto/models/core.py +0 -328
- unrealon_llm/src/dto/models/enums.py +0 -123
- unrealon_llm/src/dto/models/html_analysis.py +0 -345
- unrealon_llm/src/dto/models/statistics.py +0 -473
- unrealon_llm/src/dto/models/translation.py +0 -383
- unrealon_llm/src/dto/models/type_conversion.py +0 -462
- unrealon_llm/src/dto/schemas/__init__.py +0 -0
- unrealon_llm/src/exceptions.py +0 -392
- unrealon_llm/src/llm_config/__init__.py +0 -20
- unrealon_llm/src/llm_config/logging_config.py +0 -178
- unrealon_llm/src/llm_logging/__init__.py +0 -42
- unrealon_llm/src/llm_logging/llm_events.py +0 -107
- unrealon_llm/src/llm_logging/llm_logger.py +0 -466
- unrealon_llm/src/managers/__init__.py +0 -15
- unrealon_llm/src/managers/cache_manager.py +0 -67
- unrealon_llm/src/managers/cost_manager.py +0 -107
- unrealon_llm/src/managers/request_manager.py +0 -298
- unrealon_llm/src/modules/__init__.py +0 -0
- unrealon_llm/src/modules/html_processor/__init__.py +0 -25
- unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
- unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
- unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
- unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
- unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
- unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
- unrealon_llm/src/modules/html_processor/processor.py +0 -102
- unrealon_llm/src/modules/llm/__init__.py +0 -0
- unrealon_llm/src/modules/translator/__init__.py +0 -0
- unrealon_llm/src/provider.py +0 -116
- unrealon_llm/src/utils/__init__.py +0 -95
- unrealon_llm/src/utils/common.py +0 -64
- unrealon_llm/src/utils/data_extractor.py +0 -188
- unrealon_llm/src/utils/html_cleaner.py +0 -767
- unrealon_llm/src/utils/language_detector.py +0 -308
- unrealon_llm/src/utils/models_cache.py +0 -592
- unrealon_llm/src/utils/smart_counter.py +0 -229
- unrealon_llm/src/utils/token_counter.py +0 -189
- unrealon_sdk/README.md +0 -25
- unrealon_sdk/__init__.py +0 -30
- unrealon_sdk/pyproject.toml +0 -231
- unrealon_sdk/src/__init__.py +0 -150
- unrealon_sdk/src/cli/__init__.py +0 -12
- unrealon_sdk/src/cli/commands/__init__.py +0 -22
- unrealon_sdk/src/cli/commands/benchmark.py +0 -42
- unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
- unrealon_sdk/src/cli/commands/health.py +0 -46
- unrealon_sdk/src/cli/commands/integration.py +0 -498
- unrealon_sdk/src/cli/commands/reports.py +0 -43
- unrealon_sdk/src/cli/commands/security.py +0 -36
- unrealon_sdk/src/cli/commands/server.py +0 -483
- unrealon_sdk/src/cli/commands/servers.py +0 -56
- unrealon_sdk/src/cli/commands/tests.py +0 -55
- unrealon_sdk/src/cli/main.py +0 -126
- unrealon_sdk/src/cli/utils/reporter.py +0 -519
- unrealon_sdk/src/clients/openapi.yaml +0 -3347
- unrealon_sdk/src/clients/python_http/__init__.py +0 -3
- unrealon_sdk/src/clients/python_http/api_config.py +0 -228
- unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
- unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
- unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
- unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
- unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
- unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
- unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
- unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
- unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
- unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
- unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
- unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
- unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
- unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
- unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
- unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
- unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
- unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
- unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
- unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
- unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
- unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
- unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
- unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
- unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
- unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
- unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
- unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
- unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
- unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
- unrealon_sdk/src/clients/python_websocket/client.py +0 -490
- unrealon_sdk/src/clients/python_websocket/events.py +0 -732
- unrealon_sdk/src/clients/python_websocket/example.py +0 -136
- unrealon_sdk/src/clients/python_websocket/types.py +0 -871
- unrealon_sdk/src/core/__init__.py +0 -64
- unrealon_sdk/src/core/client.py +0 -556
- unrealon_sdk/src/core/config.py +0 -465
- unrealon_sdk/src/core/exceptions.py +0 -239
- unrealon_sdk/src/core/metadata.py +0 -191
- unrealon_sdk/src/core/models.py +0 -142
- unrealon_sdk/src/core/types.py +0 -68
- unrealon_sdk/src/dto/__init__.py +0 -268
- unrealon_sdk/src/dto/authentication.py +0 -108
- unrealon_sdk/src/dto/cache.py +0 -208
- unrealon_sdk/src/dto/common.py +0 -19
- unrealon_sdk/src/dto/concurrency.py +0 -393
- unrealon_sdk/src/dto/events.py +0 -108
- unrealon_sdk/src/dto/health.py +0 -339
- unrealon_sdk/src/dto/load_balancing.py +0 -336
- unrealon_sdk/src/dto/logging.py +0 -230
- unrealon_sdk/src/dto/performance.py +0 -165
- unrealon_sdk/src/dto/rate_limiting.py +0 -295
- unrealon_sdk/src/dto/resource_pooling.py +0 -128
- unrealon_sdk/src/dto/structured_logging.py +0 -112
- unrealon_sdk/src/dto/task_scheduling.py +0 -121
- unrealon_sdk/src/dto/websocket.py +0 -55
- unrealon_sdk/src/enterprise/__init__.py +0 -59
- unrealon_sdk/src/enterprise/authentication.py +0 -401
- unrealon_sdk/src/enterprise/cache_manager.py +0 -578
- unrealon_sdk/src/enterprise/error_recovery.py +0 -494
- unrealon_sdk/src/enterprise/event_system.py +0 -549
- unrealon_sdk/src/enterprise/health_monitor.py +0 -747
- unrealon_sdk/src/enterprise/load_balancer.py +0 -964
- unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
- unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
- unrealon_sdk/src/enterprise/logging/development.py +0 -744
- unrealon_sdk/src/enterprise/logging/service.py +0 -410
- unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
- unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
- unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
- unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
- unrealon_sdk/src/enterprise/resource_pool.py +0 -763
- unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
- unrealon_sdk/src/internal/__init__.py +0 -10
- unrealon_sdk/src/internal/command_router.py +0 -497
- unrealon_sdk/src/internal/connection_manager.py +0 -397
- unrealon_sdk/src/internal/http_client.py +0 -446
- unrealon_sdk/src/internal/websocket_client.py +0 -420
- unrealon_sdk/src/provider.py +0 -471
- unrealon_sdk/src/utils.py +0 -234
- /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
- /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
- /unrealon_browser/{src/cli → cli}/main.py +0 -0
- /unrealon_browser/{src/core → core}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
- /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
- /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Resource Pooling DTOs - Data Transfer Objects for resource pool management.
|
|
3
|
-
|
|
4
|
-
This module contains all Pydantic models, enums, and dataclasses related to resource pooling,
|
|
5
|
-
separated from business logic for clean architecture and reusability.
|
|
6
|
-
|
|
7
|
-
Components:
|
|
8
|
-
- Resource lifecycle states and scaling strategies
|
|
9
|
-
- Pool configuration and resource metadata
|
|
10
|
-
- Resource management and monitoring models
|
|
11
|
-
- Performance tracking and metrics
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
from typing import Dict, Optional, Any
|
|
15
|
-
from datetime import datetime, timezone
|
|
16
|
-
from enum import Enum
|
|
17
|
-
from dataclasses import dataclass, field
|
|
18
|
-
|
|
19
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
20
|
-
|
|
21
|
-
# Import from existing concurrency DTOs
|
|
22
|
-
from .concurrency import ResourceType
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ResourceLifecycleState(str, Enum):
|
|
26
|
-
"""Resource lifecycle states."""
|
|
27
|
-
|
|
28
|
-
CREATING = "creating"
|
|
29
|
-
INITIALIZING = "initializing"
|
|
30
|
-
READY = "ready"
|
|
31
|
-
IN_USE = "in_use"
|
|
32
|
-
IDLE = "idle"
|
|
33
|
-
VALIDATING = "validating"
|
|
34
|
-
CLEANING = "cleaning"
|
|
35
|
-
DESTROYING = "destroying"
|
|
36
|
-
DESTROYED = "destroyed"
|
|
37
|
-
ERROR = "error"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class PoolScalingStrategy(str, Enum):
|
|
41
|
-
"""Pool scaling strategies."""
|
|
42
|
-
|
|
43
|
-
FIXED = "fixed" # Fixed pool size
|
|
44
|
-
DYNAMIC = "dynamic" # Dynamic scaling based on demand
|
|
45
|
-
PREDICTIVE = "predictive" # Predictive scaling based on patterns
|
|
46
|
-
AGGRESSIVE = "aggressive" # Aggressive scaling for high performance
|
|
47
|
-
CONSERVATIVE = "conservative" # Conservative scaling for stability
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@dataclass
|
|
51
|
-
class ResourceMetadata:
|
|
52
|
-
"""Resource metadata and tracking information."""
|
|
53
|
-
|
|
54
|
-
resource_id: str
|
|
55
|
-
resource_type: ResourceType
|
|
56
|
-
created_at: datetime
|
|
57
|
-
last_used: datetime
|
|
58
|
-
usage_count: int = 0
|
|
59
|
-
error_count: int = 0
|
|
60
|
-
last_error: Optional[str] = None
|
|
61
|
-
lifecycle_state: ResourceLifecycleState = ResourceLifecycleState.CREATING
|
|
62
|
-
tags: Dict[str, str] = field(default_factory=dict)
|
|
63
|
-
health_score: float = 1.0 # 0.0 = unhealthy, 1.0 = perfect health
|
|
64
|
-
performance_metrics: Dict[str, float] = field(default_factory=dict)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class PoolConfig(BaseModel):
|
|
68
|
-
"""Resource pool configuration model."""
|
|
69
|
-
|
|
70
|
-
model_config = ConfigDict(extra="forbid")
|
|
71
|
-
|
|
72
|
-
# Pool identification
|
|
73
|
-
pool_name: str = Field(..., description="Pool name")
|
|
74
|
-
resource_type: ResourceType = Field(..., description="Type of resources in pool")
|
|
75
|
-
|
|
76
|
-
# Size configuration
|
|
77
|
-
min_size: int = Field(default=1, description="Minimum pool size")
|
|
78
|
-
max_size: int = Field(default=10, description="Maximum pool size")
|
|
79
|
-
initial_size: int = Field(default=2, description="Initial pool size")
|
|
80
|
-
scaling_strategy: PoolScalingStrategy = Field(
|
|
81
|
-
default=PoolScalingStrategy.DYNAMIC, description="Scaling strategy"
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
# Scaling parameters
|
|
85
|
-
scale_up_threshold: float = Field(
|
|
86
|
-
default=0.8, description="Scale up when utilization > threshold"
|
|
87
|
-
)
|
|
88
|
-
scale_down_threshold: float = Field(
|
|
89
|
-
default=0.3, description="Scale down when utilization < threshold"
|
|
90
|
-
)
|
|
91
|
-
scale_factor: float = Field(default=1.5, description="Factor for scaling operations")
|
|
92
|
-
|
|
93
|
-
# Timeout settings
|
|
94
|
-
acquisition_timeout_seconds: float = Field(
|
|
95
|
-
default=30.0, description="Resource acquisition timeout"
|
|
96
|
-
)
|
|
97
|
-
idle_timeout_seconds: float = Field(default=300.0, description="Resource idle timeout")
|
|
98
|
-
max_lifetime_seconds: Optional[float] = Field(
|
|
99
|
-
default=None, description="Maximum resource lifetime"
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
# Health and validation
|
|
103
|
-
enable_health_checks: bool = Field(default=True, description="Enable health checks")
|
|
104
|
-
health_check_interval_seconds: float = Field(default=60.0, description="Health check interval")
|
|
105
|
-
validation_on_acquire: bool = Field(default=True, description="Validate on acquire")
|
|
106
|
-
validation_on_return: bool = Field(default=False, description="Validate on return")
|
|
107
|
-
|
|
108
|
-
# Performance features
|
|
109
|
-
enable_warmup: bool = Field(default=True, description="Enable pool warmup")
|
|
110
|
-
warmup_size: int = Field(default=2, description="Warmup pool size")
|
|
111
|
-
enable_preallocation: bool = Field(default=False, description="Enable resource preallocation")
|
|
112
|
-
|
|
113
|
-
# Monitoring and debugging
|
|
114
|
-
enable_leak_detection: bool = Field(default=True, description="Enable leak detection")
|
|
115
|
-
leak_detection_threshold_seconds: float = Field(
|
|
116
|
-
default=3600.0, description="Leak detection threshold"
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
__all__ = [
|
|
121
|
-
# Enums
|
|
122
|
-
"ResourceLifecycleState",
|
|
123
|
-
"PoolScalingStrategy",
|
|
124
|
-
# Data classes
|
|
125
|
-
"ResourceMetadata",
|
|
126
|
-
# Configuration models
|
|
127
|
-
"PoolConfig",
|
|
128
|
-
]
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Structured Logging Data Transfer Objects
|
|
3
|
-
|
|
4
|
-
DTO models for enterprise structured logging service functionality.
|
|
5
|
-
These models provide type-safe structured logging operations and configuration.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from datetime import datetime, timezone
|
|
9
|
-
from typing import Dict, List, Optional, Any, Callable
|
|
10
|
-
from enum import Enum
|
|
11
|
-
from dataclasses import dataclass, field
|
|
12
|
-
from collections import deque
|
|
13
|
-
import threading
|
|
14
|
-
import asyncio
|
|
15
|
-
|
|
16
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@dataclass
|
|
20
|
-
class LogBuffer:
|
|
21
|
-
"""Thread-safe buffer for batching log entries using auto-generated models."""
|
|
22
|
-
|
|
23
|
-
max_size: int = 100
|
|
24
|
-
flush_interval_seconds: float = 5.0
|
|
25
|
-
|
|
26
|
-
# Buffer storage (will hold LogEntryMessage objects)
|
|
27
|
-
entries: deque[Any] = field(default_factory=deque)
|
|
28
|
-
lock: threading.Lock = field(default_factory=threading.Lock)
|
|
29
|
-
|
|
30
|
-
# Flush callback
|
|
31
|
-
flush_callback: Optional[Any] = None
|
|
32
|
-
|
|
33
|
-
# Background task
|
|
34
|
-
_flush_task: Optional[asyncio.Task[None]] = None
|
|
35
|
-
_should_stop: bool = False
|
|
36
|
-
|
|
37
|
-
def add_entry(self, entry: Any) -> None:
|
|
38
|
-
"""Add entry to buffer, trigger flush if needed."""
|
|
39
|
-
with self.lock:
|
|
40
|
-
self.entries.append(entry)
|
|
41
|
-
|
|
42
|
-
# Auto-flush if buffer is full - use non-blocking approach
|
|
43
|
-
if len(self.entries) >= self.max_size:
|
|
44
|
-
# Schedule flush without blocking current context
|
|
45
|
-
try:
|
|
46
|
-
loop = asyncio.get_running_loop()
|
|
47
|
-
if loop and not loop.is_closed():
|
|
48
|
-
loop.call_soon_threadsafe(
|
|
49
|
-
lambda: asyncio.create_task(self._flush_now())
|
|
50
|
-
)
|
|
51
|
-
except RuntimeError:
|
|
52
|
-
# No event loop running - skip flush, will be handled by auto-flush
|
|
53
|
-
pass
|
|
54
|
-
|
|
55
|
-
async def start_auto_flush(self) -> None:
|
|
56
|
-
"""Start automatic flushing task."""
|
|
57
|
-
if self._flush_task is None:
|
|
58
|
-
self._flush_task = asyncio.create_task(self._auto_flush_loop())
|
|
59
|
-
|
|
60
|
-
async def stop_auto_flush(self) -> None:
|
|
61
|
-
"""Stop automatic flushing and flush remaining entries."""
|
|
62
|
-
self._should_stop = True
|
|
63
|
-
if self._flush_task:
|
|
64
|
-
self._flush_task.cancel()
|
|
65
|
-
try:
|
|
66
|
-
await self._flush_task
|
|
67
|
-
except asyncio.CancelledError:
|
|
68
|
-
pass
|
|
69
|
-
|
|
70
|
-
# Final flush
|
|
71
|
-
await self._flush_now()
|
|
72
|
-
|
|
73
|
-
async def _auto_flush_loop(self) -> None:
|
|
74
|
-
"""Background auto-flush loop."""
|
|
75
|
-
while not self._should_stop:
|
|
76
|
-
try:
|
|
77
|
-
await asyncio.sleep(self.flush_interval_seconds)
|
|
78
|
-
await self._flush_now()
|
|
79
|
-
except asyncio.CancelledError:
|
|
80
|
-
break
|
|
81
|
-
except Exception as e:
|
|
82
|
-
# Note: logger import needed in actual usage
|
|
83
|
-
print(f"Error in auto-flush loop: {e}")
|
|
84
|
-
|
|
85
|
-
async def _flush_now(self) -> None:
|
|
86
|
-
"""Flush current buffer contents."""
|
|
87
|
-
entries_to_flush = []
|
|
88
|
-
|
|
89
|
-
with self.lock:
|
|
90
|
-
if self.entries:
|
|
91
|
-
entries_to_flush = list(self.entries)
|
|
92
|
-
self.entries.clear()
|
|
93
|
-
|
|
94
|
-
if entries_to_flush and self.flush_callback:
|
|
95
|
-
try:
|
|
96
|
-
await self._call_flush_callback(entries_to_flush)
|
|
97
|
-
except Exception as e:
|
|
98
|
-
print(f"Error in flush callback: {e}")
|
|
99
|
-
|
|
100
|
-
async def _call_flush_callback(self, entries: List[Any]) -> None:
|
|
101
|
-
"""Call flush callback, handling both sync and async callbacks."""
|
|
102
|
-
if self.flush_callback is not None:
|
|
103
|
-
if asyncio.iscoroutinefunction(self.flush_callback):
|
|
104
|
-
await self.flush_callback(entries)
|
|
105
|
-
else:
|
|
106
|
-
self.flush_callback(entries)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
__all__ = [
|
|
110
|
-
# Buffer models
|
|
111
|
-
"LogBuffer",
|
|
112
|
-
]
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Task Scheduling DTOs - Data Transfer Objects for task scheduling system.
|
|
3
|
-
|
|
4
|
-
This module contains all Pydantic models, enums, and dataclasses related to task scheduling,
|
|
5
|
-
separated from business logic for clean architecture and reusability.
|
|
6
|
-
|
|
7
|
-
Components:
|
|
8
|
-
- Task scheduling types and strategies
|
|
9
|
-
- Schedule information and dependency management
|
|
10
|
-
- Task progress tracking and configuration
|
|
11
|
-
- Scheduler configuration and metrics
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
from typing import Optional, List, Dict, Any
|
|
15
|
-
from datetime import datetime, timezone, timedelta
|
|
16
|
-
from enum import Enum
|
|
17
|
-
from dataclasses import dataclass, field
|
|
18
|
-
|
|
19
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class ScheduleType(str, Enum):
|
|
23
|
-
"""Task scheduling types."""
|
|
24
|
-
|
|
25
|
-
IMMEDIATE = "immediate" # Execute immediately
|
|
26
|
-
DELAYED = "delayed" # Execute after delay
|
|
27
|
-
SCHEDULED = "scheduled" # Execute at specific time
|
|
28
|
-
RECURRING = "recurring" # Recurring execution
|
|
29
|
-
CRON = "cron" # Cron-style scheduling
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
class TaskSchedulerStrategy(str, Enum):
|
|
33
|
-
"""Task scheduling strategies."""
|
|
34
|
-
|
|
35
|
-
FIFO = "fifo" # First In First Out
|
|
36
|
-
PRIORITY = "priority" # Priority-based
|
|
37
|
-
DEADLINE = "deadline" # Deadline-based (Earliest Deadline First)
|
|
38
|
-
SHORTEST_JOB = "shortest_job" # Shortest Job First
|
|
39
|
-
FAIR_SHARE = "fair_share" # Fair share scheduling
|
|
40
|
-
ADAPTIVE = "adaptive" # Adaptive based on performance
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
@dataclass
|
|
44
|
-
class ScheduleInfo:
|
|
45
|
-
"""Task scheduling information."""
|
|
46
|
-
|
|
47
|
-
schedule_type: ScheduleType
|
|
48
|
-
scheduled_time: Optional[datetime] = None
|
|
49
|
-
delay_seconds: Optional[float] = None
|
|
50
|
-
cron_expression: Optional[str] = None
|
|
51
|
-
repeat_interval: Optional[timedelta] = None
|
|
52
|
-
max_executions: Optional[int] = None
|
|
53
|
-
execution_count: int = 0
|
|
54
|
-
last_execution: Optional[datetime] = None
|
|
55
|
-
next_execution: Optional[datetime] = None
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
@dataclass
|
|
59
|
-
class TaskDependency:
|
|
60
|
-
"""Task dependency relationship."""
|
|
61
|
-
|
|
62
|
-
task_id: str
|
|
63
|
-
depends_on: str
|
|
64
|
-
dependency_type: str = "completion" # completion, data, resource
|
|
65
|
-
optional: bool = False
|
|
66
|
-
timeout_seconds: Optional[float] = None
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@dataclass
|
|
70
|
-
class TaskProgress:
|
|
71
|
-
"""Task execution progress tracking."""
|
|
72
|
-
|
|
73
|
-
task_id: str
|
|
74
|
-
current_step: int = 0
|
|
75
|
-
total_steps: int = 1
|
|
76
|
-
progress_percent: float = 0.0
|
|
77
|
-
status_message: str = ""
|
|
78
|
-
started_at: Optional[datetime] = None
|
|
79
|
-
estimated_completion: Optional[datetime] = None
|
|
80
|
-
last_update: datetime = field(default_factory=lambda: datetime.now(timezone.utc))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class TaskSchedulerConfig(BaseModel):
|
|
84
|
-
"""Task scheduler configuration model."""
|
|
85
|
-
|
|
86
|
-
model_config = ConfigDict(extra="forbid")
|
|
87
|
-
|
|
88
|
-
# Core settings
|
|
89
|
-
max_concurrent_tasks: int = Field(default=100, description="Maximum concurrent tasks")
|
|
90
|
-
default_timeout_seconds: float = Field(default=300.0, description="Default task timeout")
|
|
91
|
-
max_retries: int = Field(default=3, description="Maximum retry attempts")
|
|
92
|
-
retry_backoff_factor: float = Field(default=2.0, description="Retry backoff multiplier")
|
|
93
|
-
|
|
94
|
-
# Dead letter queue
|
|
95
|
-
enable_dead_letter_queue: bool = Field(default=True, description="Enable dead letter queue")
|
|
96
|
-
dead_letter_max_size: int = Field(default=1000, description="Dead letter queue max size")
|
|
97
|
-
|
|
98
|
-
# Scheduling
|
|
99
|
-
schedule_resolution_seconds: float = Field(default=1.0, description="Schedule resolution")
|
|
100
|
-
dependency_timeout_seconds: float = Field(default=3600.0, description="Dependency timeout")
|
|
101
|
-
strategy: TaskSchedulerStrategy = Field(
|
|
102
|
-
default=TaskSchedulerStrategy.PRIORITY, description="Scheduling strategy"
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
# Persistence and caching
|
|
106
|
-
enable_task_persistence: bool = Field(default=False, description="Enable task persistence")
|
|
107
|
-
enable_result_caching: bool = Field(default=True, description="Enable result caching")
|
|
108
|
-
cache_ttl_seconds: float = Field(default=3600.0, description="Cache TTL in seconds")
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
__all__ = [
|
|
112
|
-
# Enums
|
|
113
|
-
"ScheduleType",
|
|
114
|
-
"TaskSchedulerStrategy",
|
|
115
|
-
# Data classes
|
|
116
|
-
"ScheduleInfo",
|
|
117
|
-
"TaskDependency",
|
|
118
|
-
"TaskProgress",
|
|
119
|
-
# Configuration models
|
|
120
|
-
"TaskSchedulerConfig",
|
|
121
|
-
]
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
WebSocket-related Data Transfer Objects
|
|
3
|
-
|
|
4
|
-
Custom DTO models for WebSocket connection management and state tracking.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from datetime import datetime
|
|
8
|
-
from typing import Optional
|
|
9
|
-
from enum import Enum
|
|
10
|
-
|
|
11
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class WebSocketConnectionState(str, Enum):
|
|
15
|
-
"""
|
|
16
|
-
WebSocket connection state constants.
|
|
17
|
-
|
|
18
|
-
Compatible with WebSocket client events and internal state management.
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
|
-
DISCONNECTED = "disconnected"
|
|
22
|
-
CONNECTING = "connecting"
|
|
23
|
-
CONNECTED = "connected"
|
|
24
|
-
RECONNECTING = "reconnecting"
|
|
25
|
-
ERROR = "error"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class WebSocketStateInfo(BaseModel):
|
|
29
|
-
"""
|
|
30
|
-
Type-safe WebSocket connection state model.
|
|
31
|
-
|
|
32
|
-
Replaces Dict[str, str] usage to comply with CRITICAL_REQUIREMENTS.md.
|
|
33
|
-
Provides structured state information for WebSocket connections.
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
model_config = ConfigDict(validate_assignment=True, extra="forbid")
|
|
37
|
-
|
|
38
|
-
# Core connection state
|
|
39
|
-
status: WebSocketConnectionState = Field(..., description="Connection status")
|
|
40
|
-
session_id: Optional[str] = Field(None, description="Session identifier")
|
|
41
|
-
last_ping: Optional[str] = Field(None, description="Last ping timestamp")
|
|
42
|
-
connection_time: Optional[str] = Field(None, description="Connection establishment time")
|
|
43
|
-
|
|
44
|
-
# Additional state fields
|
|
45
|
-
connected: bool = Field(default=False, description="Connection established")
|
|
46
|
-
connecting: bool = Field(default=False, description="Connection in progress")
|
|
47
|
-
error: Optional[str] = Field(None, description="Last error message")
|
|
48
|
-
last_connected: Optional[str] = Field(None, description="Last successful connection time")
|
|
49
|
-
reconnect_count: int = Field(default=0, description="Number of reconnection attempts")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
__all__ = [
|
|
53
|
-
"WebSocketConnectionState",
|
|
54
|
-
"WebSocketStateInfo",
|
|
55
|
-
]
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
UnrealOn SDK Enterprise Services
|
|
3
|
-
|
|
4
|
-
Layer 3: Infrastructure Services - Core enterprise-grade components
|
|
5
|
-
providing intelligent proxy management, structured logging, performance
|
|
6
|
-
monitoring, and error recovery capabilities.
|
|
7
|
-
|
|
8
|
-
Enterprise Features:
|
|
9
|
-
- Intelligent proxy rotation with geographic awareness
|
|
10
|
-
- Real-time structured logging via WebSocket
|
|
11
|
-
- Performance metrics collection and analysis
|
|
12
|
-
- Automatic error recovery and circuit breakers
|
|
13
|
-
- Health monitoring and alerting
|
|
14
|
-
- Intelligent caching with TTL management
|
|
15
|
-
|
|
16
|
-
Quick Start:
|
|
17
|
-
```python
|
|
18
|
-
from unrealon_sdk import AdapterClient, AdapterConfig
|
|
19
|
-
from unrealon_sdk.src.enterprise import ProxyManager, LoggingService, MonitoringManager
|
|
20
|
-
|
|
21
|
-
config = AdapterConfig(api_key="up_dev_your_api_key")
|
|
22
|
-
adapter = AdapterClient(config)
|
|
23
|
-
|
|
24
|
-
# Enterprise services are automatically initialized
|
|
25
|
-
# Just use the adapter client normally!
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
These services power the enterprise-grade capabilities of the UnrealOn SDK.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
from .proxy_manager import ProxyManager
|
|
32
|
-
from .logging.service import LoggingService
|
|
33
|
-
from .logging.development import (
|
|
34
|
-
DevelopmentLogger,
|
|
35
|
-
initialize_development_logger,
|
|
36
|
-
get_development_logger,
|
|
37
|
-
track_development_operation,
|
|
38
|
-
SDKEventType,
|
|
39
|
-
SDKSeverity,
|
|
40
|
-
SDKContext,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# These will be implemented next
|
|
44
|
-
# from .monitoring_manager import MonitoringManager
|
|
45
|
-
# from .error_recovery import ErrorRecoveryManager
|
|
46
|
-
|
|
47
|
-
__all__ = [
|
|
48
|
-
"ProxyManager",
|
|
49
|
-
"LoggingService",
|
|
50
|
-
"DevelopmentLogger",
|
|
51
|
-
"initialize_development_logger",
|
|
52
|
-
"get_development_logger",
|
|
53
|
-
"track_development_operation",
|
|
54
|
-
"SDKEventType",
|
|
55
|
-
"SDKSeverity",
|
|
56
|
-
"SDKContext",
|
|
57
|
-
# "MonitoringManager",
|
|
58
|
-
# "ErrorRecoveryManager",
|
|
59
|
-
]
|