vortex-nwp 2.0.0b1__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vortex/__init__.py +75 -47
- vortex/algo/__init__.py +3 -2
- vortex/algo/components.py +944 -618
- vortex/algo/mpitools.py +802 -497
- vortex/algo/mpitools_templates/__init__.py +1 -0
- vortex/algo/serversynctools.py +34 -33
- vortex/config.py +19 -22
- vortex/data/__init__.py +9 -3
- vortex/data/abstractstores.py +593 -655
- vortex/data/containers.py +217 -162
- vortex/data/contents.py +65 -39
- vortex/data/executables.py +93 -102
- vortex/data/flow.py +40 -34
- vortex/data/geometries.py +228 -132
- vortex/data/handlers.py +436 -227
- vortex/data/outflow.py +15 -15
- vortex/data/providers.py +185 -163
- vortex/data/resources.py +48 -42
- vortex/data/stores.py +540 -417
- vortex/data/sync_templates/__init__.py +0 -0
- vortex/gloves.py +114 -87
- vortex/layout/__init__.py +1 -8
- vortex/layout/contexts.py +150 -84
- vortex/layout/dataflow.py +353 -202
- vortex/layout/monitor.py +264 -128
- vortex/nwp/__init__.py +5 -2
- vortex/nwp/algo/__init__.py +14 -5
- vortex/nwp/algo/assim.py +205 -151
- vortex/nwp/algo/clim.py +683 -517
- vortex/nwp/algo/coupling.py +447 -225
- vortex/nwp/algo/eda.py +437 -229
- vortex/nwp/algo/eps.py +403 -231
- vortex/nwp/algo/forecasts.py +416 -275
- vortex/nwp/algo/fpserver.py +683 -307
- vortex/nwp/algo/ifsnaming.py +205 -145
- vortex/nwp/algo/ifsroot.py +215 -122
- vortex/nwp/algo/monitoring.py +137 -76
- vortex/nwp/algo/mpitools.py +330 -190
- vortex/nwp/algo/odbtools.py +637 -353
- vortex/nwp/algo/oopsroot.py +454 -273
- vortex/nwp/algo/oopstests.py +90 -56
- vortex/nwp/algo/request.py +287 -206
- vortex/nwp/algo/stdpost.py +878 -522
- vortex/nwp/data/__init__.py +22 -4
- vortex/nwp/data/assim.py +125 -137
- vortex/nwp/data/boundaries.py +121 -68
- vortex/nwp/data/climfiles.py +193 -211
- vortex/nwp/data/configfiles.py +73 -69
- vortex/nwp/data/consts.py +426 -401
- vortex/nwp/data/ctpini.py +59 -43
- vortex/nwp/data/diagnostics.py +94 -66
- vortex/nwp/data/eda.py +50 -51
- vortex/nwp/data/eps.py +195 -146
- vortex/nwp/data/executables.py +440 -434
- vortex/nwp/data/fields.py +63 -48
- vortex/nwp/data/gridfiles.py +183 -111
- vortex/nwp/data/logs.py +250 -217
- vortex/nwp/data/modelstates.py +180 -151
- vortex/nwp/data/monitoring.py +72 -99
- vortex/nwp/data/namelists.py +254 -202
- vortex/nwp/data/obs.py +400 -308
- vortex/nwp/data/oopsexec.py +22 -20
- vortex/nwp/data/providers.py +90 -65
- vortex/nwp/data/query.py +71 -82
- vortex/nwp/data/stores.py +49 -36
- vortex/nwp/data/surfex.py +136 -137
- vortex/nwp/syntax/__init__.py +1 -1
- vortex/nwp/syntax/stdattrs.py +173 -111
- vortex/nwp/tools/__init__.py +2 -2
- vortex/nwp/tools/addons.py +22 -17
- vortex/nwp/tools/agt.py +24 -12
- vortex/nwp/tools/bdap.py +16 -5
- vortex/nwp/tools/bdcp.py +4 -1
- vortex/nwp/tools/bdm.py +3 -0
- vortex/nwp/tools/bdmp.py +14 -9
- vortex/nwp/tools/conftools.py +728 -378
- vortex/nwp/tools/drhook.py +12 -8
- vortex/nwp/tools/grib.py +65 -39
- vortex/nwp/tools/gribdiff.py +22 -17
- vortex/nwp/tools/ifstools.py +82 -42
- vortex/nwp/tools/igastuff.py +167 -143
- vortex/nwp/tools/mars.py +14 -2
- vortex/nwp/tools/odb.py +234 -125
- vortex/nwp/tools/partitioning.py +61 -37
- vortex/nwp/tools/satrad.py +27 -12
- vortex/nwp/util/async.py +83 -55
- vortex/nwp/util/beacon.py +10 -10
- vortex/nwp/util/diffpygram.py +174 -86
- vortex/nwp/util/ens.py +144 -63
- vortex/nwp/util/hooks.py +30 -19
- vortex/nwp/util/taskdeco.py +28 -24
- vortex/nwp/util/usepygram.py +278 -172
- vortex/nwp/util/usetnt.py +31 -17
- vortex/sessions.py +72 -39
- vortex/syntax/__init__.py +1 -1
- vortex/syntax/stdattrs.py +410 -171
- vortex/syntax/stddeco.py +31 -22
- vortex/toolbox.py +327 -192
- vortex/tools/__init__.py +11 -2
- vortex/tools/actions.py +110 -121
- vortex/tools/addons.py +111 -92
- vortex/tools/arm.py +42 -22
- vortex/tools/compression.py +72 -69
- vortex/tools/date.py +11 -4
- vortex/tools/delayedactions.py +242 -132
- vortex/tools/env.py +75 -47
- vortex/tools/folder.py +342 -171
- vortex/tools/grib.py +341 -162
- vortex/tools/lfi.py +423 -216
- vortex/tools/listings.py +109 -40
- vortex/tools/names.py +218 -156
- vortex/tools/net.py +655 -299
- vortex/tools/parallelism.py +93 -61
- vortex/tools/prestaging.py +55 -31
- vortex/tools/schedulers.py +172 -105
- vortex/tools/services.py +403 -334
- vortex/tools/storage.py +293 -358
- vortex/tools/surfex.py +24 -24
- vortex/tools/systems.py +1234 -643
- vortex/tools/targets.py +156 -100
- vortex/util/__init__.py +1 -1
- vortex/util/config.py +378 -327
- vortex/util/empty.py +2 -2
- vortex/util/helpers.py +56 -24
- vortex/util/introspection.py +18 -12
- vortex/util/iosponge.py +8 -4
- vortex/util/roles.py +4 -6
- vortex/util/storefunctions.py +39 -13
- vortex/util/structs.py +3 -3
- vortex/util/worker.py +29 -17
- vortex_nwp-2.1.0.dist-info/METADATA +67 -0
- vortex_nwp-2.1.0.dist-info/RECORD +144 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/WHEEL +1 -1
- vortex/layout/appconf.py +0 -109
- vortex/layout/jobs.py +0 -1276
- vortex/layout/nodes.py +0 -1424
- vortex/layout/subjobs.py +0 -464
- vortex_nwp-2.0.0b1.dist-info/METADATA +0 -50
- vortex_nwp-2.0.0b1.dist-info/RECORD +0 -146
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info/licenses}/LICENSE +0 -0
- {vortex_nwp-2.0.0b1.dist-info → vortex_nwp-2.1.0.dist-info}/top_level.txt +0 -0
vortex/nwp/data/logs.py
CHANGED
|
@@ -24,77 +24,84 @@ class FlowLogsStack(Resource):
|
|
|
24
24
|
date_deco,
|
|
25
25
|
cutoff_deco,
|
|
26
26
|
dict(
|
|
27
|
-
info
|
|
28
|
-
attr
|
|
29
|
-
kind
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
default
|
|
27
|
+
info="Stack of miscellaneous log files.",
|
|
28
|
+
attr=dict(
|
|
29
|
+
kind=dict(values=["flow_logs"]),
|
|
30
|
+
nativefmt=dict(
|
|
31
|
+
values=[
|
|
32
|
+
"filespack",
|
|
33
|
+
],
|
|
34
|
+
default="filespack",
|
|
35
35
|
),
|
|
36
36
|
),
|
|
37
|
-
)
|
|
37
|
+
),
|
|
38
38
|
]
|
|
39
39
|
|
|
40
40
|
@property
|
|
41
41
|
def realkind(self):
|
|
42
|
-
return
|
|
42
|
+
return "flow_logs"
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
def use_flow_logs_stack(cls):
|
|
46
46
|
"""Setup the decorated class to work with the FlowLogsStack resource."""
|
|
47
47
|
fpattrs = set(cls.footprint_retrieve().attr.keys())
|
|
48
|
-
fpcheck = all([k in fpattrs for k in (
|
|
48
|
+
fpcheck = all([k in fpattrs for k in ("date", "cutoff")])
|
|
49
49
|
if not fpcheck:
|
|
50
|
-
raise ImportError(
|
|
51
|
-
|
|
50
|
+
raise ImportError(
|
|
51
|
+
'The "{!s}" class is not compatible with the FlowLogsStack class.'.format(
|
|
52
|
+
cls
|
|
53
|
+
)
|
|
54
|
+
)
|
|
52
55
|
|
|
53
56
|
def stackedstorage_resource(self):
|
|
54
57
|
"""Use the FlowLogsStack resource for stacked storage."""
|
|
55
|
-
return FlowLogsStack(
|
|
58
|
+
return FlowLogsStack(
|
|
59
|
+
kind="flow_logs", date=self.date, cutoff=self.cutoff
|
|
60
|
+
), False
|
|
56
61
|
|
|
57
62
|
cls.stackedstorage_resource = stackedstorage_resource
|
|
58
63
|
return cls
|
|
59
64
|
|
|
60
65
|
|
|
61
66
|
@use_flow_logs_stack
|
|
62
|
-
@namebuilding_insert(
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
@namebuilding_insert(
|
|
68
|
+
"src",
|
|
69
|
+
lambda s: [
|
|
70
|
+
s.binary,
|
|
71
|
+
"-".join(s.task.split("/")[s.task_start : s.task_stop]),
|
|
72
|
+
],
|
|
73
|
+
)
|
|
74
|
+
@namebuilding_insert("compute", lambda s: s.part)
|
|
75
|
+
@namebuilding_delete("fmt")
|
|
65
76
|
class Listing(FlowResource):
|
|
66
77
|
"""Miscellaneous application output from a task processing."""
|
|
78
|
+
|
|
67
79
|
_footprint = [
|
|
68
80
|
dict(
|
|
69
|
-
info
|
|
70
|
-
attr
|
|
71
|
-
task
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
optional = True,
|
|
94
|
-
default = '[model]',
|
|
95
|
-
),
|
|
96
|
-
clscontents = dict(
|
|
97
|
-
default = FormatAdapter,
|
|
81
|
+
info="Listing",
|
|
82
|
+
attr=dict(
|
|
83
|
+
task=dict(optional=True, default="anonymous"),
|
|
84
|
+
task_start=dict(
|
|
85
|
+
optional=True,
|
|
86
|
+
type=int,
|
|
87
|
+
default=-1,
|
|
88
|
+
),
|
|
89
|
+
task_stop=dict(
|
|
90
|
+
optional=True,
|
|
91
|
+
type=int,
|
|
92
|
+
default=None,
|
|
93
|
+
),
|
|
94
|
+
kind=dict(values=["listing"]),
|
|
95
|
+
part=dict(
|
|
96
|
+
optional=True,
|
|
97
|
+
default="all",
|
|
98
|
+
),
|
|
99
|
+
binary=dict(
|
|
100
|
+
optional=True,
|
|
101
|
+
default="[model]",
|
|
102
|
+
),
|
|
103
|
+
clscontents=dict(
|
|
104
|
+
default=FormatAdapter,
|
|
98
105
|
),
|
|
99
106
|
),
|
|
100
107
|
)
|
|
@@ -102,11 +109,11 @@ class Listing(FlowResource):
|
|
|
102
109
|
|
|
103
110
|
@property
|
|
104
111
|
def realkind(self):
|
|
105
|
-
return
|
|
112
|
+
return "listing"
|
|
106
113
|
|
|
107
114
|
def olive_basename(self):
|
|
108
115
|
"""Fake basename for getting olive listings"""
|
|
109
|
-
if hasattr(self,
|
|
116
|
+
if hasattr(self, "_listingpath"):
|
|
110
117
|
return self._listingpath
|
|
111
118
|
else:
|
|
112
119
|
return "NOT_IMPLEMENTED"
|
|
@@ -117,39 +124,40 @@ class Listing(FlowResource):
|
|
|
117
124
|
|
|
118
125
|
class ParallelListing(Listing):
|
|
119
126
|
"""Multi output for parallel MPI and/or OpenMP processing."""
|
|
127
|
+
|
|
120
128
|
_footprint = [
|
|
121
129
|
dict(
|
|
122
|
-
attr
|
|
123
|
-
kind
|
|
124
|
-
values
|
|
125
|
-
remap
|
|
126
|
-
listing
|
|
127
|
-
mlisting
|
|
128
|
-
)
|
|
129
|
-
),
|
|
130
|
-
mpi
|
|
131
|
-
optional
|
|
132
|
-
default
|
|
133
|
-
type
|
|
134
|
-
args
|
|
135
|
-
),
|
|
136
|
-
openmp
|
|
137
|
-
optional
|
|
138
|
-
default
|
|
139
|
-
type
|
|
140
|
-
args
|
|
141
|
-
),
|
|
142
|
-
seta
|
|
143
|
-
optional
|
|
144
|
-
default
|
|
145
|
-
type
|
|
146
|
-
args
|
|
147
|
-
),
|
|
148
|
-
setb
|
|
149
|
-
optional
|
|
150
|
-
default
|
|
151
|
-
type
|
|
152
|
-
args
|
|
130
|
+
attr=dict(
|
|
131
|
+
kind=dict(
|
|
132
|
+
values=["listing", "plisting", "mlisting"],
|
|
133
|
+
remap=dict(
|
|
134
|
+
listing="plisting",
|
|
135
|
+
mlisting="plisting",
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
mpi=dict(
|
|
139
|
+
optional=True,
|
|
140
|
+
default=None,
|
|
141
|
+
type=FmtInt,
|
|
142
|
+
args=dict(fmt="03"),
|
|
143
|
+
),
|
|
144
|
+
openmp=dict(
|
|
145
|
+
optional=True,
|
|
146
|
+
default=None,
|
|
147
|
+
type=FmtInt,
|
|
148
|
+
args=dict(fmt="02"),
|
|
149
|
+
),
|
|
150
|
+
seta=dict(
|
|
151
|
+
optional=True,
|
|
152
|
+
default=None,
|
|
153
|
+
type=FmtInt,
|
|
154
|
+
args=dict(fmt="03"),
|
|
155
|
+
),
|
|
156
|
+
setb=dict(
|
|
157
|
+
optional=True,
|
|
158
|
+
default=None,
|
|
159
|
+
type=FmtInt,
|
|
160
|
+
args=dict(fmt="02"),
|
|
153
161
|
),
|
|
154
162
|
)
|
|
155
163
|
)
|
|
@@ -159,38 +167,34 @@ class ParallelListing(Listing):
|
|
|
159
167
|
"""From base information of ``listing`` add mpi and openmp values."""
|
|
160
168
|
info = super().namebuilding_info()
|
|
161
169
|
if self.mpi and self.openmp:
|
|
162
|
-
info[
|
|
170
|
+
info["compute"] = [{"mpi": self.mpi}, {"openmp": self.openmp}]
|
|
163
171
|
if self.seta and self.setb:
|
|
164
|
-
info[
|
|
172
|
+
info["compute"] = [{"seta": self.seta}, {"setb": self.setb}]
|
|
165
173
|
return info
|
|
166
174
|
|
|
167
175
|
|
|
168
|
-
@namebuilding_insert(
|
|
169
|
-
@namebuilding_insert(
|
|
170
|
-
@namebuilding_delete(
|
|
176
|
+
@namebuilding_insert("src", lambda s: [s.binary, s.task.split("/").pop()])
|
|
177
|
+
@namebuilding_insert("compute", lambda s: s.part)
|
|
178
|
+
@namebuilding_delete("fmt")
|
|
171
179
|
class StaticListing(Resource):
|
|
172
180
|
"""Miscelanous application output from a task processing, out-of-flow."""
|
|
181
|
+
|
|
173
182
|
_footprint = [
|
|
174
183
|
dict(
|
|
175
|
-
info
|
|
176
|
-
attr
|
|
177
|
-
task
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
values = ['staticlisting']
|
|
183
|
-
),
|
|
184
|
-
part = dict(
|
|
185
|
-
optional = True,
|
|
186
|
-
default = 'all',
|
|
184
|
+
info="Listing",
|
|
185
|
+
attr=dict(
|
|
186
|
+
task=dict(optional=True, default="anonymous"),
|
|
187
|
+
kind=dict(values=["staticlisting"]),
|
|
188
|
+
part=dict(
|
|
189
|
+
optional=True,
|
|
190
|
+
default="all",
|
|
187
191
|
),
|
|
188
|
-
binary
|
|
189
|
-
optional
|
|
190
|
-
default
|
|
192
|
+
binary=dict(
|
|
193
|
+
optional=True,
|
|
194
|
+
default="[model]",
|
|
191
195
|
),
|
|
192
|
-
clscontents
|
|
193
|
-
default
|
|
196
|
+
clscontents=dict(
|
|
197
|
+
default=FormatAdapter,
|
|
194
198
|
),
|
|
195
199
|
),
|
|
196
200
|
)
|
|
@@ -198,23 +202,33 @@ class StaticListing(Resource):
|
|
|
198
202
|
|
|
199
203
|
@property
|
|
200
204
|
def realkind(self):
|
|
201
|
-
return
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
@namebuilding_insert(
|
|
205
|
-
|
|
205
|
+
return "staticlisting"
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@namebuilding_insert(
|
|
209
|
+
"compute",
|
|
210
|
+
lambda s: None
|
|
211
|
+
if s.mpi is None
|
|
212
|
+
else [
|
|
213
|
+
{"mpi": s.mpi},
|
|
214
|
+
],
|
|
215
|
+
none_discard=True,
|
|
216
|
+
)
|
|
206
217
|
class DrHookListing(Listing):
|
|
207
218
|
"""Output produced by DrHook"""
|
|
219
|
+
|
|
208
220
|
_footprint = [
|
|
209
221
|
dict(
|
|
210
|
-
attr
|
|
211
|
-
kind
|
|
212
|
-
values
|
|
222
|
+
attr=dict(
|
|
223
|
+
kind=dict(
|
|
224
|
+
values=[
|
|
225
|
+
"drhook",
|
|
226
|
+
],
|
|
213
227
|
),
|
|
214
|
-
mpi
|
|
215
|
-
optional
|
|
216
|
-
type
|
|
217
|
-
args
|
|
228
|
+
mpi=dict(
|
|
229
|
+
optional=True,
|
|
230
|
+
type=FmtInt,
|
|
231
|
+
args=dict(fmt="03"),
|
|
218
232
|
),
|
|
219
233
|
)
|
|
220
234
|
)
|
|
@@ -222,116 +236,107 @@ class DrHookListing(Listing):
|
|
|
222
236
|
|
|
223
237
|
@property
|
|
224
238
|
def realkind(self):
|
|
225
|
-
return
|
|
239
|
+
return "drhookprof"
|
|
226
240
|
|
|
227
241
|
|
|
228
242
|
@use_flow_logs_stack
|
|
229
243
|
class Beacon(FlowResource):
|
|
230
244
|
"""Output indicating the end of a model run."""
|
|
245
|
+
|
|
231
246
|
_footprint = [
|
|
232
247
|
dict(
|
|
233
|
-
info
|
|
234
|
-
attr
|
|
235
|
-
kind
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
clscontents = dict(
|
|
239
|
-
default = JsonDictContent,
|
|
248
|
+
info="Beacon",
|
|
249
|
+
attr=dict(
|
|
250
|
+
kind=dict(values=["beacon"]),
|
|
251
|
+
clscontents=dict(
|
|
252
|
+
default=JsonDictContent,
|
|
240
253
|
),
|
|
241
|
-
nativefmt
|
|
242
|
-
default
|
|
254
|
+
nativefmt=dict(
|
|
255
|
+
default="json",
|
|
243
256
|
),
|
|
244
|
-
)
|
|
257
|
+
),
|
|
245
258
|
)
|
|
246
259
|
]
|
|
247
260
|
|
|
248
261
|
@property
|
|
249
262
|
def realkind(self):
|
|
250
|
-
return
|
|
263
|
+
return "beacon"
|
|
251
264
|
|
|
252
265
|
|
|
253
266
|
@use_flow_logs_stack
|
|
254
|
-
@namebuilding_insert(
|
|
255
|
-
@namebuilding_insert(
|
|
267
|
+
@namebuilding_insert("src", lambda s: s.task.split("/").pop())
|
|
268
|
+
@namebuilding_insert("compute", lambda s: s.scope)
|
|
256
269
|
class TaskInfo(FlowResource):
|
|
257
270
|
"""Task informations."""
|
|
271
|
+
|
|
258
272
|
_footprint = [
|
|
259
273
|
dict(
|
|
260
|
-
info
|
|
261
|
-
attr
|
|
262
|
-
task
|
|
263
|
-
|
|
264
|
-
|
|
274
|
+
info="Task informations",
|
|
275
|
+
attr=dict(
|
|
276
|
+
task=dict(optional=True, default="anonymous"),
|
|
277
|
+
kind=dict(values=["taskinfo"]),
|
|
278
|
+
scope=dict(
|
|
279
|
+
optional=True,
|
|
280
|
+
default="void",
|
|
265
281
|
),
|
|
266
|
-
|
|
267
|
-
|
|
282
|
+
clscontents=dict(
|
|
283
|
+
default=JsonDictContent,
|
|
268
284
|
),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
default = 'void',
|
|
285
|
+
nativefmt=dict(
|
|
286
|
+
default="json",
|
|
272
287
|
),
|
|
273
|
-
|
|
274
|
-
default = JsonDictContent,
|
|
275
|
-
),
|
|
276
|
-
nativefmt = dict(
|
|
277
|
-
default = 'json',
|
|
278
|
-
),
|
|
279
|
-
)
|
|
288
|
+
),
|
|
280
289
|
)
|
|
281
290
|
]
|
|
282
291
|
|
|
283
292
|
@property
|
|
284
293
|
def realkind(self):
|
|
285
|
-
return
|
|
294
|
+
return "taskinfo"
|
|
286
295
|
|
|
287
296
|
|
|
288
|
-
@namebuilding_insert(
|
|
289
|
-
@namebuilding_insert(
|
|
290
|
-
@namebuilding_delete(
|
|
297
|
+
@namebuilding_insert("src", lambda s: s.task.split("/").pop())
|
|
298
|
+
@namebuilding_insert("compute", lambda s: s.scope)
|
|
299
|
+
@namebuilding_delete("fmt")
|
|
291
300
|
class StaticTaskInfo(Resource):
|
|
292
301
|
"""Task informations."""
|
|
302
|
+
|
|
293
303
|
_footprint = [
|
|
294
304
|
dict(
|
|
295
|
-
info
|
|
296
|
-
attr
|
|
297
|
-
task
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
info="Task informations",
|
|
306
|
+
attr=dict(
|
|
307
|
+
task=dict(optional=True, default="anonymous"),
|
|
308
|
+
kind=dict(values=["statictaskinfo"]),
|
|
309
|
+
scope=dict(
|
|
310
|
+
optional=True,
|
|
311
|
+
default="void",
|
|
300
312
|
),
|
|
301
|
-
|
|
302
|
-
|
|
313
|
+
clscontents=dict(
|
|
314
|
+
default=JsonDictContent,
|
|
303
315
|
),
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
default = 'void',
|
|
316
|
+
nativefmt=dict(
|
|
317
|
+
default="json",
|
|
307
318
|
),
|
|
308
|
-
|
|
309
|
-
default = JsonDictContent,
|
|
310
|
-
),
|
|
311
|
-
nativefmt = dict(
|
|
312
|
-
default = 'json',
|
|
313
|
-
),
|
|
314
|
-
)
|
|
319
|
+
),
|
|
315
320
|
)
|
|
316
321
|
]
|
|
317
322
|
|
|
318
323
|
@property
|
|
319
324
|
def realkind(self):
|
|
320
|
-
return
|
|
325
|
+
return "statictaskinfo"
|
|
321
326
|
|
|
322
327
|
|
|
323
328
|
class SectionsSlice(collections.abc.Sequence):
|
|
324
329
|
"""Hold a list of dictionaries representing Sections."""
|
|
325
330
|
|
|
326
|
-
_INDEX_PREFIX =
|
|
327
|
-
_INDEX_ATTR =
|
|
331
|
+
_INDEX_PREFIX = "sslice"
|
|
332
|
+
_INDEX_ATTR = "sliceindex"
|
|
328
333
|
|
|
329
334
|
def __init__(self, sequence):
|
|
330
335
|
self._data = sequence
|
|
331
336
|
|
|
332
337
|
def __getitem__(self, i):
|
|
333
338
|
if isinstance(i, str) and i.startswith(self._INDEX_PREFIX):
|
|
334
|
-
i = int(i[len(self._INDEX_PREFIX):])
|
|
339
|
+
i = int(i[len(self._INDEX_PREFIX) :])
|
|
335
340
|
return self._data[i]
|
|
336
341
|
|
|
337
342
|
def __eq__(self, other):
|
|
@@ -361,23 +366,26 @@ class SectionsSlice(collections.abc.Sequence):
|
|
|
361
366
|
'resource', 'provider' and 'container' parts of the 'rh'sub-dictionary
|
|
362
367
|
are also looked for.
|
|
363
368
|
"""
|
|
364
|
-
if k ==
|
|
365
|
-
return item[k] or item[
|
|
366
|
-
elif k ==
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
return item[
|
|
369
|
+
if k == "role":
|
|
370
|
+
return item[k] or item["alternate"]
|
|
371
|
+
elif k == "kind" and k in item.get("rh", dict()).get(
|
|
372
|
+
"resource", dict()
|
|
373
|
+
):
|
|
374
|
+
return item["rh"]["resource"][k]
|
|
375
|
+
elif k == "section_kind" and "kind" in item:
|
|
376
|
+
return item["kind"]
|
|
370
377
|
elif k in item:
|
|
371
378
|
return item[k]
|
|
372
|
-
elif k in item.get(
|
|
373
|
-
return item[
|
|
374
|
-
elif k in item.get(
|
|
375
|
-
return item[
|
|
376
|
-
elif k in item.get(
|
|
377
|
-
return item[
|
|
379
|
+
elif k in item.get("rh", dict()).get("resource", dict()):
|
|
380
|
+
return item["rh"]["resource"][k]
|
|
381
|
+
elif k in item.get("rh", dict()).get("provider", dict()):
|
|
382
|
+
return item["rh"]["provider"][k]
|
|
383
|
+
elif k in item.get("rh", dict()).get("container", dict()):
|
|
384
|
+
return item["rh"]["container"][k]
|
|
378
385
|
else:
|
|
379
|
-
raise KeyError(
|
|
380
|
-
|
|
386
|
+
raise KeyError(
|
|
387
|
+
"'{:s}' wasn't found in the designated dictionary".format(k)
|
|
388
|
+
)
|
|
381
389
|
|
|
382
390
|
@staticmethod
|
|
383
391
|
def _sloppy_compare(json_v, v):
|
|
@@ -398,20 +406,22 @@ class SectionsSlice(collections.abc.Sequence):
|
|
|
398
406
|
|
|
399
407
|
def _sloppy_ckeck(self, item, k, v, extras):
|
|
400
408
|
"""Perform a _sloppy_lookup and check the result against *v*."""
|
|
401
|
-
if k in (
|
|
409
|
+
if k in ("role", "alternate"):
|
|
402
410
|
v = setrole(v)
|
|
403
411
|
try:
|
|
404
|
-
if k ==
|
|
405
|
-
found = self._sloppy_lookup(item,
|
|
406
|
-
foundbis = self._sloppy_lookup(item,
|
|
412
|
+
if k == "baseterm":
|
|
413
|
+
found = self._sloppy_lookup(item, "term")
|
|
414
|
+
foundbis = self._sloppy_lookup(item, "date")
|
|
407
415
|
else:
|
|
408
416
|
found = self._sloppy_lookup(item, k)
|
|
409
417
|
except KeyError:
|
|
410
418
|
return False
|
|
411
419
|
if not isinstance(v, (list, tuple, set)):
|
|
412
|
-
v = [
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
v = [
|
|
421
|
+
v,
|
|
422
|
+
]
|
|
423
|
+
if k == "baseterm" and extras.get("basedate", None):
|
|
424
|
+
delta = Date(extras["basedate"]) - Date(foundbis)
|
|
415
425
|
found = Time(found) - delta
|
|
416
426
|
return any([self._sloppy_compare(found, a_v) for a_v in v])
|
|
417
427
|
|
|
@@ -423,10 +433,17 @@ class SectionsSlice(collections.abc.Sequence):
|
|
|
423
433
|
>>> self.filter(role='Guess', member=1)
|
|
424
434
|
"""
|
|
425
435
|
extras = dict()
|
|
426
|
-
extras[
|
|
427
|
-
newslice = [
|
|
428
|
-
|
|
429
|
-
|
|
436
|
+
extras["basedate"] = kwargs.pop("basedate", None)
|
|
437
|
+
newslice = [
|
|
438
|
+
s
|
|
439
|
+
for s in self
|
|
440
|
+
if all(
|
|
441
|
+
[
|
|
442
|
+
self._sloppy_ckeck(s, k, v, extras)
|
|
443
|
+
for k, v in kwargs.items()
|
|
444
|
+
]
|
|
445
|
+
)
|
|
446
|
+
]
|
|
430
447
|
return self.__class__(newslice)
|
|
431
448
|
|
|
432
449
|
def uniquefilter(self, **kwargs):
|
|
@@ -442,7 +459,9 @@ class SectionsSlice(collections.abc.Sequence):
|
|
|
442
459
|
@property
|
|
443
460
|
def indexes(self):
|
|
444
461
|
"""Returns an index list of all the element contained if the present object."""
|
|
445
|
-
return [
|
|
462
|
+
return [
|
|
463
|
+
self._INDEX_PREFIX + "{:d}".format(i) for i in range(len(self))
|
|
464
|
+
]
|
|
446
465
|
|
|
447
466
|
def __deepcopy__(self, memo):
|
|
448
467
|
newslice = self.__class__(self._data)
|
|
@@ -465,27 +484,40 @@ class SectionsSlice(collections.abc.Sequence):
|
|
|
465
484
|
be generated using the :meth:`indexes` property), the corresponding element
|
|
466
485
|
will be searched using :meth:`_sloppy_lookup`.
|
|
467
486
|
""".format(idx_attr=self._INDEX_ATTR)
|
|
468
|
-
if attr.startswith(
|
|
487
|
+
if attr.startswith("__"):
|
|
469
488
|
raise AttributeError(attr)
|
|
470
489
|
if len(self) == 1:
|
|
471
490
|
try:
|
|
472
491
|
return self._sloppy_lookup(self[0], attr)
|
|
473
492
|
except KeyError:
|
|
474
|
-
raise AttributeError(
|
|
475
|
-
|
|
493
|
+
raise AttributeError(
|
|
494
|
+
"'{:s}' wasn't found in the unique dictionary".format(attr)
|
|
495
|
+
)
|
|
476
496
|
elif len(self) == 0:
|
|
477
|
-
raise AttributeError(
|
|
497
|
+
raise AttributeError(
|
|
498
|
+
"The current SectionsSlice is empty. No attribute lookup allowed !"
|
|
499
|
+
)
|
|
478
500
|
else:
|
|
501
|
+
|
|
479
502
|
def _attr_lookup(g, x):
|
|
480
|
-
if len(self) > 1 and (
|
|
503
|
+
if len(self) > 1 and (
|
|
504
|
+
self._INDEX_ATTR in g or self._INDEX_ATTR in x
|
|
505
|
+
):
|
|
481
506
|
idx = g.get(self._INDEX_ATTR, x.get(self._INDEX_ATTR))
|
|
482
507
|
try:
|
|
483
508
|
return self._sloppy_lookup(self[idx], attr)
|
|
484
509
|
except KeyError:
|
|
485
|
-
raise AttributeError(
|
|
486
|
-
|
|
510
|
+
raise AttributeError(
|
|
511
|
+
"'{:s}' wasn't found in the {!s}-th dictionary".format(
|
|
512
|
+
attr, idx
|
|
513
|
+
)
|
|
514
|
+
)
|
|
487
515
|
else:
|
|
488
|
-
raise AttributeError(
|
|
516
|
+
raise AttributeError(
|
|
517
|
+
"A '{:s}' attribute must be there !".format(
|
|
518
|
+
self._INDEX_ATTR
|
|
519
|
+
)
|
|
520
|
+
)
|
|
489
521
|
|
|
490
522
|
return _attr_lookup
|
|
491
523
|
|
|
@@ -518,7 +550,7 @@ class SectionsJsonListContent(DataContent):
|
|
|
518
550
|
|
|
519
551
|
|
|
520
552
|
@use_flow_logs_stack
|
|
521
|
-
@namebuilding_insert(
|
|
553
|
+
@namebuilding_insert("src", lambda s: s.task.split("/").pop())
|
|
522
554
|
class SectionsList(FlowResource):
|
|
523
555
|
"""Class to handle a resource that contains a list of Sections in JSON format.
|
|
524
556
|
|
|
@@ -527,23 +559,24 @@ class SectionsList(FlowResource):
|
|
|
527
559
|
"""
|
|
528
560
|
|
|
529
561
|
_footprint = dict(
|
|
530
|
-
info
|
|
531
|
-
attr
|
|
562
|
+
info="A Sections List",
|
|
563
|
+
attr=dict(
|
|
532
564
|
kind=dict(
|
|
533
|
-
values=[
|
|
565
|
+
values=[
|
|
566
|
+
"sectionslist",
|
|
567
|
+
],
|
|
534
568
|
),
|
|
535
|
-
task
|
|
536
|
-
|
|
537
|
-
default
|
|
569
|
+
task=dict(optional=True, default="anonymous"),
|
|
570
|
+
clscontents=dict(
|
|
571
|
+
default=SectionsJsonListContent,
|
|
538
572
|
),
|
|
539
|
-
|
|
540
|
-
|
|
573
|
+
nativefmt=dict(
|
|
574
|
+
values=[
|
|
575
|
+
"json",
|
|
576
|
+
],
|
|
577
|
+
default="json",
|
|
541
578
|
),
|
|
542
|
-
|
|
543
|
-
values = ['json', ],
|
|
544
|
-
default = 'json',
|
|
545
|
-
)
|
|
546
|
-
)
|
|
579
|
+
),
|
|
547
580
|
)
|
|
548
581
|
|
|
549
582
|
@property
|