[help] Handling a target that returns a file and a value #1292
Replies: 1 comment 6 replies
-
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Help
Description
format = "file"
requires the target to return only a vector of files. This can be annoying because the operation of saving the file might have generated additional data that you want to keep inside some R data structures.For example, say we have an object that initialises by creating a data structure on disk:
In this case, I want changes to the file to cause this target to rerun, which requires
format = "file"
. However, I can't just returnpath
here because I want to keep the new structure. I could move the file creation logic into a separatewrite
function that is a dependency to theinit
target, but then I have to replicate all of my branching logic, and the logic used to combine the data across theinit
andwrite
targets. If I move thewrite
function afterinit
, then it will never run because nothing depends on the path explicitly: all future targets use the structure returned byinit
.I guess what I'm after is something analogous to Nextflow's
tuple(path, val)
idiom, which lets you return a path and an in-memory value, both of which get tracked appropriately: https://www.nextflow.io/docs/latest/process.html#output-type-tuple.It seems that
tar_cue
doesn't offer any control here. I could make a custom format usingtar_format()
, but that's quite a complex solution.Beta Was this translation helpful? Give feedback.
All reactions