(
&self,
py: Python<'_>,
task_id: String,
success: bool,
result: Option<&Bound<'_, PyDict>>,
error: Option<String>,
)
| 2355 | /// True if the task was found and completed, False if not found. |
| 2356 | #[pyo3(signature = (task_id, success=true, result=None, error=None))] |
| 2357 | fn complete_external_task( |
| 2358 | &self, |
| 2359 | py: Python<'_>, |
| 2360 | task_id: String, |
| 2361 | success: bool, |
| 2362 | result: Option<&Bound<'_, PyDict>>, |
| 2363 | error: Option<String>, |
| 2364 | ) -> PyResult<bool> { |
| 2365 | let result_value = match result { |
| 2366 | Some(dict) => { |
| 2367 | let json_str = py_dict_to_json(dict)?; |
| 2368 | serde_json::from_str(&json_str) |
| 2369 | .map_err(|e| PyValueError::new_err(format!("Invalid JSON: {e}")))? |
| 2370 | } |
| 2371 | None => serde_json::json!({}), |
| 2372 | }; |
| 2373 | let ext_result = RustExternalTaskResult { |
| 2374 | success, |
| 2375 | result: result_value, |
| 2376 | error, |
| 2377 | }; |
| 2378 | let session = self.inner.clone(); |
| 2379 | let found = py.allow_threads(move || { |
| 2380 | get_runtime().block_on(session.complete_external_task(&task_id, ext_result)) |
| 2381 | }); |
| 2382 | Ok(found) |
| 2383 | } |
| 2384 | |
| 2385 | /// Get pending external queue tasks. |
| 2386 | /// |
nothing calls this directly
no test coverage detected