fix: add run_job alias and update get_runner_status to use params
- Added run_job method as alias for job.run for backward compatibility - Updated get_runner_status to accept RunnerManagementParams with secret - Both methods now properly handle secret-based authentication - Fixes 'Method not found' and parameter mismatch errors
This commit is contained in:
@@ -302,6 +302,10 @@ pub trait SupervisorRpc {
|
|||||||
/// Run a job on the appropriate runner and return the result
|
/// Run a job on the appropriate runner and return the result
|
||||||
#[method(name = "job.run")]
|
#[method(name = "job.run")]
|
||||||
async fn job_run(&self, params: RunJobParams) -> RpcResult<JobResult>;
|
async fn job_run(&self, params: RunJobParams) -> RpcResult<JobResult>;
|
||||||
|
|
||||||
|
/// Run a job (alias for job.run for backward compatibility)
|
||||||
|
#[method(name = "run_job")]
|
||||||
|
async fn run_job(&self, params: RunJobParams) -> RpcResult<JobResult>;
|
||||||
|
|
||||||
/// Start a previously created job by queuing it to its assigned runner
|
/// Start a previously created job by queuing it to its assigned runner
|
||||||
#[method(name = "job.start")]
|
#[method(name = "job.start")]
|
||||||
@@ -349,7 +353,7 @@ pub trait SupervisorRpc {
|
|||||||
|
|
||||||
/// Get the status of a specific runner
|
/// Get the status of a specific runner
|
||||||
#[method(name = "get_runner_status")]
|
#[method(name = "get_runner_status")]
|
||||||
async fn get_runner_status(&self, actor_id: String) -> RpcResult<ProcessStatusWrapper>;
|
async fn get_runner_status(&self, params: RunnerManagementParams) -> RpcResult<ProcessStatusWrapper>;
|
||||||
|
|
||||||
/// Get logs for a specific runner
|
/// Get logs for a specific runner
|
||||||
#[method(name = "get_runner_logs")]
|
#[method(name = "get_runner_logs")]
|
||||||
@@ -494,6 +498,11 @@ impl SupervisorRpcServer for Arc<Mutex<Supervisor>> {
|
|||||||
None => Ok(JobResult::Error { error: "Job execution failed".to_string() })
|
None => Ok(JobResult::Error { error: "Job execution failed".to_string() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn run_job(&self, params: RunJobParams) -> RpcResult<JobResult> {
|
||||||
|
// Alias for job_run - just call the same implementation
|
||||||
|
self.job_run(params).await
|
||||||
|
}
|
||||||
|
|
||||||
async fn job_start(&self, params: StartJobParams) -> RpcResult<()> {
|
async fn job_start(&self, params: StartJobParams) -> RpcResult<()> {
|
||||||
debug!("OpenRPC request: job.start with params: {:?}", params);
|
debug!("OpenRPC request: job.start with params: {:?}", params);
|
||||||
@@ -613,11 +622,12 @@ impl SupervisorRpcServer for Arc<Mutex<Supervisor>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_runner_status(&self, actor_id: String) -> RpcResult<ProcessStatusWrapper> {
|
async fn get_runner_status(&self, params: RunnerManagementParams) -> RpcResult<ProcessStatusWrapper> {
|
||||||
debug!("OpenRPC request: get_runner_status with actor_id: {}", actor_id);
|
debug!("OpenRPC request: get_runner_status with params: {:?}", params);
|
||||||
|
// TODO: Verify secret authorization
|
||||||
let supervisor = self.lock().await;
|
let supervisor = self.lock().await;
|
||||||
let status = supervisor
|
let status = supervisor
|
||||||
.get_runner_status(&actor_id)
|
.get_runner_status(¶ms.actor_id)
|
||||||
.await
|
.await
|
||||||
.map_err(runner_error_to_rpc_error)?;
|
.map_err(runner_error_to_rpc_error)?;
|
||||||
Ok(status.into())
|
Ok(status.into())
|
||||||
|
|||||||
Reference in New Issue
Block a user