Add a `with_duration` function to `WorkerBuilder`
Add a `with_duration` function that sets the `duration` field of
`WorkerBuilder`
@@ -93,6 +93,7 @@ impl WorkloadRunner {
.with_auth(auth)
.with_update_time(update_time)
.get_batch_status(get_batch_status)
+ .with_duration(duration)
.build()?;
self.workloads.insert(id, worker);
@@ -201,6 +202,7 @@ struct WorkerBuilder {
auth: Option<String>,
update_time: Option<u32>,
get_batch_status: Option<bool>,
+ duration: Option<Duration>,
}
impl WorkerBuilder {
@@ -265,6 +267,16 @@ impl WorkerBuilder {
self
}
+ /// Sets the total duration that the worker will run for
+ ///
+ /// # Arguments
+ ///
+ /// * `duration` - How long the worker should run for
+ pub fn with_duration(mut self, duration: Option<Duration>) -> WorkerBuilder {
+ self.duration = duration;
+ self
+ }
+
pub fn get_batch_status(mut self, get_batch_status: bool) -> WorkerBuilder {
self.get_batch_status = Some(get_batch_status);
self
