-
Notifications
You must be signed in to change notification settings - Fork 923
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
Add created datetime to node #698
Add created datetime to node #698
Conversation
this is a good addition to the base class. I agree with you @allardhoeve it is a good design. 👍 |
@@ -167,7 +167,7 @@ class Node(UuidMixin): | |||
""" | |||
|
|||
def __init__(self, id, name, state, public_ips, private_ips, | |||
driver, size=None, image=None, extra=None): | |||
driver, size=None, image=None, created=None, extra=None): |
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 would prefer the attribute to be called created_at
.
It's also worth noting that this is a backward incompatible change for any place which doesn't use keyword arguments so we need to make sure it doesn't break any of the existing drivers and document it in the upgrade notes. |
I could put the new keyword after the |
I agree, this is better than using the driver and passing the node object in 👍 |
Okey, I changed the field name to |
👍 from me |
* Base Node object has `created_at` which indicates the `datetime` the node was launched/started/created. * EC2, Digital Ocean, OpenStack fill this attribute. * Nodes at drivers that do not (yet) support it have `NoneType` as date. * Document changes. closes apache#698 [GITHUB-698] Signed-off-by: Allard Hoeve <allardhoeve@gmail.com>
cb7e67f
to
72399b4
Compare
Instead of the implementation in #697, I'd like to propose this instead.
The problem with #697 is that when you want to find a list of old nodes when you have a list of
Node
objects, you'd need to write:Yuk, why is that driver in there? Better would be to write:
I have implemented this code for OpenStack, Digital Ocean and EC2. Other drivers, I have no access to. In those cases, the behaviour is to have
created
beNoneType
.