update api, fix tests and examples
This commit is contained in:
@@ -87,7 +87,7 @@ pub struct Job {
|
||||
pub context_id: String,
|
||||
pub payload: String,
|
||||
pub job_type: JobType,
|
||||
pub runner_name: String,
|
||||
pub runner: String,
|
||||
pub timeout: Option<u64>,
|
||||
pub env_vars: HashMap<String, String>,
|
||||
}
|
||||
@@ -239,9 +239,9 @@ impl WasmSupervisorClient {
|
||||
}
|
||||
|
||||
/// Queue a job to a specific runner
|
||||
pub async fn queue_job_to_runner(&mut self, runner_name: &str, job: Job) -> WasmClientResult<()> {
|
||||
pub async fn queue_job_to_runner(&mut self, runner: &str, job: Job) -> WasmClientResult<()> {
|
||||
let params = json!({
|
||||
"runner_name": runner_name,
|
||||
"runner": runner,
|
||||
"job": job
|
||||
});
|
||||
self.make_request("queue_job_to_runner", params).await
|
||||
@@ -250,12 +250,12 @@ impl WasmSupervisorClient {
|
||||
/// Queue a job to a specific runner and wait for the result
|
||||
pub async fn queue_and_wait(
|
||||
&mut self,
|
||||
runner_name: &str,
|
||||
runner: &str,
|
||||
job: Job,
|
||||
timeout_secs: u64,
|
||||
) -> WasmClientResult<Option<String>> {
|
||||
let params = json!({
|
||||
"runner_name": runner_name,
|
||||
"runner": runner,
|
||||
"job": job,
|
||||
"timeout_secs": timeout_secs
|
||||
});
|
||||
@@ -293,7 +293,7 @@ pub struct JobBuilder {
|
||||
context_id: Option<String>,
|
||||
payload: Option<String>,
|
||||
job_type: Option<JobType>,
|
||||
runner_name: Option<String>,
|
||||
runner: Option<String>,
|
||||
timeout: Option<u64>,
|
||||
env_vars: HashMap<String, String>,
|
||||
}
|
||||
@@ -329,8 +329,8 @@ impl JobBuilder {
|
||||
}
|
||||
|
||||
/// Set the runner name for this job
|
||||
pub fn runner_name(mut self, runner_name: impl Into<String>) -> Self {
|
||||
self.runner_name = Some(runner_name.into());
|
||||
pub fn runner(mut self, runner: impl Into<String>) -> Self {
|
||||
self.runner = Some(runner.into());
|
||||
self
|
||||
}
|
||||
|
||||
@@ -368,8 +368,8 @@ impl JobBuilder {
|
||||
job_type: self.job_type.ok_or_else(|| WasmClientError::Server {
|
||||
message: "job_type is required".to_string(),
|
||||
})?,
|
||||
runner_name: self.runner_name.ok_or_else(|| WasmClientError::Server {
|
||||
message: "runner_name is required".to_string(),
|
||||
runner: self.runner.ok_or_else(|| WasmClientError::Server {
|
||||
message: "runner is required".to_string(),
|
||||
})?,
|
||||
timeout: self.timeout,
|
||||
env_vars: self.env_vars,
|
||||
|
||||
Reference in New Issue
Block a user