hcs-core 0.1.285__py3-none-any.whl → 0.1.286__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.
- hcs_core/__init__.py +1 -1
- hcs_core/plan/core.py +4 -4
- hcs_core/plan/dag.py +7 -7
- hcs_core/plan/kop.py +18 -6
- {hcs_core-0.1.285.dist-info → hcs_core-0.1.286.dist-info}/METADATA +1 -1
- {hcs_core-0.1.285.dist-info → hcs_core-0.1.286.dist-info}/RECORD +7 -7
- {hcs_core-0.1.285.dist-info → hcs_core-0.1.286.dist-info}/WHEEL +0 -0
hcs_core/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.286"
|
hcs_core/plan/core.py
CHANGED
|
@@ -127,7 +127,7 @@ def apply(
|
|
|
127
127
|
dag.process_blueprint(
|
|
128
128
|
blueprint=blueprint,
|
|
129
129
|
fn_process_node=process_resource_node,
|
|
130
|
-
|
|
130
|
+
fail_fast=True,
|
|
131
131
|
reverse=False,
|
|
132
132
|
concurrency=concurrency,
|
|
133
133
|
target_node_name=target_resource_name,
|
|
@@ -524,7 +524,7 @@ def _destroy_res(name, res_node, state, force):
|
|
|
524
524
|
|
|
525
525
|
def destroy(
|
|
526
526
|
data,
|
|
527
|
-
|
|
527
|
+
fail_fast: bool,
|
|
528
528
|
target_resource_name: str = None,
|
|
529
529
|
include_dependencies: bool = True,
|
|
530
530
|
concurrency: int = 4,
|
|
@@ -542,7 +542,7 @@ def destroy(
|
|
|
542
542
|
if not node:
|
|
543
543
|
return dag.walker.next
|
|
544
544
|
|
|
545
|
-
_destroy_res(node_name, node, state,
|
|
545
|
+
_destroy_res(node_name, node, state, fail_fast)
|
|
546
546
|
data_util.save_data_file(state, state_file)
|
|
547
547
|
return dag.walker.next
|
|
548
548
|
|
|
@@ -550,7 +550,7 @@ def destroy(
|
|
|
550
550
|
dag.process_blueprint(
|
|
551
551
|
blueprint=blueprint,
|
|
552
552
|
fn_process_node=destroy_resource,
|
|
553
|
-
|
|
553
|
+
fail_fast=fail_fast,
|
|
554
554
|
reverse=True,
|
|
555
555
|
concurrency=concurrency,
|
|
556
556
|
target_node_name=target_resource_name,
|
hcs_core/plan/dag.py
CHANGED
|
@@ -72,7 +72,7 @@ class DAG:
|
|
|
72
72
|
def process_blueprint(
|
|
73
73
|
blueprint,
|
|
74
74
|
fn_process_node: Callable,
|
|
75
|
-
|
|
75
|
+
fail_fast: bool = False,
|
|
76
76
|
reverse: bool = False,
|
|
77
77
|
concurrency: int = 3,
|
|
78
78
|
target_node_name: str = None,
|
|
@@ -88,7 +88,7 @@ def process_blueprint(
|
|
|
88
88
|
return walker.next
|
|
89
89
|
return fn_process_node(name)
|
|
90
90
|
|
|
91
|
-
return _walkthrough(dag, fn_process_node_impl,
|
|
91
|
+
return _walkthrough(dag, fn_process_node_impl, fail_fast, concurrency)
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
def _filter_dag_by_target_node(dag: DAG, target_node_name, include_dependencies):
|
|
@@ -225,7 +225,7 @@ def _get_provider_id(node_data):
|
|
|
225
225
|
return provider_type
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
def _walkthrough(dag: DAG, fn_process_node: Callable,
|
|
228
|
+
def _walkthrough(dag: DAG, fn_process_node: Callable, fail_fast: bool, concurrency: int):
|
|
229
229
|
topological_sorter = TopologicalSorter(dag.graph)
|
|
230
230
|
topological_sorter.prepare()
|
|
231
231
|
lock = threading.Lock()
|
|
@@ -250,10 +250,10 @@ def _walkthrough(dag: DAG, fn_process_node: Callable, continue_on_error: bool, c
|
|
|
250
250
|
except Exception as e:
|
|
251
251
|
with lock:
|
|
252
252
|
flags["err"] = e
|
|
253
|
-
if
|
|
254
|
-
topological_sorter.done(node_id)
|
|
255
|
-
else:
|
|
253
|
+
if fail_fast:
|
|
256
254
|
flag_stop.set()
|
|
255
|
+
else:
|
|
256
|
+
topological_sorter.done(node_id)
|
|
257
257
|
except SystemExit as e:
|
|
258
258
|
with lock:
|
|
259
259
|
flags["err"] = e
|
|
@@ -292,7 +292,7 @@ def _walkthrough(dag: DAG, fn_process_node: Callable, continue_on_error: bool, c
|
|
|
292
292
|
if flag_stop.is_set():
|
|
293
293
|
break
|
|
294
294
|
with lock:
|
|
295
|
-
if
|
|
295
|
+
if fail_fast and flags["err"]:
|
|
296
296
|
break
|
|
297
297
|
read_nodes = topological_sorter.get_ready()
|
|
298
298
|
if not len(read_nodes):
|
hcs_core/plan/kop.py
CHANGED
|
@@ -85,7 +85,8 @@ class KOP:
|
|
|
85
85
|
self._started = False
|
|
86
86
|
self._closed = False
|
|
87
87
|
job_id = kind + "/" + name
|
|
88
|
-
_job_view
|
|
88
|
+
if _job_view:
|
|
89
|
+
_job_view.add(job_id, job_id)
|
|
89
90
|
|
|
90
91
|
def _job_id(self):
|
|
91
92
|
return self._kind + "/" + self._name
|
|
@@ -103,7 +104,8 @@ class KOP:
|
|
|
103
104
|
|
|
104
105
|
def id(self, res_id: str):
|
|
105
106
|
self._id = res_id
|
|
106
|
-
_job_view
|
|
107
|
+
if _job_view:
|
|
108
|
+
_job_view.update(self._job_id(), res_id)
|
|
107
109
|
|
|
108
110
|
def start(self, mode: str = None, eta: str = None):
|
|
109
111
|
if self._started:
|
|
@@ -114,7 +116,8 @@ class KOP:
|
|
|
114
116
|
self._mode = mode
|
|
115
117
|
self._started = True
|
|
116
118
|
self._add_log(KopAction.start)
|
|
117
|
-
_job_view
|
|
119
|
+
if _job_view:
|
|
120
|
+
_job_view.start(self._job_id(), eta)
|
|
118
121
|
|
|
119
122
|
def _success(self):
|
|
120
123
|
if not self._started:
|
|
@@ -125,7 +128,8 @@ class KOP:
|
|
|
125
128
|
raise KopException("Kop already closed. This is a framework logging issue.")
|
|
126
129
|
self._add_log(KopAction.success)
|
|
127
130
|
self._closed = True
|
|
128
|
-
_job_view
|
|
131
|
+
if _job_view:
|
|
132
|
+
_job_view.success(self._job_id())
|
|
129
133
|
|
|
130
134
|
def error(self, err):
|
|
131
135
|
if isinstance(err, Exception):
|
|
@@ -136,12 +140,14 @@ class KOP:
|
|
|
136
140
|
details = str(err)
|
|
137
141
|
self._add_log(KopAction.error, details)
|
|
138
142
|
self._closed = True
|
|
139
|
-
_job_view
|
|
143
|
+
if _job_view:
|
|
144
|
+
_job_view.error(self._job_id(), details)
|
|
140
145
|
|
|
141
146
|
def skip(self, reason):
|
|
142
147
|
self._add_log(KopAction.skip, reason)
|
|
143
148
|
self._closed = True
|
|
144
|
-
_job_view
|
|
149
|
+
if _job_view:
|
|
150
|
+
_job_view.skip(self._job_id(), reason)
|
|
145
151
|
|
|
146
152
|
def _add_log(self, action: str, details: str = None):
|
|
147
153
|
labels = {
|
|
@@ -174,6 +180,12 @@ class KOP:
|
|
|
174
180
|
|
|
175
181
|
if _job_view == _DummyJobView:
|
|
176
182
|
log.info(msg)
|
|
183
|
+
elif _job_view is None:
|
|
184
|
+
# explicitly set by user to disable log
|
|
185
|
+
pass
|
|
186
|
+
else:
|
|
187
|
+
# custom job view
|
|
188
|
+
pass
|
|
177
189
|
entry = {"name": self._name, "time": int(time.time()), "action": action, "id": self._id}
|
|
178
190
|
if details:
|
|
179
191
|
entry["details"] = details
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
hcs_core/__init__.py,sha256=
|
|
1
|
+
hcs_core/__init__.py,sha256=4caxYscIfyoO7-Tr-p1_vW2Lv80gd26hSwPyACIAZ4E,24
|
|
2
2
|
hcs_core/ctxp/__init__.py,sha256=bHVHhJP10Luz1a3Kk3zFx14dAO4SY6Q20Lrv8rNWWGc,1075
|
|
3
3
|
hcs_core/ctxp/_init.py,sha256=yq46VOty4zs_WcLt1SrtePxbW8S4RIz4YUCP3xIBvCA,2797
|
|
4
4
|
hcs_core/ctxp/cli_options.py,sha256=g5JnzOtyWiGLCLcGp5x54MPFLW_NOfhfevXUlX5L8tM,2532
|
|
@@ -31,10 +31,10 @@ hcs_core/plan/__init__.py,sha256=-aEHqDPQd9Noqwg8bV8YBKxE9xrY25PFp2pknFXZiIc,428
|
|
|
31
31
|
hcs_core/plan/actions.py,sha256=UvCynzApJUxi39HUoPIQ_uownlbvFbJ4aAs6pmulrLY,125
|
|
32
32
|
hcs_core/plan/base_provider.py,sha256=CSJFN8lopWTUblw8CW78Epnef9BbJVLhPLk9bPfZceM,1299
|
|
33
33
|
hcs_core/plan/context.py,sha256=5NI5Otk0jGKtBGvO8Sc1xdOHUCu_lXQYNrSctT3Hyq8,116
|
|
34
|
-
hcs_core/plan/core.py,sha256=
|
|
35
|
-
hcs_core/plan/dag.py,sha256=
|
|
34
|
+
hcs_core/plan/core.py,sha256=21pSOJPcJCidQwNkLDgILaYVOElUZmc0nEwDA5itP_U,21132
|
|
35
|
+
hcs_core/plan/dag.py,sha256=pyyoMSmbhCsS8BMZI6hW6YDkHqBgjmJOwys9CUDrIts,12926
|
|
36
36
|
hcs_core/plan/helper.py,sha256=__b8tlzLBT1Rm3vgiS-pWnZImaoZbsmKSRJtt_1gj8E,7763
|
|
37
|
-
hcs_core/plan/kop.py,sha256=
|
|
37
|
+
hcs_core/plan/kop.py,sha256=rhA4L8PUqImUTLvqH94jGlh4gmFk1UElVJLjhtZP-jQ,5773
|
|
38
38
|
hcs_core/plan/provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
hcs_core/plan/provider/dev/__init__.py,sha256=WpPDB-h5z5uF2BhcRlsdeJyZxBU5dun6tCf5ZZeaTJU,30
|
|
40
40
|
hcs_core/plan/provider/dev/_prepare.py,sha256=PvVnheEQwpj8sWYz2lDONQVTs4pHPYuo2c4VD2if-hc,34
|
|
@@ -63,6 +63,6 @@ hcs_core/util/query_util.py,sha256=5bh3bUVIQuY9qerndfuyfyzkTExYJ8zD0_e3PSN7y-4,3
|
|
|
63
63
|
hcs_core/util/scheduler.py,sha256=bPpCmGUL1UctJMfLPAg-h4Hl2YZr96FiI78-G_Usn08,2958
|
|
64
64
|
hcs_core/util/ssl_util.py,sha256=MvU102fGwWWh9hhSmLnn1qQIWuD6TjZnN0iH0MXUtW0,1239
|
|
65
65
|
hcs_core/util/versions.py,sha256=wwbcYFpxBohI-QjcrmxGsNghdnx4EWHBipMUL7vnpwM,1728
|
|
66
|
-
hcs_core-0.1.
|
|
67
|
-
hcs_core-0.1.
|
|
68
|
-
hcs_core-0.1.
|
|
66
|
+
hcs_core-0.1.286.dist-info/METADATA,sha256=63rzKWPPlVxWKBrOF070LzdUMiKl7ng5Ho9A3q9cf2s,1837
|
|
67
|
+
hcs_core-0.1.286.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
68
|
+
hcs_core-0.1.286.dist-info/RECORD,,
|
|
File without changes
|