JobBuilder

Struct JobBuilder 

Source
pub struct JobBuilder<'bb> { /* private fields */ }

Implementations§

Source§

impl<'bb> JobBuilder<'bb>

Source

pub fn name(&mut self, name: impl Into<String>) -> &mut Self

Source

pub fn attribute( &mut self, key: impl ToString, value: impl ToString, ) -> &mut Self

Source

pub fn attributes<I, S, T>(&mut self, attrs: I) -> &mut Self
where S: ToString, T: ToString, I: IntoIterator<Item = (S, T)>,

Source

pub fn always_run(&mut self, always_run: bool) -> &mut Self

Sets the always_run field of the job (Default: false).

Source

pub fn arg(&mut self, arg: impl Into<String>) -> &mut Self

Adds a single argument to the command.

Source

pub fn args<I, S>(&mut self, args: I) -> &mut Self
where S: Into<String>, I: IntoIterator<Item = S>,

Adds several arguments to the command.

Source

pub fn args_mut(&mut self) -> &mut Vec<String>

Returns the current arguments, including the command, for arbitrary manipulation

Source

pub fn env( &mut self, key: impl Into<String>, val: impl Into<String>, ) -> &mut Self

Add/Replace one environment variable.

Source

pub fn env_vars<I, S, T>(&mut self, vars: I) -> &mut Self
where S: Into<String>, T: Into<String>, I: IntoIterator<Item = (S, T)>,

Adds/Replace several environment variables.

Source

pub fn env_remove(&mut self, key: &impl Borrow<str>) -> Option<String>

Removes a key from the environment, if it exists

Source

pub fn env_clear(&mut self)

Clears the provided environment, doesn’t affect the environment otherwise present in the image.

Source

pub fn gcsfuse( &mut self, bucket: impl Into<String>, mount_path: impl Into<String>, read_only: bool, ) -> &mut Self

Adds a gcsfuse mount point.

Source

pub fn input_file( &mut self, from: impl Into<String>, to: impl Into<String>, ) -> &mut Self

Adds an input file.

Source

pub fn input_files<I, S, T>(&mut self, paths: I) -> &mut Self
where S: Into<String>, T: Into<String>, I: IntoIterator<Item = (S, T)>,

Adds several input files.

Source

pub fn mount_docker_socket(&mut self, mount: bool) -> &mut Self

Sets the mount_docker_socket property (Default: false).

Source

pub fn output_file( &mut self, from: impl Into<String>, to: impl Into<String>, ) -> &mut Self

Adds an output file.

Source

pub fn output_files<I, S, T>(&mut self, paths: I) -> &mut Self
where S: Into<String>, T: Into<String>, I: IntoIterator<Item = (S, T)>,

Adds several output files.

Source

pub fn parent(&mut self, parent_id: usize) -> &mut Self

Adds a parent job id. Job parents need to be handled carefully, once set, they cannot be unset. They are not deserialized when fetching job specs, and so have to be reconstructed using other means.

§Panics

Panics if parent_id is greater than or equal to this job’s id

Source

pub fn parents( &mut self, parent_ids: impl IntoIterator<Item = usize>, ) -> &mut Self

Adds several parent job ids. Job parents need to be handled carefully, once set, they cannot be unset. They are not deserialized when fetching job specs, and so have to be reconstructed using other means.

§Panics

Panics if any of the parent_ids are greater than or equal to this job’s id

Source

pub fn port(&mut self, port: u16) -> &mut Self

Sets a port this container will publish (Default: no port will be published)

Source

pub fn clear_port(&mut self) -> &mut Self

Clears published port (if any)

Source

pub fn requester_pays_project( &mut self, project: impl Into<String>, ) -> &mut Self

Set a requester pays project for this job (Default: no requester pays project)

Source

pub fn network(&mut self, network: impl Into<String>) -> &mut Self

Sets the network to use for this job. (Default: no special networking).

Source

pub fn resources(&mut self, cpu: f64, memory: u64, storage: u64) -> &mut Self

Sets the requested resources for this job, cpu is the fraction of whole cpus (1.0 is 1 cpu, 0.5 is half a cpu, etc.), memory and storage are both expressed in bytes. (Defaults: 1 cpu, 3.75 GiB RAM, 10 GB Storage Space).

Source

pub fn cpu(&mut self, cpu: f64) -> &mut Self

Sets the requested cpu. 1.0 is 1 whole cpu. (Default: 1 cpu)

Source

pub fn memory(&mut self, memory: u64) -> &mut Self

Sets the requested memory in bytes. (Default: 3.75 GiB)

Source

pub fn storage(&mut self, storage: u64) -> &mut Self

Sets the requested disk space in bytes. (Default: 10 GiB)

Source

pub fn service_account( &mut self, namespace: impl Into<String>, name: impl Into<String>, ) -> &mut Self

Sets the service account to use for this job.

Source

pub fn timeout(&mut self, timeout: u64) -> &mut Self

Sets the timeout in seconds, setting it to zero clears the timeout.

Source

pub fn build(self) -> usize

Finalizes this job, adding it to the batch and returning

Methods from Deref<Target = JobSpec>§

Source

pub fn id(&self) -> usize

Trait Implementations§

Source§

impl<'bb> Debug for JobBuilder<'bb>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DerefMut for JobBuilder<'_>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl Deref for JobBuilder<'_>

Source§

type Target = JobSpec

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'bb> Freeze for JobBuilder<'bb>

§

impl<'bb> !RefUnwindSafe for JobBuilder<'bb>

§

impl<'bb> Send for JobBuilder<'bb>

§

impl<'bb> Sync for JobBuilder<'bb>

§

impl<'bb> Unpin for JobBuilder<'bb>

§

impl<'bb> !UnwindSafe for JobBuilder<'bb>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,