use std::path::PathBuf;
mod bootstrap;
mod catalog;
mod client;
mod flow;
mod keys;
mod orphans;
mod provision;
mod record;
mod status;
mod target;
mod types;
pub use bootstrap::{
HOST_KEY_ENV, JOB_ENV, PodSettings, bootstrap_functions, pod_command, pod_env, watchdog_script,
};
pub use catalog::{
DataCenterStock, GpuFilter, by_price, data_center_stock, data_center_table, gpu_table,
printable, resolve, select_gpus, stocked_data_centers, template_table, volume_table,
};
pub use client::{ApiError, RunpodClient, USER_AGENT};
pub use flow::{
DEADLINE_MARGIN, Ending, RETRIEVED_MARKER, WATCHDOG_LOG, Watched, end_pod, follow,
forget_client_key, job_started, reconnect, settle_watch, ssh_command, start_pod, watch_on_pod,
};
pub use keys::{
CLIENT_KEY, KNOWN_HOSTS, PodKeys, SSH_CONFIG, SSH_DIR, alias, base64, ssh_config, write_config,
write_known_hosts,
};
pub use orphans::{
PodRow, Removal, Removed, RowKind, listed_rows, orphan_warnings, pod_rows, remove_run_pods,
table,
};
pub use provision::{
PodCtx, PodPlan, Provisioned, Timing, chain, provision, remove, resolve_target, sweep,
};
pub use record::{
Attempt, AttemptResult, DeletedBy, POD_FILE, POD_RECORD_VERSION, PodRecord, PodState,
SshEndpoint, hours,
};
pub use status::{DeleteReason, PodStatus};
pub use target::{MIN_CUDA_VERSION, RunpodTarget, VOLUME_MOUNT, VOLUME_WORKDIR, WORKDIR};
pub use types::{
Availability, CreateEnv, CreatePod, CudaVersion, DataCenter, DataCenterList, GpuMaxCount,
GpuPrice, GpuRequest, GpuType, GpuTypeList, InvalidPodId, Mounts, NetworkMount, NetworkVolume,
NetworkVolumeList, Pagination, Pod, PodEnv, PodGpu, PodId, PodPage, PodSsh, RemoteStatus,
SshDirect, Stock, Template, TemplatePage,
};
#[derive(Debug, thiserror::Error)]
pub enum PodError {
#[error(transparent)]
Api(#[from] ApiError),
#[error("cannot access {}", path.display())]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("cannot generate the run's SSH keys: {0}")]
Keygen(String),
#[error("{0}")]
InvalidPath(String),
#[error("Runpod gave an unusable SSH endpoint: {0}")]
InvalidEndpoint(String),
#[error(transparent)]
Exec(#[from] crate::exec::ExecError),
#[error(transparent)]
Runs(#[from] crate::runs::RunsError),
#[error("{0}")]
NoCapacity(String),
#[error("{0}")]
NotInStock(String),
#[error(
"Runpod refused for lack of credits (402): deploying needs at least one hour of credits"
)]
NoCredits,
#[error("{0}")]
Rejected(String),
#[error("Runpod did not answer the create calls clearly; check `overbrainer pod ls`")]
Unanswered,
#[error(
"the pod's watchdog cannot remove its own pod ({reason}): pod {pod_id} was deleted and training refused"
)]
WatchdogRefused {
pod_id: PodId,
reason: String,
},
#[error("the pod's bootstrap failed ({reason}): pod {pod_id} was deleted and training refused")]
BootstrapFailed {
pod_id: PodId,
reason: String,
},
#[error(
"pod {pod_id} answers SSH, but the local ssh cannot keep its connection ({reason}); a wrapper around `ssh` on PATH, such as firejail, may kill its background process: put the real ssh first on PATH. The pod was deleted and no other GPU type tried"
)]
LocalSsh {
pod_id: PodId,
reason: String,
},
#[error("interrupted before the job started")]
Interrupted,
#[error("pod {0} could not be confirmed deleted: check `overbrainer pod ls`")]
NotDeleted(PodId),
#[error(transparent)]
Run(#[from] crate::runs::RunError),
#[error("max_hours reached: the pod was deleted before the job ended")]
DeadlineReached,
#[error("pod {0} no longer exists")]
PodGone(PodId),
#[error(
"run {run_id} is still running{kept}; stop it with `overbrainer train cancel {run_id}` first, or pass --force"
)]
RunStillRunning {
run_id: String,
kept: String,
},
#[error(
"run {0} is still starting its pod; wait for it, or use `overbrainer train cancel {0}` once it runs, or `pod rm {0} --force`"
)]
StillStarting(String),
#[error(
"run {0} is in progress but its pod is not recorded, so its pods are left alone; if the run is really dead, use `overbrainer pod rm {0} --force`"
)]
PodNotRecorded(String),
#[error(
"run {0} is not in this project's runs/: its pods may belong to another checkout; if none owns it, pass --force"
)]
NotInRuns(String),
#[error("pod {0} has no SSH endpoint (status {1}); try again once it runs")]
NoEndpoint(PodId, String),
#[error(
"pod {pod_id} is stopped and will not run again by itself; remove it with `overbrainer pod rm {run_id}`"
)]
PodStopped {
pod_id: PodId,
run_id: String,
},
}