geo-mlops-sdk 0.2.0 의 공개 API 입니다. 패키지의 시그니처와 docstring(영어 원문)에서 자동으로 만들었습니다. 사용법은 Edge SDK 장을 먼저 보세요.

CentralClient: 중앙 서버 클라이언트

장비 토큰으로 중앙 서버의 엣지 API(/api/v1/edge)를 부르는 비동기 클라이언트입니다. async with 로 쓰거나 끝날 때 aclose() 를 부릅니다.

CentralClient(base_url: str, token: str = '', *, timeout: float = 10.0, retry: RetryPolicy = RetryPolicy(attempts=3, initial_backoff_s=0.5, max_backoff_s=30.0, multiplier=2.0, jitter=0.25), verify: bool = True, transport: Optional[httpx.AsyncBaseTransport] = None, user_agent: Optional[str] = None) -> None

HTTP client bound to one Central deployment and one device token.

set_token

def set_token(token: str) -> None

Adopt a rotated token without rebuilding the connection pool.

aclose

async def aclose() -> None

health

async def health() -> dict

Liveness probe. Never retried: the caller is the retry loop.

register

async def register(*, os: Optional[str] = None, sdk_version: Optional[str] = None, location: Optional[str] = None) -> RegisterResult

Self-register this device (IF-E1).

send_heartbeat

async def send_heartbeat(body: HeartbeatBody, *, retry: Optional[RetryPolicy] = None) -> HeartbeatResult

Report resources and runtime status (IF-E2).

list_models

async def list_models() -> ModelListResult

Models this device's tenant has registered (IF-E6).

model_versions

async def model_versions(name: str) -> ModelVersionsResult

Version history of one model (IF-E6).

resolve_container

async def resolve_container(model: str, version: str) -> ContainerRef

Registry reference for a model version's serving image (IF-E5).

send_records

async def send_records(records: Sequence[Record]) -> BatchResult

Hand over a telemetry batch (IF-E3).

send_inference

async def send_inference(records: Sequence[InferenceRecord]) -> BatchResult

Hand over an inference-result batch (IF-E4). Same idempotency rule.

upload_init

async def upload_init(request: UploadInit) -> UploadCreated

Open a resumable transfer.

upload_chunk

async def upload_chunk(upload_id: str, index: int, data: bytes) -> ChunkAccepted

Send one chunk. Re-sending an index already stored is a no-op.

upload_status

async def upload_status(upload_id: str) -> UploadStatus

Where a restarted transfer should pick up.

upload_complete

async def upload_complete(upload_id: str) -> UploadStatus

Close the transfer. Assembly happens server-side, so poll the status.

poll_commands

async def poll_commands(wait_s: float = 25.0) -> CommandList

Long poll for commands.

ack_command

async def ack_command(command_id: str, ack: CommandAck) -> CommandAckResult

Report what happened to one command.

fetch_policy

async def fetch_policy() -> DevicePolicy

Retrieve the policy in force for this device.

download_model

async def download_model(name: str, version: str, dest: Union[str, Path], *, progress: Optional[ProgressCallback] = None, retry: Optional[RetryPolicy] = None) -> Path

Stream a model version's artifact to dest (IF-E6).

오류

모든 오류는 SdkError 를 상속합니다. 재시도 대상은 429·5xx·전송 오류뿐입니다.

예외부모설명
SdkErrorExceptionBase class for every error raised by this package.
OfflineErrorSdkErrorThe request never got an answer (DNS, refused, reset, timeout).
ApiErrorSdkErrorCentral answered with a non-2xx status.
AuthErrorApiError401: the device token is unknown, expired or revoked.
ForbiddenErrorApiError403: the token is valid but lacks the scope for this call.
NotFoundErrorApiError404.
ConflictErrorApiError409: e.g. completing an upload whose chunks are not all in.
PayloadTooLargeErrorApiError413: the body exceeds a server or proxy ceiling. Retrying cannot help.
UnprocessableErrorApiError422: the body did not validate.
RateLimitedErrorApiError429: back off, honouring Retry-After when present.
ServerErrorApiError5xx: Central's problem, and worth retrying.

재시도 정책

RetryPolicy(attempts: int = 3, initial_backoff_s: float = 0.5, max_backoff_s: float = 30.0, multiplier: float = 2.0, jitter: float = 0.25) -> None

