mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 00:50:46 +08:00
Fix missing imports after UME router split.
Restore sqlalchemy.func and runtime helpers so alarms_current upsert and pause/resume no longer raise NameError 500s. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
6eeaa457b8
commit
e356dffc86
6 changed files with 18 additions and 42 deletions
|
|
@ -9,6 +9,7 @@ import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from sqlalchemy import func
|
||||||
from sqlalchemy.dialects.postgresql import insert as pg_insert
|
from sqlalchemy.dialects.postgresql import insert as pg_insert
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@ from .ume_support import (
|
||||||
_aggregate_rows,
|
_aggregate_rows,
|
||||||
_ensure_utc,
|
_ensure_utc,
|
||||||
_list_runtime_tasks,
|
_list_runtime_tasks,
|
||||||
|
_normalize_netx_lang,
|
||||||
|
_parse_time,
|
||||||
|
_protocol_bucket_label,
|
||||||
_request_force_sync_after_resume,
|
_request_force_sync_after_resume,
|
||||||
_runtime_pause_task,
|
_runtime_pause_task,
|
||||||
_runtime_resume_task,
|
_runtime_resume_task,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from datetime import datetime, timezone
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import func, or_
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from .config import settings
|
from .config import settings
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from datetime import datetime, timezone
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import func, or_
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from .config import settings
|
from .config import settings
|
||||||
|
|
|
||||||
|
|
@ -1,69 +1,40 @@
|
||||||
"""UME sync jobs and runtime pause/resume."""
|
"""UME sync jobs and runtime pause/resume."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||||
from sqlalchemy import or_
|
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from .config import settings
|
|
||||||
from .db import get_db
|
from .db import get_db
|
||||||
from .key_alert_config import (
|
from .models import UmeSyncJob
|
||||||
get_key_alert_monitor_config,
|
from .oclaw_alarm_forwarder import request_forwarder_reconnect
|
||||||
invalidate_key_alert_config_cache,
|
from .runtime_task_messages import (
|
||||||
set_key_alert_monitor_config,
|
RT_RESUMED,
|
||||||
)
|
RT_RESUMED_OCLAW_WSS_RECONNECT,
|
||||||
from .key_alert_matcher import (
|
RT_RESUMED_SYNC_SOON,
|
||||||
invalidate_key_alert_rule_cache,
|
RT_RESUMED_WSS_RECONNECT,
|
||||||
normalize_match_type,
|
|
||||||
parse_rule_ne_types_payload,
|
|
||||||
rule_match_type,
|
|
||||||
rule_match_value,
|
|
||||||
rule_ne_types,
|
|
||||||
rule_storage_key,
|
|
||||||
serialize_rule_ne_types,
|
|
||||||
)
|
|
||||||
from .models import (
|
|
||||||
UmeAlarmCurrent,
|
|
||||||
UmeAlarmHistory,
|
|
||||||
UmeInventoryNE,
|
|
||||||
UmeKeyAlertForwardLog,
|
|
||||||
UmeKeyAlertRule,
|
|
||||||
UmeSyncJob,
|
|
||||||
)
|
|
||||||
from .oclaw_alarm_forwarder import (
|
|
||||||
forwarder_status,
|
|
||||||
request_forwarder_reconnect,
|
|
||||||
)
|
)
|
||||||
from .ume_alarm_ws import (
|
from .ume_alarm_ws import (
|
||||||
cancel_alarm_subscription_manual,
|
|
||||||
clear_local_alarm_subscription_manual,
|
|
||||||
establish_alarm_subscription_manual,
|
|
||||||
get_alarms_coordination_status,
|
|
||||||
get_subscription_status,
|
get_subscription_status,
|
||||||
get_ws_connection_status,
|
is_wss_active_for_current_alarms,
|
||||||
get_ws_logs,
|
|
||||||
request_ws_reconnect,
|
request_ws_reconnect,
|
||||||
)
|
)
|
||||||
from .ume_support import (
|
from .ume_support import (
|
||||||
UME_KNOWN_RUNTIME_TASKS,
|
UME_KNOWN_RUNTIME_TASKS,
|
||||||
_aggregate_rows,
|
_clear_force_resume_hints,
|
||||||
_ensure_utc,
|
_ensure_utc,
|
||||||
_list_runtime_tasks,
|
_list_runtime_tasks,
|
||||||
_request_force_sync_after_resume,
|
_request_force_sync_after_resume,
|
||||||
_runtime_pause_task,
|
_runtime_pause_task,
|
||||||
_runtime_resume_task,
|
_runtime_resume_task,
|
||||||
_ume_alarm_host_name,
|
_set_runtime_task,
|
||||||
_ume_alarm_ne_group_key,
|
|
||||||
_ume_client,
|
_ume_client,
|
||||||
_ume_error_kind,
|
|
||||||
_clear_force_resume_hints,
|
|
||||||
)
|
)
|
||||||
from .ume_sync_service import sync_alarms_current, sync_alarms_history_full, sync_inventory_full
|
from .ume_sync_service import sync_alarms_current, sync_alarms_history_full, sync_inventory_full
|
||||||
from .ume_token_store import clear_shared_token
|
|
||||||
|
|
||||||
_log = logging.getLogger("netx.ume.router")
|
_log = logging.getLogger("netx.ume.router")
|
||||||
router = APIRouter(tags=["ume"])
|
router = APIRouter(tags=["ume"])
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ from .ume_alarm_ws import (
|
||||||
)
|
)
|
||||||
from .ume_support import (
|
from .ume_support import (
|
||||||
UME_KNOWN_RUNTIME_TASKS,
|
UME_KNOWN_RUNTIME_TASKS,
|
||||||
|
_UME_RUNTIME_TASKS,
|
||||||
_aggregate_rows,
|
_aggregate_rows,
|
||||||
_ensure_utc,
|
_ensure_utc,
|
||||||
_list_runtime_tasks,
|
_list_runtime_tasks,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue