STAR-322: Checking if response changed before updating cluster

This commit is contained in:
Daniel Schiavini 2018-12-07 13:19:45 +01:00
parent 2b8358fda8
commit 5b963de2ea
13 changed files with 58 additions and 30 deletions

View file

@ -1,15 +1,17 @@
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from datetime import datetime
from typing import List
from .CloudClusterPrinter import CloudClusterPrinter
from .CloudClusterPrintJob import CloudClusterPrintJob
from ...Models import BaseModel
from .BaseCloudModel import BaseCloudModel
# Model that represents the status of the cluster for the cloud
class CloudClusterStatus(BaseModel):
class CloudClusterStatus(BaseCloudModel):
def __init__(self, **kwargs) -> None:
self.generated_time = None # type: datetime
# a list of the printers
self.printers = [] # type: List[CloudClusterPrinter]
# a list of the print jobs
@ -20,3 +22,7 @@ class CloudClusterStatus(BaseModel):
# converting any dictionaries into models
self.printers = [CloudClusterPrinter(**p) if isinstance(p, dict) else p for p in self.printers]
self.print_jobs = [CloudClusterPrintJob(**j) if isinstance(j, dict) else j for j in self.print_jobs]
# converting generated time into datetime
if isinstance(self.generated_time, str):
self.generated_time = self.parseDate(self.generated_time)