Exponential backoff with jitter.

계약 모델 (요청·응답)

중앙 서버와 주고받는 Pydantic 모델입니다. 모르는 필드는 무시하므로 서버가 필드를 더해도 깨지지 않습니다.

Record

One structured observation.

필드형식기본값설명
idstr(필수)
kindstr(필수)
tsdatetime(필수)
priorityint50
payloaddict[str, Any]{}

RecordBatch

Request body of POST /api/v1/edge/telemetry.

필드형식기본값설명
recordslist[Record][]

RejectedRecord

One record Central refused, with the reason it refused it.

필드형식기본값설명
idstr(필수)
reasonstr(필수)

BatchResult

Response to a telemetry or inference batch.

필드형식기본값설명
acceptedint0
duplicatesint0
rejectedlist[RejectedRecord][]

UploadInit

Request body of POST /api/v1/edge/uploads.

필드형식기본값설명
filenamestr(필수)
sizeint(필수)
sha256str(필수)
chunk_sizeint(필수)
kindstrblob
dataset_idstr | NoneNone
metadict[str, Any]{}

UploadCreated

Response to upload init.

필드형식기본값설명
upload_idstr(필수)
chunk_sizeint(필수)
receivedlist[int][]

ChunkAccepted

Response to a chunk PUT: the indices the server now holds.

필드형식기본값설명
receivedlist[int][]

UploadStatus

Response to GET /api/v1/edge/uploads/{id}: the resume point.

필드형식기본값설명
upload_idstr(필수)
stateUploadStateuploading
receivedlist[int][]
sizeint0
chunk_sizeint0
storage_uristr | NoneNone
errorstr | NoneNone

Detection

One detected instance.

필드형식기본값설명
clsint(필수)
namestr""
conffloat0.0
bboxlist[float][]
polygonlist[list[float]][]

InferenceOutput

Result of one predict call.

필드형식기본값설명
taskstr""
widthint0
heightint0
detectionslist[Detection][]

ModelRef

Registry coordinates of the model that produced a result.

필드형식기본값설명
namestr(필수)
versionstr(필수)

InferenceRecord

One inference result queued for Central (IF-E4).

필드형식기본값설명
idstr(필수)
tsdatetime(필수)
modelModelRef(필수)
input_refstr | NoneNone
outputdict[str, Any]{}
latency_msfloat0.0
priorityint50

InferenceBatch

Request body of POST /api/v1/edge/inference.

필드형식기본값설명
recordslist[InferenceRecord][]

RegisterRequest

Request body of POST /api/v1/edge/register (IF-E1).

필드형식기본값설명
osstr(필수)
sdk_versionstr(필수)
locationstr | NoneNone

RegisterResult

Response to registration.

필드형식기본값설명
idstr(필수)
statusstrACTIVE

BacklogStatus

What is waiting in the local queue.

필드형식기본값설명
countint0
bytesint0
oldest_tsdatetime | NoneNone
evicted_24hint0
by_kinddict[str, int]{}

SyncStatus

Uploader state as reported to the fleet.

필드형식기본값설명
stateSyncStateidle
last_ok_atdatetime | NoneNone
last_errorstr | NoneNone
rate_bpsfloat0.0
in_flightint0
deniedstr | NoneNone

ModelStatus

One model present in the local cache.

필드형식기본값설명
namestr(필수)
versionstr(필수)
frameworkstr""
activeboolFalse

CollectorStatus

One configured collector.

필드형식기본값설명
namestr(필수)
typestr""
statestrstopped
last_tsdatetime | NoneNone
errorstr | NoneNone

ContainerStatus

A container the edge reports running (populated by the host app).

필드형식기본값설명
imagestr(필수)
versionstr | NoneNone
healthstr | NoneNone

HeartbeatPayload

Free-form half of the heartbeat, given a shape by this SDK.

필드형식기본값설명
agent_versionstr""
osstr""
uptime_sfloat0.0
policy_revisionint0
backlogBacklogStatus
syncSyncStatus
modelslist[ModelStatus][]
collectorslist[CollectorStatus][]
containerslist[ContainerStatus] | NoneNone

HeartbeatBody

Request body of POST /api/v1/edge/heartbeat (IF-E2).

필드형식기본값설명
cpufloat0.0
gpufloat | NoneNone
memfloat0.0
diskfloat0.0
payloadHeartbeatPayload

HeartbeatResult

Response to a heartbeat.

필드형식기본값설명
okboolTrue
policy_revisionint0

RetentionPolicy

Local storage ceiling. Whichever bound trips first wins.

필드형식기본값설명
max_bytesint53687091200
max_age_daysint30
free_disk_min_bytesint5368709120

SyncPolicy

How aggressively the uploader may work.

필드형식기본값설명
batch_sizeint500
chunk_bytesint33554432
max_bytes_per_sint0
cpu_pause_percentfloat85.0
windowslist[str][]
concurrencyint1
urgent_priorityint90

DevicePolicy

Response to GET /api/v1/edge/config.

필드형식기본값설명
revisionint0
heartbeat_interval_sfloat30.0
commands_poll_sfloat25.0
retentionRetentionPolicy
syncSyncPolicy

Command

One queued command.

필드형식기본값설명
idstr(필수)
typestr(필수)
argsdict[str, Any]{}
created_atdatetime | NoneNone

CommandList

Response to GET /api/v1/edge/commands (empty when the wait elapsed).

필드형식기본값설명
itemslist[Command][]

CommandAck

Request body of POST /api/v1/edge/commands/{id}:ack.

필드형식기본값설명
statusAckStatusok
resultdict[str, Any] | NoneNone

CommandAckResult

Response to an ack.

필드형식기본값설명
idstr(필수)
statestr""

ModelInfo

One registered model.

필드형식기본값설명
namestr(필수)
stagesdict[str, str]{}
tagsdict[str, str]{}

ModelListResult

Response to GET /api/v1/edge/models.

필드형식기본값설명
itemslist[ModelInfo][]
availableboolFalse

ModelVersionInfo

One version of a model.

필드형식기본값설명
versionstr(필수)
stagestr""
statusstr""
run_idstr""
creation_timestampint0

ModelVersionsResult

Response to GET /api/v1/edge/models/{name}/versions.

필드형식기본값설명
namestr(필수)
versionslist[ModelVersionInfo][]

ContainerRef

Response to GET /api/v1/edge/containers/pull (IF-E5).

필드형식기본값설명
imagestr(필수)
modelstr""
versionstr""

EdgeSettings: 에이전트 설정

설정 파일(YAML)의 구조입니다. 우선순위는 환경 변수 > 설정 파일 > 기본값이고, 환경 변수는 GEO_EDGE_ 접두사에 단계를 __ 로 잇습니다. 예: central.tokenGEO_EDGE_CENTRAL__TOKEN.

EdgeSettings

필드형식기본값설명환경 변수
centralCentralSettingsGEO_EDGE_CENTRAL
deviceDeviceSettingsGEO_EDGE_DEVICE
data_dirPathPosixPath('/var/lib/geo-mlops-edge')GEO_EDGE_DATA_DIR
disk_pathstr""GEO_EDGE_DISK_PATH
retentionSizedRetentionPolicyGEO_EDGE_RETENTION
syncSizedSyncPolicyGEO_EDGE_SYNC
linkLinkSettingsGEO_EDGE_LINK
heartbeat_interval_sfloat30.0GEO_EDGE_HEARTBEAT_INTERVAL_S
commands_poll_sfloat25.0GEO_EDGE_COMMANDS_POLL_S
apiApiSettingsGEO_EDGE_API
collectorslist[CollectorSettings][]GEO_EDGE_COLLECTORS
modelsModelSettingsGEO_EDGE_MODELS
policy_sourcestrcentralGEO_EDGE_POLICY_SOURCE
log_levelstrINFOGEO_EDGE_LOG_LEVEL

central (CentralSettings)

How to reach the platform.

필드형식기본값설명환경 변수
base_urlstr""GEO_EDGE_CENTRAL__BASE_URL
tokenstr""GEO_EDGE_CENTRAL__TOKEN
timeout_sfloat10.0GEO_EDGE_CENTRAL__TIMEOUT_S
verify_tlsboolTrueGEO_EDGE_CENTRAL__VERIFY_TLS

device (DeviceSettings)

Identity overrides. Empty id means "use the hostname".

필드형식기본값설명환경 변수
idstr""GEO_EDGE_DEVICE__ID
locationOptional[str]NoneGEO_EDGE_DEVICE__LOCATION

retention (SizedRetentionPolicy)

Retention with human-readable sizes accepted from YAML.

필드형식기본값설명환경 변수
max_bytesint53687091200GEO_EDGE_RETENTION__MAX_BYTES
max_age_daysint30GEO_EDGE_RETENTION__MAX_AGE_DAYS
free_disk_min_bytesint5368709120GEO_EDGE_RETENTION__FREE_DISK_MIN_BYTES

sync (SizedSyncPolicy)

Sync policy with human-readable sizes accepted from YAML.

필드형식기본값설명환경 변수
batch_sizeint500GEO_EDGE_SYNC__BATCH_SIZE
chunk_bytesint33554432GEO_EDGE_SYNC__CHUNK_BYTES
max_bytes_per_sint0GEO_EDGE_SYNC__MAX_BYTES_PER_S
cpu_pause_percentfloat85.0GEO_EDGE_SYNC__CPU_PAUSE_PERCENT
windowslist[str][]GEO_EDGE_SYNC__WINDOWS
concurrencyint1GEO_EDGE_SYNC__CONCURRENCY
urgent_priorityint90GEO_EDGE_SYNC__URGENT_PRIORITY

Connectivity probing.

필드형식기본값설명환경 변수
probe_interval_sfloat5.0GEO_EDGE_LINK__PROBE_INTERVAL_S
backoff_max_sfloat60.0GEO_EDGE_LINK__BACKOFF_MAX_S
online_after_okint2GEO_EDGE_LINK__ONLINE_AFTER_OK
offline_after_failint3GEO_EDGE_LINK__OFFLINE_AFTER_FAIL

api (ApiSettings)

Local HTTP surface for the on-site UI.

필드형식기본값설명환경 변수
enabledboolTrueGEO_EDGE_API__ENABLED
hoststr0.0.0.0GEO_EDGE_API__HOST
portint8600GEO_EDGE_API__PORT
tokenstr""GEO_EDGE_API__TOKEN
cors_originslist[str]['*']GEO_EDGE_API__CORS_ORIGINS
max_body_bytesint2147483648GEO_EDGE_API__MAX_BODY_BYTES

collectors (CollectorSettings)

One configured collector. Type-specific keys stay in options.

필드형식기본값설명환경 변수
typestr(필수)GEO_EDGE_COLLECTORS__TYPE
namestr""GEO_EDGE_COLLECTORS__NAME
enabledboolTrueGEO_EDGE_COLLECTORS__ENABLED
priorityint50GEO_EDGE_COLLECTORS__PRIORITY
optionsdict[str, Any]{}GEO_EDGE_COLLECTORS__OPTIONS

models (ModelSettings)

Local model cache behaviour.

필드형식기본값설명환경 변수
auto_activatestrProductionGEO_EDGE_MODELS__AUTO_ACTIVATE
keep_versionsint2GEO_EDGE_MODELS__KEEP_VERSIONS

확장 지점

직접 만든 수집기·추론 러너를 등록할 때 쓰는 프로토콜과 함수입니다.

Sink

What a collector is handed to publish through.

async def record(kind: str, payload: dict, *, priority: int = 50, ts: Optional[datetime] = None, meta: Optional[dict] = None, record_id: str = '') -> Any
async def blob(kind: str, source: Union[str, Path, bytes], *, filename: str = '', priority: int = 50, ts: Optional[datetime] = None, meta: Optional[dict] = None, move: bool = False) -> Any

Collector

A source of data attached to this edge.

async def start(sink: Sink) -> None
async def stop() -> None
def status() -> CollectorStatus

register_collector

def register_collector(type_: str, factory: CollectorFactory) -> None

Make type_ usable in configuration.

build_collector

def build_collector(type_: str, name: str, *, priority: int = 50, options: Optional[dict] = None) -> Collector

Instantiate one configured collector.

Runner

Loads one model and answers predictions for it.

def load(model: LocalModel) -> None
def predict(image: bytes, **params) -> InferenceOutput
def close() -> None

register_runner

def register_runner(framework: str, factory: Callable[[], Runner]) -> None

Teach the SDK about a framework it does not ship support for.

2026-09-21 기준 플랫폼에 맞춰 작성했습니다.

© Geo-MLOps