hcs-core 0.1.319__py3-none-any.whl → 0.1.321__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.319"
1
+ __version__ = "0.1.321"
hcs_core/ctxp/_init.py CHANGED
@@ -20,6 +20,7 @@ from pathlib import Path
20
20
  import click
21
21
 
22
22
  from . import cli_processor, config, profile, state, telemetry
23
+ from .util import is_program_error
23
24
 
24
25
 
25
26
  def _get_store_path():
@@ -55,7 +56,7 @@ def init(app_name: str, store_path: str = user_home, config_path: str = "./confi
55
56
 
56
57
  except Exception as e:
57
58
  # critical errors, must print stack trace.
58
- if _need_stack_trace(e):
59
+ if is_program_error(e):
59
60
  raise e
60
61
  else:
61
62
  # Other errors, no stack.
@@ -86,26 +87,10 @@ def init_cli(main_cli: click.Group, commands_dir: str = "./cmds"):
86
87
  return ret
87
88
  except BaseException as e:
88
89
  telemetry.end(error=e)
89
- if _need_stack_trace(e):
90
+
91
+ if is_program_error(e):
90
92
  raise e
91
93
  else:
92
94
  from .util import panic
93
95
 
94
96
  panic(e)
95
-
96
-
97
- def _need_stack_trace(e) -> bool:
98
- program_errors = [
99
- LookupError,
100
- TypeError,
101
- ValueError,
102
- ArithmeticError,
103
- NameError,
104
- SyntaxError,
105
- KeyError,
106
- AttributeError,
107
- ]
108
- for t in program_errors:
109
- if isinstance(e, t):
110
- return True
111
- return False
hcs_core/ctxp/util.py CHANGED
@@ -128,12 +128,30 @@ def print_output(data: Any, args: dict, file=sys.stdout):
128
128
  print(text, end="", file=file, flush=True)
129
129
 
130
130
 
131
+ def is_program_error(e: Exception) -> bool:
132
+ program_errors = [
133
+ ArithmeticError,
134
+ IndexError,
135
+ NameError,
136
+ SyntaxError,
137
+ LookupError,
138
+ KeyError,
139
+ TypeError,
140
+ AttributeError,
141
+ ValueError,
142
+ IndentationError,
143
+ ImportError,
144
+ AssertionError,
145
+ ]
146
+ for ex in program_errors:
147
+ if isinstance(e, ex):
148
+ return True
149
+ return False
150
+
151
+
131
152
  def print_error(error):
132
- critical_errors = [KeyError, TypeError, AttributeError, ValueError, IndentationError, ImportError]
133
- for ex in critical_errors:
134
- if isinstance(error, ex):
135
- traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
136
- break
153
+ if is_program_error(error):
154
+ traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
137
155
  msg = error_details(error)
138
156
  print(msg, file=sys.stderr, flush=True)
139
157
 
hcs_core/plan/core.py CHANGED
@@ -242,7 +242,8 @@ def _get_res_text(handler, res_state: dict) -> str:
242
242
  def _deploy_res(name, res, state):
243
243
  def fn_deploy1(handler, res_data: dict, res_state: dict, fn_set_state: typing.Callable, kop: KOP):
244
244
  if _is_runtime(res):
245
- kop.start(KOP.MODE.create, handler.eta("create", res_data, state))
245
+ eta = res.get("eta") or handler.eta(actions.create, res_data, state)
246
+ kop.start(KOP.MODE.create, eta)
246
247
  new_state = handler.process(res_data, deepcopy(state))
247
248
  if new_state:
248
249
  fn_set_state(new_state)
@@ -266,7 +267,8 @@ def _deploy_res(name, res, state):
266
267
 
267
268
  new_state = None
268
269
  if action == actions.create or action is None:
269
- kop.start(KOP.MODE.create, handler.eta(actions.create, res_data, res_state))
270
+ eta = res.get("eta") or handler.eta(actions.create, res_data, state)
271
+ kop.start(KOP.MODE.create, eta)
270
272
  if _has_save_state(handler.deploy):
271
273
 
272
274
  def _hook_set_state(data):
@@ -229,7 +229,7 @@ class EzClient:
229
229
 
230
230
  def get(self, url: str, headers: dict = None, raise_on_404: bool = False, type: Optional[Type[BaseModel]] = None):
231
231
  try:
232
- # print("->", self._client().base_url, url)
232
+ # print("->", str(self._client().base_url) + url)
233
233
  resp = self._client().get(url, headers=headers, follow_redirects=True)
234
234
  data = _parse_resp(resp)
235
235
  if data and type:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hcs-core
3
- Version: 0.1.319
3
+ Version: 0.1.321
4
4
  Summary: Horizon Cloud Service CLI module.
5
5
  Project-URL: Homepage, https://github.com/euc-eng/hcs-cli
6
6
  Project-URL: Bug Tracker, https://github.com/euc-eng/hcs-cli/issues
@@ -1,6 +1,6 @@
1
- hcs_core/__init__.py,sha256=W9Fz99Q0Wv3fne72V8P_I2LyTJ4mUrOkqMl0yDI2wHw,24
1
+ hcs_core/__init__.py,sha256=iXs2IMJx0ljkuqcZCqNL837J3kjahgbbvSBpJmrBzXo,24
2
2
  hcs_core/ctxp/__init__.py,sha256=bHVHhJP10Luz1a3Kk3zFx14dAO4SY6Q20Lrv8rNWWGc,1075
3
- hcs_core/ctxp/_init.py,sha256=fMcRMPfJx-N0c-u0Zj2sFVKQL1-lWQd28gooAZETGUA,2933
3
+ hcs_core/ctxp/_init.py,sha256=EY5V6LY9REjlMBPn8oBatp3pScg82wcsC2Cajx5CCVc,2636
4
4
  hcs_core/ctxp/cli_options.py,sha256=9atW8J_BiENzREhENHGRZU9lX48YmGp8JebELULO1eg,3356
5
5
  hcs_core/ctxp/cli_processor.py,sha256=-BhmODOrPDm8TNnyeOaRqiTyo1DHRkyWiFbEAeqKovM,7755
6
6
  hcs_core/ctxp/cmd_util.py,sha256=_-VwQSmkfi52qWC3uHQI06mSiIPfsZroDruTDYHXiMA,3119
@@ -22,7 +22,7 @@ hcs_core/ctxp/task_schd.py,sha256=d_vsR0j-WruW6N4iU7bMvhNvJ62jLjQKhDjWLL61agE,46
22
22
  hcs_core/ctxp/telemetry.py,sha256=7ZdOodQUiMvqRBWux2RstDD3q-iQgpeLCJT50YaZkH0,3475
23
23
  hcs_core/ctxp/template_util.py,sha256=XslvIuRBlTVsUW0Y9M_D8gUPc1jWq6X2p4At2VAe1KU,731
24
24
  hcs_core/ctxp/timeutil.py,sha256=RyRrIRdFHbIghdB8wbC8VdABvc7hki2v51b1x2JvHgo,445
25
- hcs_core/ctxp/util.py,sha256=DvqLZFpr9CJhswaxNWA9r27vTTs02IWRNLVDWy7xNgM,14532
25
+ hcs_core/ctxp/util.py,sha256=27Pd2ZFQkyGvaurxKvikcsHWW-2nWqyDodnUh-Kn504,14808
26
26
  hcs_core/ctxp/var_template.py,sha256=cTjj1UJ58ac6s5z4Oh5hSDQwKixq-rdbCF1D8akjAo0,3219
27
27
  hcs_core/ctxp/built_in_cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  hcs_core/ctxp/built_in_cmds/_ut.py,sha256=e50XBmPim2qRe0RYk_XAuRz1HWYyLJuMu-6dVxWR_fQ,3356
@@ -32,7 +32,7 @@ hcs_core/plan/__init__.py,sha256=5klVuXXLQLn2Hj6Gz2Hc-1XSyDXKE9o-BjQ82oXekiI,465
32
32
  hcs_core/plan/actions.py,sha256=UvCynzApJUxi39HUoPIQ_uownlbvFbJ4aAs6pmulrLY,125
33
33
  hcs_core/plan/base_provider.py,sha256=CSJFN8lopWTUblw8CW78Epnef9BbJVLhPLk9bPfZceM,1299
34
34
  hcs_core/plan/context.py,sha256=5NI5Otk0jGKtBGvO8Sc1xdOHUCu_lXQYNrSctT3Hyq8,116
35
- hcs_core/plan/core.py,sha256=5DWYM-ihW3D7ZjYiVBKHoyy5AyLvWmfMZnYZSiNn2qc,21621
35
+ hcs_core/plan/core.py,sha256=qk1A1HuZ9kNdmzpUdHu8aQ88MEflWrhoPoGkMTipR9U,21703
36
36
  hcs_core/plan/dag.py,sha256=McvJnOIJOQzfa1TMdG3Nvw2tV12JBhNKaeJ_Fk8iEXA,12909
37
37
  hcs_core/plan/helper.py,sha256=__b8tlzLBT1Rm3vgiS-pWnZImaoZbsmKSRJtt_1gj8E,7763
38
38
  hcs_core/plan/kop.py,sha256=iDnRbYHFCtS3Rs95UVvRgZdSzs-NMwdyr8SztIQQqyg,5774
@@ -46,7 +46,7 @@ hcs_core/sglib/auth.py,sha256=r9zgLdnybuHsf3_j6nTP4SGoS2dD3keYZ-c25o2Mx64,6766
46
46
  hcs_core/sglib/cli_options.py,sha256=GBJ59u9iWiCfJt-5F8qw_JGfMRfB-LcLeiKAQkmMh_c,2548
47
47
  hcs_core/sglib/client_util.py,sha256=XoxVRGA4MCnesi1R-jcu3zNXmuBp2cM-eH_wArPLs34,14618
48
48
  hcs_core/sglib/csp.py,sha256=UcO68YtLOPDQWiTjPVIPwQ2Z-Mywc-154aoIkLdyzwE,10991
49
- hcs_core/sglib/ez_client.py,sha256=kz136budKkOIj-xFFzaQtkrEl4BEBwyhiKWXYaT6NSQ,9686
49
+ hcs_core/sglib/ez_client.py,sha256=X6Xx1yLAO1iVcSMF7gZ4Ylj6IqOzyBiyPfOc5mAGPe4,9692
50
50
  hcs_core/sglib/hcs_client.py,sha256=pjrAVQDEy2tiQMypMpOzODFntT6aNHXjje8or_mkL2U,804
51
51
  hcs_core/sglib/init.py,sha256=w_0ZU70Q1TGbSZsqSi7ewKQqpExFlepOT7mIqH0wnho,310
52
52
  hcs_core/sglib/login_support.py,sha256=tniRhn4V5eUAgixi_FLTemzBnOrruLgvx6NsLLx3hTA,8077
@@ -64,6 +64,6 @@ hcs_core/util/query_util.py,sha256=AHTV7nRZXLL5CwK_ip1ZKub8Xvfn2C8PqjUg3UpHQEk,3
64
64
  hcs_core/util/scheduler.py,sha256=bPpCmGUL1UctJMfLPAg-h4Hl2YZr96FiI78-G_Usn08,2958
65
65
  hcs_core/util/ssl_util.py,sha256=MvU102fGwWWh9hhSmLnn1qQIWuD6TjZnN0iH0MXUtW0,1239
66
66
  hcs_core/util/versions.py,sha256=6nyyZzi3P69WQfioPc2_YWZQcUc13mC1eKoK58b3WUQ,1709
67
- hcs_core-0.1.319.dist-info/METADATA,sha256=yzhus48JO-L5JXQxmjtHoppYny0nM0mI16Q-aQIkcq0,1958
68
- hcs_core-0.1.319.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
69
- hcs_core-0.1.319.dist-info/RECORD,,
67
+ hcs_core-0.1.321.dist-info/METADATA,sha256=PpNipnISPDZxKFyrEcijqJ0AN5Rsh2smf6YymsJE5pc,1958
68
+ hcs_core-0.1.321.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
69
+ hcs_core-0.1.321.dist-info/RECORD,,