many updates in report code and in storage structure, this commit is broken
diff --git a/wally/suits/job.py b/wally/suits/job.py
index ce32e0e..91822cb 100644
--- a/wally/suits/job.py
+++ b/wally/suits/job.py
@@ -1,5 +1,5 @@
import abc
-from typing import Dict, Any, Tuple
+from typing import Dict, Any, Tuple, cast, Union
from collections import OrderedDict
from ..common_types import Storable
@@ -24,6 +24,10 @@
"""Readable long summary for management and deployment engineers"""
pass
+ @abc.abstractmethod
+ def copy(self, **updated) -> 'JobParams':
+ pass
+
def __getitem__(self, name: str) -> Any:
return self.params[name]
@@ -31,10 +35,21 @@
self.params[name] = val
def __hash__(self) -> int:
- return hash(tuple(sorted(self.params.items())))
+ return hash(self.char_tpl)
- def __eq__(self, o: 'JobParams') -> bool:
- return sorted(self.params.items()) == sorted(o.params.items())
+ def __eq__(self, o: object) -> bool:
+ if not isinstance(o, self.__class__):
+ raise TypeError("Can't compare {!r} to {!r}".format(self.__class__.__qualname__, type(o).__qualname__))
+ return sorted(self.params.items()) == sorted(cast(JobParams, o).params.items())
+
+ def __lt__(self, o: object) -> bool:
+ if not isinstance(o, self.__class__):
+ raise TypeError("Can't compare {!r} to {!r}".format(self.__class__.__qualname__, type(o).__qualname__))
+ return self.char_tpl < cast(JobParams, o).char_tpl
+
+ @abc.abstractproperty
+ def char_tpl(self) -> Tuple[Union[str, int, float, bool], ...]:
+ pass
class JobConfig(Storable, metaclass=abc.ABCMeta):
@@ -45,7 +60,7 @@
self.idx = idx
# time interval, in seconds, when test was running on all nodes
- self.reliable_info_time_range = None # type: Tuple[int, int]
+ self.reliable_info_range = None # type: Tuple[int, int]
# all job parameters, both from suite file and config file
self.vals = OrderedDict() # type: Dict[str, Any]
@@ -53,9 +68,13 @@
@property
def storage_id(self) -> str:
"""unique string, used as key in storage"""
- return "{}_{}".format(self.params.summary, self.idx)
+ return "{}_{}".format(self.summary, self.idx)
@abc.abstractproperty
def params(self) -> JobParams:
"""Should return a copy"""
pass
+
+ @property
+ def summary(self) -> str:
+ return self.params.summary