Replies: 1 comment
-
|
Sounds like a cool pattern. You might find task_id <- "TASK_123"
promise <- promises::then(
mirai::mirai(targets::tar_make(callr_function = NULL)),
onFulfilled = function(result) print(paste(task_id, "success")),
onRejected = function(error) print(paste(task_id, "error"))
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Help
Description
I have a couple of long-running data pipelines that are triggered when users submit a POST request to a Plumber API.
My current approach uses promises and future.callr to start the pipeline in a background process and immediately return the task ID to the user. So the plumber handler functions include something like this:
How would I implement this if I wanted to use targets?
A minimal adaptation might look like this:
Would something else be preferable while preserving the core behavior (return immediately after launching the pipeline)?
Beta Was this translation helpful? Give feedback.
All reactions