"calc_targets"?

42 views
Skip to first unread message

Mike Pagel

unread,
Dec 4, 2017, 11:09:26 AM12/4/17
to python-doit
I've seen in the docs how create_after can be used to move some task's execution before another task's loading is done. However, the example is simpler than my use-case, where my dependent task's targets must be computed based on the data returned by the "early" task. In other words:

Task 1 computes data during it's execution.
Task 2 depends on that data to define its target, i.e. during Task 2's creation (loading).

Essentially I would need similar functionality to what calc_dep can do for dependencies. Is this possible?

Thanks.

Jan Vlčinský

unread,
Dec 4, 2017, 1:23:37 PM12/4/17
to 'Mike Pagel' via python-doit

Hi Mike

The http://pydoit.org/task_creation.html#delayed-task-creation seems to provide an example similar to your requirements as it dynamically define targets based on something done by previous task.

In your case I would think of saving the computed data to agreed file and the task creator would read the data from it and then use it to generate dependent tasks incl. targets calculated from that value.

I am not aware, if there is any option to directly access results calculated by previous tasks by other means (but my knowledge is limited in this area).

With best regards

Jan

--
You received this message because you are subscribed to the Google Groups "python-doit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jan Vlčinský
mob: +420-60897040
Slunečnicová 338/3
CZ-73401 Karviná-Ráj

Mike Pagel

unread,
Dec 4, 2017, 2:02:54 PM12/4/17
to python-doit
I don't think so. As I wrote, the example is simpler, as it does _not_ process task-returned data, but globs the filesystem, thereby taking another route to communicate between the two tasks. But I would prefer to keep this within doit and not write a data file from one task first to then read it from a second task...

Eduardo Schettino

unread,
Dec 5, 2017, 12:23:32 PM12/5/17
to python-doit
Hi Mike,

From your description it is not clear to me if you want to create several tasks (each with a single `target`) as the example.
Or a single task with where `targets` is a list as `calc_dep` would handle...

> my dependent task's targets must be computed based on the data returned by the "early" task

When I designed delayed-task creation I took this use-case in consideration but never implemented it.
As of today, task creation functions do not take any parameter,
the idea would be inject the task of `create_after` in the function being decorated.

So I **guess** the implementation to add this feature should be straightforward.
Similar to how a `task` object can be injected in a python-action.
 
regards,


--
You received this message because you are subscribed to the Google Groups "python-doit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit+unsubscribe@googlegroups.com.

Mike Pagel

unread,
Dec 7, 2017, 2:22:58 AM12/7/17
to python-doit
I was looking for a way to specify a single task's target list by referencing some output from another task. For now I have worked around this to some degree. I feel it will come up again and then look into how to contribute it.

Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages