jetstream-api 0.4.1__tar.gz → 0.4.2__tar.gz
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.
- {jetstream_api-0.4.1/jetstream_api.egg-info → jetstream_api-0.4.2}/PKG-INFO +1 -1
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/__init__.py +3 -1
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/admin.py +165 -8
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/common.py +1045 -1039
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/properties.py +84 -5
- {jetstream_api-0.4.1 → jetstream_api-0.4.2/jetstream_api.egg-info}/PKG-INFO +1 -1
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/pyproject.toml +1 -1
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/LICENSE.txt +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/README.md +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/admintopic.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/connectivity.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/exception.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/msg.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/pattern.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/producer.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/py.typed +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/qmgr.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/topic.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/ilink/util.py +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/jetstream_api.egg-info/SOURCES.txt +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/jetstream_api.egg-info/dependency_links.txt +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/jetstream_api.egg-info/requires.txt +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/jetstream_api.egg-info/top_level.txt +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/setup.cfg +0 -0
- {jetstream_api-0.4.1 → jetstream_api-0.4.2}/tests/test_example.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""iLink - Python client API for iLink M.O.M. (Message Oriented Middleware)."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.4.
|
|
3
|
+
__version__ = "0.4.2"
|
|
4
4
|
|
|
5
5
|
# --- Admin / Service ---
|
|
6
6
|
from .admin import ILAdminService, ILAdminQmgr, ILLogBrowser, ILQueueBrowser
|
|
@@ -26,6 +26,7 @@ from .properties import (
|
|
|
26
26
|
ILChannelSecurity,
|
|
27
27
|
ILChannelBalanceMode,
|
|
28
28
|
ILClusterNode,
|
|
29
|
+
ILClusterControlResult,
|
|
29
30
|
ILClusterProperty,
|
|
30
31
|
ILQmgrProperty,
|
|
31
32
|
ILSessionProperty,
|
|
@@ -75,6 +76,7 @@ __all__ = [
|
|
|
75
76
|
"ILChannelSecurity",
|
|
76
77
|
"ILChannelBalanceMode",
|
|
77
78
|
"ILClusterNode",
|
|
79
|
+
"ILClusterControlResult",
|
|
78
80
|
"ILClusterProperty",
|
|
79
81
|
"ILQmgrProperty",
|
|
80
82
|
"ILSessionProperty",
|
|
@@ -22,6 +22,7 @@ from .properties import (
|
|
|
22
22
|
ILChannelStatus,
|
|
23
23
|
ILChannelType,
|
|
24
24
|
ILChannelDirection,
|
|
25
|
+
ILClusterControlResult,
|
|
25
26
|
ILClusterNode,
|
|
26
27
|
ILClusterProperty,
|
|
27
28
|
ILQmgrMinorProperty,
|
|
@@ -946,26 +947,165 @@ class ILAdminService:
|
|
|
946
947
|
self.setClusterProperty(vo)
|
|
947
948
|
return True
|
|
948
949
|
|
|
949
|
-
def
|
|
950
|
-
"""
|
|
950
|
+
def _clusterNodesArg(self, withNodes: bool) -> str:
|
|
951
|
+
"""START/STOP CLUSTER 의 arg3 를 만든다.
|
|
952
|
+
|
|
953
|
+
Args:
|
|
954
|
+
withNodes (bool): 엮인 큐 관리자까지 제어할지.
|
|
955
|
+
|
|
956
|
+
Returns:
|
|
957
|
+
str: 기본이면 ``""``, 조정자만 다루면 ``"N"``.
|
|
958
|
+
|
|
959
|
+
Raises:
|
|
960
|
+
ILOperationException: ``withNodes=False`` 인데 엔진이 **rev 3315 미만**일 때.
|
|
961
|
+
|
|
962
|
+
Note:
|
|
963
|
+
구엔진은 이 인자를 **조용히 무시하고 큐 관리자까지 내린다.** 침묵하는
|
|
964
|
+
옵션은 "안 내린다"고 믿게 만들어 옵션이 없는 것보다 나쁘므로, 보내기 전에
|
|
965
|
+
막는다. 판정을 ``0 < revision`` 으로 한정한 이유는 버전 문자열을 파싱하지
|
|
966
|
+
못했을 때 정상 엔진에서 기능이 조용히 사라지지 않게 하기 위해서다.
|
|
967
|
+
"""
|
|
968
|
+
if withNodes:
|
|
969
|
+
return ""
|
|
970
|
+
if 0 < self.revision < ILC.CLUSTER_NO_NODES_MIN_REVISION:
|
|
971
|
+
raise ILOperationException(
|
|
972
|
+
"MIMQE_NOT_SUPPORTED (withNodes=False requires engine rev "
|
|
973
|
+
f"{ILC.CLUSTER_NO_NODES_MIN_REVISION}+, current: {self.revision})"
|
|
974
|
+
)
|
|
975
|
+
return ILC.MIMQ_CLUSTER_NO_NODES
|
|
976
|
+
|
|
977
|
+
def startCluster(self, clusterName: str,
|
|
978
|
+
withNodes: bool = True) -> "ILClusterControlResult":
|
|
979
|
+
"""클러스터를 기동한다 - 기본은 **ilcc 와 엮인 큐 관리자를 함께** 올린다.
|
|
980
|
+
|
|
981
|
+
Args:
|
|
982
|
+
clusterName (str): 기동할 클러스터 이름.
|
|
983
|
+
withNodes (bool): 엮인 큐 관리자까지 함께 기동할지. 기본 True.
|
|
984
|
+
``False`` 면 조정자(ilcc)만 올리고 데이터 평면은 건드리지 않는다.
|
|
985
|
+
**엔진 rev 3315 이상**에서만 쓸 수 있다.
|
|
986
|
+
|
|
987
|
+
Returns:
|
|
988
|
+
ILClusterControlResult: 제어된 노드 수와 **빠진 노드 목록**.
|
|
989
|
+
``getSkipped()`` 이 0 이 아니면 일부 노드가 처리되지 않은 것이다.
|
|
990
|
+
엔진 rev 3317 미만은 집계를 싣지 않으므로 ``known`` 이 False 로 온다.
|
|
991
|
+
|
|
992
|
+
Raises:
|
|
993
|
+
ILOperationException: 이미 떠 있을 때(``MIMQE_CLUSTER_NOT_STOPPED``),
|
|
994
|
+
그런 클러스터가 없을 때, ``withNodes=False`` 인데 엔진이 rev 3315
|
|
995
|
+
미만일 때(``MIMQE_NOT_SUPPORTED``).
|
|
996
|
+
ILException: 통신 실패.
|
|
997
|
+
|
|
998
|
+
Warning:
|
|
999
|
+
**기본값은 조정자만 올리는 게 아니다.** 노드 목록에 있는 큐 관리자 중
|
|
1000
|
+
**이 서비스 소관인 것**을 함께 기동한다(엔진 rev 3309+). 다른 서비스
|
|
1001
|
+
소관 노드는 전파받은 그쪽 서비스가 올린다. "클러스터를 켠다 = 데이터
|
|
1002
|
+
평면까지 켠다"는 뜻이라 그렇다.
|
|
1003
|
+
|
|
1004
|
+
.. warning:: 성공 반환이 "전부 떴다"는 뜻이 아니다
|
|
1005
|
+
|
|
1006
|
+
노드 제어는 **최선 노력**이라 일부가 빠져도 이 호출은 성공을 돌려준다.
|
|
1007
|
+
빠진 노드는 반환값 :class:`ILClusterControlResult` 로 알려 주므로
|
|
1008
|
+
**반드시 확인하라**(엔진 rev 3317+). 빠지는 경우는 이렇다.
|
|
1009
|
+
|
|
1010
|
+
- 개별 노드 제어가 실패했다(그 서비스가 로그를 남기고 다음 노드로 넘어간다).
|
|
1011
|
+
- 다른 서비스 소관 노드인데 **전파가 닿지 못했다.** 그쪽 노드는 그대로 남는다.
|
|
1012
|
+
|
|
1013
|
+
큐 관리자 이름이 빈 노드도 제어 대상에서 빠지는데, 엔진 **rev 3319 부터
|
|
1014
|
+
그런 노드는 애초에 저장이 거부**되므로 새로 만든 클러스터에서는 생기지
|
|
1015
|
+
않는다. rev 3319 이전에 등록된 레거시 노드가 남아 있다면
|
|
1016
|
+
:meth:`removeClusterNode` 후 :meth:`addClusterNode` 로 이름을 채워야 한다.
|
|
1017
|
+
|
|
1018
|
+
::
|
|
1019
|
+
|
|
1020
|
+
r = svc.startCluster("CC1")
|
|
1021
|
+
if r.getSkipped():
|
|
1022
|
+
print("제어 대상에서 빠진 노드:", r.getSkippedNodes())
|
|
1023
|
+
print("제어한 노드 %d개" % r.getControlled())
|
|
1024
|
+
|
|
1025
|
+
Note:
|
|
1026
|
+
요청만 보내고 돌아온다. 상태는 :meth:`getClusterProperty` 로 확인하라.
|
|
1027
|
+
|
|
1028
|
+
Example::
|
|
1029
|
+
|
|
1030
|
+
svc.startCluster("CC1") # 큐 관리자까지 함께
|
|
1031
|
+
svc.startCluster("CC1", withNodes=False) # 조정자(ilcc)만
|
|
1032
|
+
|
|
1033
|
+
for _ in range(30):
|
|
1034
|
+
if svc.getClusterProperty("CC1").get_status_string() == "RUNNING":
|
|
1035
|
+
break
|
|
1036
|
+
time.sleep(0.5)
|
|
1037
|
+
"""
|
|
951
1038
|
try:
|
|
952
1039
|
self._checkClusterSupported()
|
|
953
|
-
self.service.request(
|
|
1040
|
+
res = self.service.request(
|
|
954
1041
|
ILC.MIMQ_START_CLUSTER,
|
|
955
|
-
ILC.MIMQ_SUCCESSFUL_CLUSTER_OPERATION,
|
|
956
1042
|
clusterName,
|
|
1043
|
+
"",
|
|
1044
|
+
self._clusterNodesArg(withNodes),
|
|
957
1045
|
)
|
|
1046
|
+
if res is None or res.getCode() != ILC.MIMQ_SUCCESSFUL_CLUSTER_OPERATION:
|
|
1047
|
+
raise ILOperationException(
|
|
1048
|
+
res.getArg1() if res is not None else "no response")
|
|
1049
|
+
return ILClusterControlResult(res.getArg1(), res.getArg2(), res.getArg3())
|
|
958
1050
|
except _PASSTHROUGH_EXCEPTIONS:
|
|
959
1051
|
raise
|
|
960
1052
|
except Exception as exc:
|
|
961
1053
|
raise ILException(exc) from exc
|
|
962
1054
|
|
|
963
|
-
def stopCluster(self, clusterName: str
|
|
964
|
-
|
|
1055
|
+
def stopCluster(self, clusterName: str,
|
|
1056
|
+
withNodes: bool = True) -> "ILClusterControlResult":
|
|
1057
|
+
"""클러스터를 정지한다 - 기본은 **ilcc 와 엮인 큐 관리자를 함께** 내린다.
|
|
1058
|
+
|
|
1059
|
+
Args:
|
|
1060
|
+
clusterName (str): 정지할 클러스터 이름.
|
|
1061
|
+
withNodes (bool): 엮인 큐 관리자까지 함께 정지할지. 기본 True.
|
|
1062
|
+
``False`` 면 조정자(ilcc)만 내리고 **데이터 평면은 살려 둔다.**
|
|
1063
|
+
**엔진 rev 3315 이상**에서만 쓸 수 있다.
|
|
1064
|
+
|
|
1065
|
+
Returns:
|
|
1066
|
+
ILClusterControlResult: 제어된 노드 수와 **빠진 노드 목록**.
|
|
1067
|
+
``getSkipped()`` 이 0 이 아니면 일부 노드가 처리되지 않은 것이다.
|
|
1068
|
+
엔진 rev 3317 미만은 집계를 싣지 않으므로 ``known`` 이 False 로 온다.
|
|
1069
|
+
|
|
1070
|
+
Raises:
|
|
1071
|
+
ILOperationException: ``withNodes=False`` 인데 엔진이 rev 3315 미만일 때
|
|
1072
|
+
(``MIMQE_NOT_SUPPORTED``).
|
|
1073
|
+
ILException: 통신 실패.
|
|
965
1074
|
|
|
966
1075
|
미기동 상태에서 호출해도 성공이다(큐관리자 STOP 관례와 같다).
|
|
967
1076
|
정지 후에는 서비스 자동 기동 대상에서도 빠진다 - startCluster 로 되살린다.
|
|
968
1077
|
|
|
1078
|
+
.. warning:: 기본값은 큐 관리자까지 내린다
|
|
1079
|
+
|
|
1080
|
+
노드 목록에 있는 큐 관리자 중 **이 서비스 소관인 것**을 함께 정지시킨다
|
|
1081
|
+
(엔진 rev 3309+). 그 위에서 돌던 응용의 연결이 함께 끊어진다.
|
|
1082
|
+
조정자만 내리고 데이터 평면을 살려 두려면 ``withNodes=False`` 를 쓴다.
|
|
1083
|
+
|
|
1084
|
+
**구엔진(rev 3315 미만)은 이 옵션을 조용히 무시하고 큐 관리자까지
|
|
1085
|
+
내린다.** 그래서 이 라이브러리가 보내기 전에 막는다 - 안 내려갈 것이라
|
|
1086
|
+
믿고 부르는 것이 가장 위험하기 때문이다.
|
|
1087
|
+
|
|
1088
|
+
.. warning:: 성공 반환이 "전부 내려갔다"는 뜻이 아니다
|
|
1089
|
+
|
|
1090
|
+
노드 제어는 **최선 노력**이라 일부가 빠져도 이 호출은 성공을 돌려준다.
|
|
1091
|
+
빠진 노드는 반환값 :class:`ILClusterControlResult` 로 알려 주므로
|
|
1092
|
+
**반드시 확인하라**(엔진 rev 3317+). 빠지는 경우는 이렇다.
|
|
1093
|
+
|
|
1094
|
+
- 개별 노드 제어가 실패했다(그 서비스가 로그를 남기고 다음 노드로 넘어간다).
|
|
1095
|
+
- 다른 서비스 소관 노드인데 **전파가 닿지 못했다.** 그쪽 노드는 그대로 남는다.
|
|
1096
|
+
|
|
1097
|
+
큐 관리자 이름이 빈 노드도 제어 대상에서 빠지는데, 엔진 **rev 3319 부터
|
|
1098
|
+
그런 노드는 애초에 저장이 거부**되므로 새로 만든 클러스터에서는 생기지
|
|
1099
|
+
않는다. rev 3319 이전에 등록된 레거시 노드가 남아 있다면
|
|
1100
|
+
:meth:`removeClusterNode` 후 :meth:`addClusterNode` 로 이름을 채워야 한다.
|
|
1101
|
+
|
|
1102
|
+
::
|
|
1103
|
+
|
|
1104
|
+
r = svc.stopCluster("CC1")
|
|
1105
|
+
if r.getSkipped():
|
|
1106
|
+
print("제어 대상에서 빠진 노드:", r.getSkippedNodes())
|
|
1107
|
+
print("제어한 노드 %d개" % r.getControlled())
|
|
1108
|
+
|
|
969
1109
|
.. warning:: 정지 완료를 기다리지 않는다
|
|
970
1110
|
|
|
971
1111
|
요청만 보내고 바로 돌아온다. **곧바로** :meth:`removeCluster` 를 부르면
|
|
@@ -973,14 +1113,31 @@ class ILAdminService:
|
|
|
973
1113
|
:meth:`getClusterProperty` 의 상태가 ``STOPPED`` 가 될 때까지 확인하고
|
|
974
1114
|
진행하라 - 큐관리자와 달리 ``stopClusterWithStatus`` 같은 대기형 메서드가
|
|
975
1115
|
없다.
|
|
1116
|
+
|
|
1117
|
+
Example::
|
|
1118
|
+
|
|
1119
|
+
# 조정자만 내린다 - 큐 관리자는 계속 서비스한다 (ilcc 패치 등)
|
|
1120
|
+
svc.stopCluster("CC1", withNodes=False)
|
|
1121
|
+
svc.startCluster("CC1", withNodes=False)
|
|
1122
|
+
|
|
1123
|
+
# 클러스터를 통째로 내린다 (기본)
|
|
1124
|
+
svc.stopCluster("CC1")
|
|
1125
|
+
while svc.getClusterProperty("CC1").get_status_string() != "STOPPED":
|
|
1126
|
+
time.sleep(0.5)
|
|
1127
|
+
svc.removeCluster("CC1")
|
|
976
1128
|
"""
|
|
977
1129
|
try:
|
|
978
1130
|
self._checkClusterSupported()
|
|
979
|
-
self.service.request(
|
|
1131
|
+
res = self.service.request(
|
|
980
1132
|
ILC.MIMQ_STOP_CLUSTER,
|
|
981
|
-
ILC.MIMQ_SUCCESSFUL_CLUSTER_OPERATION,
|
|
982
1133
|
clusterName,
|
|
1134
|
+
"",
|
|
1135
|
+
self._clusterNodesArg(withNodes),
|
|
983
1136
|
)
|
|
1137
|
+
if res is None or res.getCode() != ILC.MIMQ_SUCCESSFUL_CLUSTER_OPERATION:
|
|
1138
|
+
raise ILOperationException(
|
|
1139
|
+
res.getArg1() if res is not None else "no response")
|
|
1140
|
+
return ILClusterControlResult(res.getArg1(), res.getArg2(), res.getArg3())
|
|
984
1141
|
except _PASSTHROUGH_EXCEPTIONS:
|
|
985
1142
|
raise
|
|
986
1143
|
except Exception as exc:
|