Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Allow querying size and index of TaskAttempts #566

Closed
nhammond opened this issue Oct 30, 2018 · 1 comment
Closed

Allow querying size and index of TaskAttempts #566

nhammond opened this issue Oct 30, 2018 · 1 comment

Comments

@nhammond
Copy link
Collaborator

nhammond commented Oct 30, 2018

Given a Task with parallel TaskAttempts, it can be useful to know the index of each task attempt. For example, I may want to take a list of input files and assign each one a different unique integer ID (as with fastq files and corresponding read groups for alignment and BQSR).

I propose adding "index" and "size" keywords to the jinja template dictionary. Users can query any dimension, e.g. for 2-dimensional array [[1,2,3],[4,5,6]], size(1) would return the innermost length of 3, and size(2) would return a length of 2. When operating on element "4", index(1) would return 1 (1-based index), and index(2) would return 2. For any higher value, both size(n) and index(n) should return 1.

Because jinja templates are rendered when Tasks are created, different index values will not alter the fingerprint of Tasks unless the index is referenced. e.g. if I run an identical Task twice, once with index 1 and once with index 2, Loom will still treat those steps as identical unless the user includes the "index" function in the command string. In that case, the differing values of the rendered command would result in different fingerprints.

@nhammond
Copy link
Collaborator Author

Added in #567

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant