-
Notifications
You must be signed in to change notification settings - Fork 460
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
Support for EarlyTasks. #1632
Support for EarlyTasks. #1632
Conversation
How up-to-date is up-to-date? Change the dependency in requirements.txt to match. Also, can't we tell doit to use threads from code? |
Also, the tests fail on Travis, which is a very bad thing you absolutely need to fix, especially because there are dependency errors in integration tests. |
As up-to-date as it can be ;-) I updated the requirement, but before merging we probably have to update it again. Tell doit to use threads from code: yes, that's the plan. I'll check for a more elegant way later (instead of just inserting Tests: they probably fail because the new post list rendering code requires the post to be already rendered. I updated the dependencies. |
Hmm, at the moment I don't see a completely satisfactory way to force the use of threads via code, except by injecting |
It needs doit 0.27 or above. Apart from setting the minimum version on setup.py and requirements files, please also set minversion. Please refresh my memory... Why parallel execution with multi-process doesnt work? You can set (almost) any command line attribute on
|
Ah, I forgot about About multi-processing: the implementation of multi-processing in doit requires to pickle task objects, which doesn't work well with closures (search for "pickled" in #1562). Since Nikola, default plugins and 3rd party plugins use closures in tasks, this could be somewhat problematic. At least for me, it always fails quite early when using multi-processing. |
You set minversion incorrectly. It should be |
Hmm, this looks like a bug in doit (or a Python string problem) to me; after all, the documentation (http://pydoit.org/cmd_run.html#minversion) says you should use a string. I guess the problem is in
in combination with:
in A simple fix (which ignores the main problem) would be to use a tuple, but that somewhat bothers me since it is not clear if that's officially allowed (the documentation only mentions strings, not tuples). @schettino72: should using tuples be officially allowed? |
(The problem doesn't happen with Python 3, BTW, that's why I never experienced it locally...) |
It should support both string and tuple. The documentation on the site is incomplete, docs on source code are good: https://github.com/pydoit/doit/blob/master/doit/cmd_base.py#L14 And there is a bug on python2 it should check for It is an easy fix (patches welcome), but I suggest you guys just use a tuple or you will have to wait for next doit release. |
FYI. I fixed the the minversion problem. I also improved the docs saying both strings and tuples are supported. To be released on doit 0.28 |
Thanks a lot! I'm now using a tuple. |
bf1acd5
to
ea46730
Compare
So doit 0.28 is out. What's the status of this? Does it work? Does it have any limitations? |
It cannot work yet, because we need to fix things to actually support doit v0.28.0. See #1655. |
The main limitation is still that it is currently not possible to specify targets on the command line, like |
ea46730
to
0e8c12f
Compare
I now rebased the earlytask_impl branch to current master; this also includes support for doit 0.28. (The old branch for doit 0.27 is preserved as https://github.com/getnikola/nikola/tree/earlytask_impl_old, just in case.) Note that with doit 0.28, you still cannot specify targets via |
@felixfontein in what ways does this break backwards compatibility? If it really does, then I'll do a 7.4.2 before merging it. |
Well, currently what doesn't work is There might be some other minor incompatibilities, in particular with other task plugins than the default ones. Also, I'd prefer to rebase/merge with master again after when you merged the scanposts refactoring, since these two branches will have some conflicts. |
0e8c12f
to
87e9801
Compare
The task/target specification limitations, while a change, I don't think is too bad. We could even check that plugins generate tasks with the right name. |
Hmm, a problem I just noted: if a task has more than one target, there are two problems: I don't know what to do about a) (@schettino72: any idea?). For b), this is currently a result because doit's |
I suppose nikola check could do something smarter than reading the output of the list command. It just never seemed necessary so far. If you file a bug I'll get around to it eventually. |
902a20d
to
ad75bbf
Compare
01699f4
to
dadb91e
Compare
… Task and LateTask. Scanning posts is done in additional stage between EarlyTask and Task. Using delayed loading per plugin task object when cmd.execute_tasks is True, which allows to use `nikola build <task_name>`.
Setting doit parallelism mechanism to threading, as multi-processing does not work due to pickling.
dadb91e
to
b272ac1
Compare
At least some of the current failures seem to be caused by the problem described in pydoit/doit#152. I'll take another look when that's fixed. |
Does anyone care to keep this? I've stopped using and maintaining this a long time ago (some eight months or so), and it doesn't work well anyway (since doit doesn't implement some required features). |
👍 for killing it |
The earlytask_impl branch implements support for EarlyTasks in Nikola, which are tasks that are executed before Nikola scans for posts. See #1562 for more details. After some testing (sorry it took so long) I think it works rather well now, so it's time to start a PR :-)
What this branch improves over current Nikola:
What this branch requires:
What this branch cannot deliver at the moment:
nikola build <filename>
does not work without further support in doit (see specify target of a DelayedTask on command line pydoit/doit#20, haven't had time to really work on it yet);nikola build <taskname>
only works for tasks named after the plugin itself, and not for (potential) otherwise named tasks created by the plugins;-n 4
for example), one has to tell doit (via-P thread
) to use threads instead of processes.(fixes #1553 and #1562)