ExAtlas.Providers.RunPod.Translate (ExAtlas v0.5.0)

Copy Markdown View Source

Translation layer between ExAtlas normalized specs and RunPod's native REST payloads.

All functions are pure. Keeping translation in one place means changes to RunPod's schema never leak into the ExAtlas.Providers.RunPod facade or the ExAtlas.Spec.* structs.

Summary

Functions

Turn a ComputeRequest into a body ready for POST /pods.

Turn a JobRequest into a RunPod runsync/run body.

Turn a RunPod job response into an ExAtlas.Spec.Job.

Turn RunPod's pod response body into an ExAtlas.Spec.Compute.

Functions

compute_request_to_pod_create(req)

@spec compute_request_to_pod_create(ExAtlas.Spec.ComputeRequest.t()) ::
  {map(), map() | nil}

Turn a ComputeRequest into a body ready for POST /pods.

When request.auth == :bearer, also mints a token and returns it so the caller can thread it into the resulting Compute struct.

Returns {body, auth_handle_or_nil}.

job_request_to_body(req)

@spec job_request_to_body(ExAtlas.Spec.JobRequest.t()) :: map()

Turn a JobRequest into a RunPod runsync/run body.

job_response_to_job(body, endpoint \\ nil)

@spec job_response_to_job(map(), String.t() | nil) :: ExAtlas.Spec.Job.t()

Turn a RunPod job response into an ExAtlas.Spec.Job.

pod_to_compute(pod, auth \\ nil)

@spec pod_to_compute(map(), map() | nil) :: ExAtlas.Spec.Compute.t()

Turn RunPod's pod response body into an ExAtlas.Spec.Compute.

Optional auth is threaded through unchanged from the spawn path.