MCPcopy Create free account
hub / github.com/Pometry/Raphtory / execute_async_task

Function execute_async_task

raphtory/src/python/utils/mod.rs:416–423  ·  view source on GitHub ↗

This function takes a function that returns a future instead of taking just a future because a task might return an unsendable future but what we can do is making a function returning that future which is sendable itself

(task: T)

Source from the content-addressed store, hash-verified

414// a task might return an unsendable future but what we can do is making a function returning that
415// future which is sendable itself
416pub fn execute_async_task<T, F, O>(task: T) -> O
417where
418 T: FnOnce() -> F + Send + 'static,
419 F: Future<Output = O> + 'static,
420 O: Send + 'static,
421{
422 Python::attach(|py| py.detach(move || get_runtime().block_on(task())))
423}
424
425static RUNTIME: OnceLock<Runtime> = OnceLock::new();
426

Callers 15

add_nodesMethod · 0.85
add_edgesMethod · 0.85
add_nodeMethod · 0.85
create_nodeMethod · 0.85
add_propertyMethod · 0.85
add_metadataMethod · 0.85
update_metadataMethod · 0.85
add_edgeMethod · 0.85
delete_edgeMethod · 0.85
add_updatesMethod · 0.85
deleteMethod · 0.85
add_metadataMethod · 0.85

Calls 1

get_runtimeFunction · 0.85

Tested by

no test coverage detected