pub struct HfJobsClient { /* private fields */ }Expand description
Client for the HuggingFace Jobs REST API.
The Rust hf_hub crate has no Jobs API support, so we call the 5 simple
endpoints directly with reqwest.
Implementations§
Source§impl HfJobsClient
impl HfJobsClient
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Build a client from environment.
Requires HF_TOKEN or HUGGING_FACE_HUB_TOKEN to be set.
Sourcepub async fn submit(&self, namespace: &str, spec: &JobSpec) -> Result<JobInfo>
pub async fn submit(&self, namespace: &str, spec: &JobSpec) -> Result<JobInfo>
Submit a new job.
Sourcepub async fn inspect(&self, namespace: &str, job_id: &str) -> Result<JobInfo>
pub async fn inspect(&self, namespace: &str, job_id: &str) -> Result<JobInfo>
Inspect a job’s current status.
Sourcepub async fn stream_logs(
&self,
namespace: &str,
job_id: &str,
) -> Result<impl Stream<Item = Result<String>> + use<>>
pub async fn stream_logs( &self, namespace: &str, job_id: &str, ) -> Result<impl Stream<Item = Result<String>> + use<>>
Stream job logs via SSE. Returns lines as they arrive.
Each SSE data: line is a JSON object with data and timestamp fields.
Auto Trait Implementations§
impl !RefUnwindSafe for HfJobsClient
impl !UnwindSafe for HfJobsClient
impl Freeze for HfJobsClient
impl Send for HfJobsClient
impl Sync for HfJobsClient
impl Unpin for HfJobsClient
impl UnsafeUnpin for HfJobsClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more