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:
Timur Gordon
2025-10-27 14:59:14 +01:00
parent 9b3477d6d2
commit 674ae22f91

View File

@@ -303,6 +303,10 @@ pub trait SupervisorRpc {
#[method(name = "job.run")]
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
#[method(name = "job.start")]
async fn job_start(&self, params: StartJobParams) -> RpcResult<()>;
@@ -349,7 +353,7 @@ pub trait SupervisorRpc {
/// Get the status of a specific runner
#[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
#[method(name = "get_runner_logs")]
@@ -495,6 +499,11 @@ impl SupervisorRpcServer for Arc<Mutex<Supervisor>> {
}
}
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<()> {
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> {
debug!("OpenRPC request: get_runner_status with actor_id: {}", actor_id);
async fn get_runner_status(&self, params: RunnerManagementParams) -> RpcResult<ProcessStatusWrapper> {
debug!("OpenRPC request: get_runner_status with params: {:?}", params);
// TODO: Verify secret authorization
let supervisor = self.lock().await;
let status = supervisor
.get_runner_status(&actor_id)
.get_runner_status(&params.actor_id)
.await
.map_err(runner_error_to_rpc_error)?;
Ok(status.into())