Vastai-ConnectHub/app/jobs/base.py

22 lines
517 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any
class BaseJob(ABC):
"""
插件 Job 基类:框架层只负责加载与调度。
- params: 来自 Job.public_cfg明文 JSON
- secrets: 来自 Job.secret_cfg 解密后的明文 dict仅在内存中存在
"""
job_id: str | None = None
@abstractmethod
def run(self, params: dict[str, Any], secrets: dict[str, Any]) -> dict[str, Any] | None:
raise NotImplementedError