|
11 | 11 | from .hubstorage.resourcetype import ItemsResourceType |
12 | 12 |
|
13 | 13 | # scrapinghub.hubstorage classes to use as-is |
14 | | -from .hubstorage.frontier import Frontier |
15 | 14 | from .hubstorage.job import JobMeta |
16 | 15 | from .hubstorage.project import Settings |
17 | 16 |
|
18 | 17 | # scrapinghub.hubstorage proxied classes |
19 | 18 | from .hubstorage.activity import Activity as _Activity |
20 | 19 | from .hubstorage.collectionsrt import Collections as _Collections |
21 | 20 | from .hubstorage.collectionsrt import Collection as _Collection |
| 21 | +from .hubstorage.frontier import Frontier as _Frontier |
22 | 22 | from .hubstorage.job import Items as _Items |
23 | 23 | from .hubstorage.job import Logs as _Logs |
24 | 24 | from .hubstorage.job import Samples as _Samples |
@@ -227,7 +227,7 @@ def __init__(self, client, projectid): |
227 | 227 | # proxied sub-resources |
228 | 228 | self.activity = Activity(_Activity, client, projectid) |
229 | 229 | self.collections = Collections(_Collections, client, projectid) |
230 | | - self.frontier = Frontier(client._hsclient, projectid) |
| 230 | + self.frontier = Frontier(_Frontier, client, projectid) |
231 | 231 | self.settings = Settings(client._hsclient, projectid) |
232 | 232 |
|
233 | 233 |
|
@@ -1084,6 +1084,31 @@ def list(self): |
1084 | 1084 | return list(self.iter()) |
1085 | 1085 |
|
1086 | 1086 |
|
| 1087 | +class Frontier(_Proxy): |
| 1088 | + """Frontiers collection for a project.""" |
| 1089 | + |
| 1090 | + def __init__(self, *args, **kwargs): |
| 1091 | + super(Frontier, self).__init__(*args, **kwargs) |
| 1092 | + self._proxy_methods(['close', 'flush', 'add', 'read', 'delete', |
| 1093 | + 'delete_slot']) |
| 1094 | + |
| 1095 | + @property |
| 1096 | + def newcount(self): |
| 1097 | + return self._origin.newcount |
| 1098 | + |
| 1099 | + def iter(self): |
| 1100 | + return iter(self.list()) |
| 1101 | + |
| 1102 | + def list(self): |
| 1103 | + return next(self._origin.apiget('list')) |
| 1104 | + |
| 1105 | + def iter_slots(self, name): |
| 1106 | + return iter(self.list_slots(name)) |
| 1107 | + |
| 1108 | + def list_slots(self, name): |
| 1109 | + return next(self._origin.apiget((name, 'list'))) |
| 1110 | + |
| 1111 | + |
1087 | 1112 | class Collection(object): |
1088 | 1113 | """Representation of a project collection object. |
1089 | 1114 |
|
|
0 commit comments