How to manage recurring tasks in taskwarrior?
Solution 1:
I was messing around with recurring tasks and figured it out:
Some background: Creating a recurring tasks creates a parent
task which spawns child
tasks.
from: https://taskwarrior.org/docs/recurrence.html
with some testing, I've found that with this command:
(ins)[>]task add "test" recur:5s due:30s
Created task 27 (recurrence template).
Firstly, due
affects the first child task. Every child task spawned after due-time (30 seconds in my example) then is due in recur-time (5 seconds in example)
(ins)[>]task
[task next]
ID Age Deps P Project Recur Due Description
22 - PT5S 30s test
#some time later...
(ins)[>]task
[task next]
ID Age Deps P Project Recur Due Description
22 60s PT5S -30s test
23 30s PT5S -25s test
24 25s PT5S -20s test
25 20s PT5S -15s test
26 15s PT5S -10s test
27 10s PT5S -5s test
28 5s PT5S - test
29 0s PT5S 5s test
However due
also affects one more thing: when the second child task is
spawned (the second child task is due in recur-time so the third child task spawns
after recur-time and so on).
This is why you aren't seeing your second child task since you have the due
date set to later
which is 19.2 years
time in the future according to your example; the
second child task will therefore spawn only after 19.2 years
time later (after which
each child task will spawn daily
).
Solution 2:
I previously answered this same question over in unix & linux. RPosting the answer again, for record.
Before I dive into the working details, note that recurrence is not well-designed. What I bring is empirical observations and liable to change with a rework.
TLDR; How do I use and make sense of recurrence
task add recur:<duration> due:<first task due date> until:<delete first task by date> wait:<date when task will appear> "my task"
Example:
task add recur:daily due:9:00 until:12:00 wait:5:00 eat breakfast
- Eat breakfast at 9:00 AM
- Hide task until 5:00 AM
- Remove task by lunch time
- Create a new occurrence everyday
Details
Recurrence requires a due
attribute (enforced with a validation check).
Recurrence can also use until
and wait
attributes, if they exist.
Recurrence does not use scheduled
.
And there is a mask
attribute, that tracks which instance of the reoccurence the task is.
When a new recurring instance is created:
-
new task due
=parent due
+recur
*mask
- identical math for both
until
andwait
-
scheduled
is copied wholesale from the parent task. In practice, this unexpected behaviour won't break your workflow, just affects filters and skews urgency. I call this out because it took me a very long time to discover this was not working as expected.
Every time taskwarrior
runs, it checks to see if it's time to create the next occurrence. The psuedo-equation is:
now >= due + recur * (mask + 1)`
Note, there is a config value, rc.recurrence.limit
, that can be used to tell taskwarrior to create even more occurrences further out.
You can expect the next occurrence to be created at the due date of the previous.