-
-
Notifications
You must be signed in to change notification settings - Fork 171
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
Public dependency manager #297
Conversation
@schettino72 Where would I link a sample snippet into the docs, what would be a good spot? |
I will rebase this before reviewing it... |
Actually quite complicated to rebase this to master... I gave up. Your Regarding the documentation, your example i would like to put in a new HOW-TO section. dont worry about that now, we can do it later. But |
Don't worry, I'll fix the branch and will incorporate your comments. |
@schettino72 The diff is clean now, you can add your comments for the files, but I can easily just remove the access function as well. I'll do that tomorrow. |
I just rebased the code cleanly onto master locally, will push it tonight. Regarding the sample I'd like to keep the clean. IMHO this is one of the main use cases for that feature. A slightly simplified sample will be part of the pushed branch. |
232c228
to
ce47f50
Compare
b497297
to
e22babe
Compare
e22babe
to
0cca250
Compare
@schettino72 Please pick up review, rebase onto master is complete. Please see my above comments on having |
doit/globals.py
Outdated
class Globals: | ||
"""Accessors to doit singletons. | ||
|
||
:cvar dep_manager: The doit dependency manager, holding all persistent task data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the type here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it is still missing docs, right?
I guess this feature does not fit any of the existing pages... I would create a new page between task_args
and uptodate
.
Example is better now. There are so many use-cases for this feature...
I noticed sometimes users tend ignore a feature if the example is not trivial and do not reflect their use-case.
So I usually prefer minimal examples where the only feature being show is the one discussed. And leave to the user to figure out how put all doit features together to solve their problems :)
@schettino72 Docs added. |
doc/globals.rst
Outdated
@@ -0,0 +1,31 @@ | |||
========== | |||
Singletons |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the file is called 'globals' the the title is 'singletons'... we should use just one name...
you write the docs as if we would have many globals, not sure that would be the case. maybe we could expose the Reporter or some other internal stuff. But those are already documented elsewhere...
what about have this section of docs being specific to 'db backend' or something like that.
Another thing i just realized is that we are calling it 'dep_manager' as it is original function on doit itself.Wondering if we should use a more generic name. In practice users could use this to store some data. like a a task that stores and use a data itself in future runs. for this use-case the name dep_manager is completely innapropriate.
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll adapt the section title to match file and module name.
you write the docs as if we would have many globals
Correct, this way, it will be easy to extend it when needed. I certainly would not add anything here just to have more than one attribute.
Regarding the names: I surely stumbled upon the names initially as well. There is a class Dependency
that is called dep_manager
wherever it is used and in fact it is actually the doit database...
But I got over it 😃 If you want to rename it and clean this up, I'd ask you to do this in a separate PR, if you don't mind. I maybe would have called things differently here and there, but that is really a personal thing...
Added docs about dep_manager API, some of the backend API and the different backends. |
Merged, thanks. Nice to have a regular contributor 👍 Notes:
|
In order to implement #288, this PR stores the dependency manager in a global registry class before task are loaded or executed.
This allows to get it from any code inside a task generator, e.g. from clean to read the previous execution result, see the contained sample.
The original discussion suggested to implement the registry as plain Python
dict
. I'd like to prevent string-based access and therefore implemented a very simply static class in new moduledoit.globals
.