-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EarlyTask
plugins
#1562
Comments
Yes, that was it. Thanks for linking it! |
(Ah, I forgot the fine prints: the |
Creating a category is a total of five lines of code across two files ( A priority system would be a huge mess, would require a lot of changes everywhere and giving out actual priorities to each and every task to make it flexible. I’m pretty sure And I just created |
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Shouldn't |
@punchagan Probably. I'll do it tomorrow. Chris Warrick https://chriswarrick.com/
|
@Kwpolska Sure. I was trying to use this feature, and have something that works. You can probably review, (fix) and merge it. (Tomorrow). Happy New Year! 🎆 |
Where is it? Chris Warrick https://chriswarrick.com/
|
hat tip @punchagan Issue #1562 Signed-off-by: Chris Warrick <kwpolska@gmail.com>
The loader should have been fixed. I managed to do it in 2014 and on my Chris Warrick https://chriswarrick.com/
|
Woops, didn't see your question. I had referenced the PR in this commit, but no email notifications for them. :) Thanks! |
You should've posted the commit sha here, that way I would notice. Either Chris Warrick https://chriswarrick.com/
|
Yep. Thanks! |
Cool, everything's already done! :) |
Probably too late but i will chime in anyway :) doit has 2 distinct phases. task-creation and task-execution. task-creation (generate task metadata) is usually done in doit using the task_xxx functions ina dodo.py module. But in Nikola it is done through the Nikola site object. Since in Nikola you can add more task-creators through plugins So task-execution ordering must be handled by doit using the task property A "priority system" may make sense for Nikola since the global Nikola site object is modified by many plugins, but it doesnt make sense for |
What do you think? Would it be hard to modify
What do you think? Cheers, |
@felixfontein it's perhaps cleaner and less work to create three "metatasks" and have mt1 have all EarlyTasks in its task_dep, then have mt2 have all Tasks and mt1 on its task_dep and then have mt3 have all LateTasks and mt2 in its task_dep It can be trivially extended to an enumeration etc. |
I’m reverting the current failed implementation of EarlyTask in 0ce8d72. |
@ralsina: That does not solve the problem that during creation of the usual tasks, the generated posts haven't been created yet (and so no tasks to handle them, i.e. to render their pages, include them in indices and tag pages, etc. can be created resp. are created incorrectly). For that, the tasks can only be created when the previous tasks have been completely processed. |
@felixfontein created pydoit/doit#20 with some further thoughts about it. Hopefully you can assign yourself to implement it :) |
I'll try :) Though not today anymore... |
Ok, I now rewrote parts of the code to have each task plugin's tasks generated by one delayed task loader. Also, the delayed task's name equals the task plugin's name, whence One thing I noticed: since all tasks of stage 2 (f.e.) depend on the waiting task of stage 1, and that waiting task depends on all tasks of stage 1, building one specific task in stage 2 via |
Do you mean a setup-task? Maybe a delayed task should create an implicit setup-task instead of a task_dep... |
No, a setup-task will be executed when this task is executed. A |
@felixfontein give me an example please. dodo.py format and what happens when you run it. better create an issue on doit tracker or we gonna hijack this issue (again). |
Take the following
There are two stages, I would like this last dependence (of |
I think for first discussing on how to do this (because it has to do a lot with this feature) it's ok to discuss it here, but as soon as we know what we want we can continue to discuss it in the doit tracker. Hope that's ok for you :) |
@felixfontein thanks for the example. I guess I understand your problem In my opinion this problem only arises when using "phases" that doit has really no support for, so maybe a patch on Nikola is more appropriate. Can you define better what triggers the change of behaviour in these And how can you test/trigger this before pydoit/doit#20 being implemented? Anyway I gave it a try here: |
Hmm, a Yes, I know that this sounds a bit far fetched, but at least it shows such a feature could in theory be used in a more general setting. Anyway, there's no behavior difference for |
(Your try is a hack which works fine if all tasks specified on the command line are within one stage, but if they are not, tasks from a later stage might be generated before an earlier stage finished execution.) |
Ok, I got an idea where this could be quite useful. Assume that you want to record audio samples, maybe for a study. Every sample (recorded as a .wav file) should be converted to different formats (say .ogg and .mp4) afterwards. So you create a recording task for every sample to record, and tasks to create .ogg and .mp4 files (which depend on the recording task). Since the encoding can be done in parallel, you want to run doit with If you have three recordings, Here you would prefer to use a (Even if you don't want to do the encoding part and thus don't need parallel execution, having such a |
@felixfontein the audio sample example is a different case... this is an example where you need contention based on resource utilization for parallel scheduling. This has been raised before, it is feasible to be implemented in doit. But using
I guess you need to understand a bit more how doit works internally. A task is schedule to be executed in 2 situations:
The problem is that in 2) this happens at run time while tasks are being executed. In other words, doit does not pre-compute the whole task dependency tree before it starts its execution. This has some advantages: being fast (dont compute parts of the tree that are not used), and allowing some dynamic modification of the "tree" (like calc_dep and delayed task creation). To implement A The other option would be to pre-compute the whole DAG, but again given the very dynamic nature of doit you would still have no guarantee that a "skipped" So I guess this I guess it does not solve your problem but doit has a "--single" flag for the |
Having |
That’s not going to happen any time soon. |
Hi,
I'd like to have a plugin category
EarlyTask
, for tasks which are executed before the site is rendered (i.e. an analogue toLateTask
). I personally need that for a plugin (or better, combination of plugins) I wrote, currently I used theTask
plugin class but it happens that some tasks are run after page compiling, while my page compiling plugin needs their result -- and so it fails.Does anyone mind if I add something like that? Or would it be better to have a general priority system, so you can assign a task a priority (usual tasks could get 10, and late tasks 100, so you could add a task with priority 2 and one with priority 7 to ensure that the one with priority 2 appears in the task list before the one with priority 7 and before all regular rendering tasks and late tasks)?
(I have the vague feeling that I already read something about
EarlyTask
s somewhere here, but I cannot remember where. So it's probably not my own idea :) )Cheers,
Felix
The text was updated successfully, but these errors were encountered: