pa4ka

liftbridge migrate

Nov 26th, 2020
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.17 KB | None | 0 0
  1. task path: /opt/tower/var/tower/playbooks/NOC1/noc_roles/migrate/tasks/main.yml:123
  2. Using module file /opt/tower/lib/python3.8/site-packages/ansible/modules/commands/command.py
  3. Pipelining is enabled.
  4. <172.22.2.229> ESTABLISH SSH CONNECTION FOR USER: ansible
  5. <172.22.2.229> SSH: ansible.cfg set ssh_args: (-C)(-o)(ControlMaster=auto)(-o)(ControlPersist=60s)
  6. <172.22.2.229> SSH: ANSIBLE_HOST_KEY_CHECKING/host_key_checking disabled: (-o)(StrictHostKeyChecking=no)
  7. <172.22.2.229> SSH: ANSIBLE_REMOTE_PORT/remote_port/ansible_port set: (-o)(Port=22)
  8. <172.22.2.229> SSH: ANSIBLE_PRIVATE_KEY_FILE/private_key_file/ansible_ssh_private_key_file set: (-o)(IdentityFile="/opt/tower/var/tower/data/deploy_keys/id_rsa")
  9. <172.22.2.229> SSH: ansible_password/ansible_ssh_password not set: (-o)(KbdInteractiveAuthentication=no)(-o)(PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey)(-o)(PasswordAuthentication=no)
  10. <172.22.2.229> SSH: ANSIBLE_REMOTE_USER/remote_user/ansible_user/user/-u set: (-o)(User="ansible")
  11. <172.22.2.229> SSH: ANSIBLE_TIMEOUT/timeout set: (-o)(ConnectTimeout=10)
  12. <172.22.2.229> SSH: PlayContext set ssh_common_args: ()
  13. <172.22.2.229> SSH: PlayContext set ssh_extra_args: ()
  14. <172.22.2.229> SSH: found only ControlPersist; added ControlPath: (-o)(ControlPath=/root/.ansible/cp/ansible-ssh-%r-%h-%r)
  15. <172.22.2.229> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=22 -o 'IdentityFile="/opt/tower/var/tower/data/deploy_keys/id_rsa"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%r-%h-%r 172.22.2.229 '/bin/sh -c '"'"'sudo -H -S -n -u noc /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-oqnhtjpgmtjgwgftabfbnahabxrthncj ; NOC_CONFIG=yaml:///opt/noc/etc/tower.yml,yaml:///opt/noc/etc/settings.yml,env:///NOC /usr/bin/python'"'"'"'"'"'"'"'"' && sleep 0'"'"''
  16. Escalation succeeded
  17. <172.22.2.229> (1, b'\n{"changed": true, "end": "2020-11-26 11:42:56.194676", "stdout": "2020-11-26 12:42:30,207 [noc.core.ioloop.util] Setting up asyncio event loop policy\\n2020-11-26 12:42:30,207 [noc.core.ioloop.util] Setting up default event loop\\n2020-11-26 12:42:30,304 [noc.core.dcs.base] Resolve near service liftbridge\\n2020-11-26 12:42:30,310 [noc.core.dcs.base] No active service liftbridge. Waiting\\n2020-11-26 12:42:30,310 [noc.core.dcs.base] Set faulty status to: No active service liftbridge. Waiting\\n2020-11-26 12:42:55,541 [noc.core.dcs.base] Resolved near service liftbridge to [\'172.22.2.229:9292\']\\n2020-11-26 12:42:55,542 [noc.core.dcs.base] Clearing faulty status\\n2020-11-26 12:42:55,559 [stub] Activating stub service\\n2020-11-26 12:42:55,559 [stub] Starting IOLoop\\n2020-11-26 12:42:55,559 [noc.core.dcs.base] Attempting to get slot\\nEnsuring stream message\\nCreating stream message with 1 partitions\\n2020-11-26 12:42:55,905 [noc.core.debug] UNHANDLED EXCEPTION (2020-11-26 12:42:55.578316)\\nPROCESS: ./commands/migrate-liftbridge.py\\nVERSION: 20.4+fix-liftbridge-alter.91.a8a124c8\\nBRANCH: fix-liftbridge-alter CHANGESET: a8a124c8\\nERROR FINGERPRINT: 12f1f69d-a55e-50dc-9ec6-fdac6483c703\\nWORKING DIRECTORY: /opt/noc\\nEXCEPTION: <class \'noc.core.liftbridge.error.LiftbridgeError\'> no known metadata leader\\nSTART OF TRACEBACK\\n------------------------------------------------------------------------\\nFile: core/liftbridge/error.py (Line: 62)\\nFunction: __exit__\\n 55 pass\\n 56 \\n 57 def __exit__(self, exc_type, exc_val, exc_tb):\\n 58 if exc_type and issubclass(exc_type, AioRpcError):\\n 59 code = exc_val.code()\\n 60 details = exc_val.details()\\n 61 xcls = RPC_CODE_TO_ERR.get(code) or LiftbridgeError\\n 62 ==> raise xcls(details)\\n\\nVariables:\\n self = <noc.core.liftbridge.error.rpc_error object at 0x7f1e4e093c40>\\n exc_type = <class \'grpc.aio._call.AioRpcError\'>\\n exc_val = \\n<AioRpcError of RPC that terminated with:\\n\\tstatus = StatusCode.INTERNAL\\n\\tdetails = \\"no known metadata leader\\"\\n\\tdebug_error_string = \\"{\\"created\\":\\"@1606383775.566406594\\",\\"description\\":\\"Error received from peer ipv4:172.22.2.229:9292\\",\\"file\\":\\"src/core/lib/surface/call.cc\\",\\"file_line\\":1061,\\"grpc_message\\":\\"no known metadata leader\\",\\"grpc_status\\":13}\\"\\n>\\n exc_tb = <traceback object at 0x7f1e4e01d180>\\n code = <StatusCode.INTERNAL: (13, \'internal\')>\\n details = \'no known metadata leader\'\\n xcls = <class \'noc.core.liftbridge.error.LiftbridgeError\'>\\n------------------------------------------------------------------------\\nFile: core/liftbridge/base.py (Line: 396)\\nFunction: create_stream\\n 389 group=group,\\n 390 replicationFactor=replication_factor,\\n 391 partitions=partitions,\\n 392 )\\n 393 if enable_compact:\\n 394 req.CompactEnabled.value = True\\n 395 channel = await self.get_channel()\\n 396 ==> await channel.CreateStream(req)\\n 397 \\n 398 async def delete_stream(self, name: str) -> None:\\n 399 with rpc_error():\\n 400 channel = await self.get_channel()\\n 401 await channel.DeleteStream(DeleteStreamRequest(name=name))\\n 402 \\nVariables:\\n self = <noc.core.liftbridge.base.LiftBridgeClient object at 0x7f1e4e093e50>\\n subject = \'message\'\\n name = \'message\'\\n group = None\\n replication_factor = 1\\n partitions = 1\\n enable_compact = False\\n req = subject: \\"message\\"\\nname: \\"message\\"\\nreplicationFactor: 1\\npartitions: 1\\n\\n channel = <noc.core.liftbridge.base.GRPCChannel object at 0x7f1e4e093f10>\\n------------------------------------------------------------------------\\nFile: commands/migrate-liftbridge.py (Line: 96)\\nFunction: wrapper\\n 89 await client.delete_stream(name)\\n 90 \\n 91 run_sync(wrapper)\\n 92 \\n 93 def create_stream(name: str, n_partitions: int, replication_factor: int):\\n 94 async def wrapper():\\n 95 async with LiftBridgeClient() as client:\\n 96 ==> await client.create_stream(\\n 97 subject=name,\\n 98 name=name,\\n 99 partitions=n_partitions,\\n 100 replication_factor=replication_factor,\\n 101 )\\n 102 \\nVariables:\\n client = <noc.core.liftbridge.base.LiftBridgeClient object at 0x7f1e4e093e50>\\n n_partitions = 1\\n name = \'message\'\\n replication_factor = 1\\n------------------------------------------------------------------------\\nFile: core/ioloop/util.py (Line: 92)\\nFunction: wrapper\\n 85 :return: Callable result\\n 86 \\"\\"\\"\\n 87 global _setup_completed\\n 88 \\n 89 async def wrapper():\\n 90 nonlocal result, error\\n 91 try:\\n 92 ==> result = await cb()\\n 93 except Exception:\\n 94 error = sys.exc_info()\\n 95 \\n 96 if not _setup_completed:\\n 97 setup_asyncio()\\n 98 \\nVariables:\\n cb = \\n<function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>\\n error = \\n(<class \'noc.core.liftbridge.error.LiftbridgeError\'>,\\n LiftbridgeError(\'no known metadata leader\'),\\n <traceback object at 0x7f1e4e099f40>)\\n result = None\\n------------------------------------------------------------------------\\nFile: core/comp.py (Line: 39)\\nFunction: reraise\\n 32 \\n 33 def reraise(tp, value, tb=None):\\n 34 try:\\n 35 if value is None:\\n 36 value = tp()\\n 37 if value.__traceback__ is not tb:\\n 38 raise value.with_traceback(tb)\\n 39 ==> raise value\\n 40 finally:\\n 41 value = None\\n 42 tb = None\\nVariables:\\n tp = <class \'noc.core.liftbridge.error.LiftbridgeError\'>\\n value = None\\n tb = None\\n------------------------------------------------------------------------\\nFile: core/ioloop/util.py (Line: 105)\\nFunction: run_sync\\n 98 \\n 99 result: Optional[T] = None\\n 100 error: Optional[Tuple[Any, Any, Any]] = None\\n 101 \\n 102 with IOLoopContext() as loop:\\n 103 loop.run_until_complete(wrapper())\\n 104 if error:\\n 105 ==> reraise(*error)\\n 106 return result\\n 107 \\n 108 \\n 109 _setup_completed = False\\n 110 \\n 111 \\nVariables:\\n close_all = True\\n wrapper = <function run_sync.<locals>.wrapper at 0x7f1e4e096b80>\\n loop = <_UnixSelectorEventLoop running=False closed=True debug=False>\\n error = \\n(<class \'noc.core.liftbridge.error.LiftbridgeError\'>,\\n LiftbridgeError(\'no known metadata leader\'),\\n <traceback object at 0x7f1e4e099f40>)\\n result = None\\n cb = \\n<function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>\\n------------------------------------------------------------------------\\nFile: commands/migrate-liftbridge.py (Line: 103)\\nFunction: create_stream\\n 96 await client.create_stream(\\n 97 subject=name,\\n 98 name=name,\\n 99 partitions=n_partitions,\\n 100 replication_factor=replication_factor,\\n 101 )\\n 102 \\n 103 ==> run_sync(wrapper)\\n 104 \\n 105 def alter_stream(\\n 106 current_meta: StreamMetadata, new_partitions: int, replication_factor: int\\n 107 ):\\n 108 name = current_meta.name\\n 109 old_partitions = len(current_meta.partitions)\\nVariables:\\n wrapper = \\n<function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>\\n n_partitions = 1\\n name = \'message\'\\n replication_factor = 1\\n------------------------------------------------------------------------\\nFile: commands/migrate-liftbridge.py (Line: 232)\\nFunction: apply_stream_settings\\n 225 partitions,\\n 226 )\\n 227 )\\n 228 alter_stream(stream_meta, partitions, rf)\\n 229 return True\\n 230 # Create stream\\n 231 self.print(\\"Creating stream %s with %d partitions\\" % (stream, partitions))\\n 232 ==> create_stream(stream, partitions, rf)\\n 233 return True\\n 234 \\n 235 \\n 236 if __name__ == \\"__main__\\":\\n 237 Command().run()\\nVariables:\\n meta = \\nMetadata(brokers=[Broker(id=\'centos-noc1\', host=\'172.22.2.229\', port=9292)], metadata=[])\\n partitions = 1\\n rf = 1\\n delete_stream = \\n<function Command.apply_stream_settings.<locals>.delete_stream at 0x7f1e4e096af0>\\n create_stream = \\n<function Command.apply_stream_settings.<locals>.create_stream at 0x7f1e4e096a60>\\n alter_stream = \\n<function Command.apply_stream_settings.<locals>.alter_stream at 0x7f1e4e0969d0>\\n stream_meta = None\\n self = <__main__.Command object at 0x7f1e5f68d0a0>\\n stream = \'message\'\\n------------------------------------------------------------------------\\nFile: commands/migrate-liftbridge.py (Line: 50)\\nFunction: handle\\n 43 rf = min(len(meta.brokers), 2)\\n 44 # Apply settings\\n 45 for stream, partitions in self.iter_limits():\\n 46 if not partitions:\\n 47 self.print(\\"Stream \'%s\' without partition. Skipping..\\" % partitions)\\n 48 continue\\n 49 self.print(\\"Ensuring stream %s\\" % stream)\\n 50 ==> changed |= self.apply_stream_settings(meta, stream, partitions, rf)\\n 51 if changed:\\n 52 self.print(\\"CHANGED\\")\\n 53 else:\\n 54 self.print(\\"OK\\")\\n 55 \\n 56 def get_meta(self) -> Metadata:\\nVariables:\\n self = <__main__.Command object at 0x7f1e5f68d0a0>\\n args = ()\\n options = {}\\n changed = False\\n meta = \\nMetadata(brokers=[Broker(id=\'centos-noc1\', host=\'172.22.2.229\', port=9292)], metadata=[])\\n rf = 1\\n stream = \'message\'\\n partitions = 1\\n------------------------------------------------------------------------\\nFile: core/management/base.py (Line: 78)\\nFunction: run_from_argv\\n 71 self.no_progressbar = cmd_options.pop(\\"no_progressbar\\", False)\\n 72 if enable_profiling:\\n 73 # Start profiler\\n 74 import yappi\\n 75 \\n 76 yappi.start()\\n 77 try:\\n 78 ==> return self.handle(*args, **cmd_options) or 0\\n 79 except CommandError as e:\\n 80 self.print(str(e))\\n 81 return 1\\n 82 except KeyboardInterrupt:\\n 83 self.print(\\"Ctrl+C\\")\\n 84 return 3\\nVariables:\\n self = <__main__.Command object at 0x7f1e5f68d0a0>\\n argv = []\\n parser = \\nArgumentParser(prog=\'noc migrate-liftbridge\', usage=None, description=None, formatter_class=<class \'argparse.HelpFormatter\'>, conflict_handler=\'error\', add_help=True)\\n options = Namespace()\\n cmd_options = {}\\n args = ()\\n loglevel = \'info\'\\n enable_profiling = False\\n show_metrics = False\\n error_report = <function error_report at 0x7f1e4e08c160>\\n------------------------------------------------------------------------\\nEND OF TRACEBACK", "cmd": ["./noc", "migrate-liftbridge"], "failed": true, "delta": "0:00:26.565777", "stderr": "", "rc": 2, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": false, "strip_empty_ends": true, "_raw_params": "./noc migrate-liftbridge", "removes": null, "argv": null, "warn": true, "chdir": "/opt/noc", "stdin_add_newline": true, "stdin": null}}, "start": "2020-11-26 11:42:29.628899", "msg": "non-zero return code"}\n', b'OpenSSH_8.1p1, OpenSSL 1.1.1g 21 Apr 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname 172.22.2.229 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 1931\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n')
  18. <172.22.2.229> Failed to connect to the host via ssh: OpenSSH_8.1p1, OpenSSL 1.1.1g 21 Apr 2020
  19. debug1: Reading configuration data /etc/ssh/ssh_config
  20. debug2: resolve_canonicalize: hostname 172.22.2.229 is address
  21. debug1: auto-mux: Trying existing master
  22. debug2: fd 3 setting O_NONBLOCK
  23. debug2: mux_client_hello_exchange: master version 4
  24. debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
  25. debug3: mux_client_request_session: entering
  26. debug3: mux_client_request_alive: entering
  27. debug3: mux_client_request_alive: done pid = 1931
  28. debug3: mux_client_request_session: session request sent
  29. debug3: mux_client_read_packet: read header failed: Broken pipe
  30. debug2: Received exit status from master 1
  31. fatal: [centos-noc1]: FAILED! => {
  32. "changed": true,
  33. "cmd": [
  34. "./noc",
  35. "migrate-liftbridge"
  36. ],
  37. "delta": "0:00:26.565777",
  38. "end": "2020-11-26 11:42:56.194676",
  39. "invocation": {
  40. "module_args": {
  41. "_raw_params": "./noc migrate-liftbridge",
  42. "_uses_shell": false,
  43. "argv": null,
  44. "chdir": "/opt/noc",
  45. "creates": null,
  46. "executable": null,
  47. "removes": null,
  48. "stdin": null,
  49. "stdin_add_newline": true,
  50. "strip_empty_ends": true,
  51. "warn": true
  52. }
  53. },
  54. "rc": 2,
  55. "start": "2020-11-26 11:42:29.628899"
  56. }
  57.  
  58. STDOUT:
  59.  
  60. 2020-11-26 12:42:30,207 [noc.core.ioloop.util] Setting up asyncio event loop policy
  61. 2020-11-26 12:42:30,207 [noc.core.ioloop.util] Setting up default event loop
  62. 2020-11-26 12:42:30,304 [noc.core.dcs.base] Resolve near service liftbridge
  63. 2020-11-26 12:42:30,310 [noc.core.dcs.base] No active service liftbridge. Waiting
  64. 2020-11-26 12:42:30,310 [noc.core.dcs.base] Set faulty status to: No active service liftbridge. Waiting
  65. 2020-11-26 12:42:55,541 [noc.core.dcs.base] Resolved near service liftbridge to ['172.22.2.229:9292']
  66. 2020-11-26 12:42:55,542 [noc.core.dcs.base] Clearing faulty status
  67. 2020-11-26 12:42:55,559 [stub] Activating stub service
  68. 2020-11-26 12:42:55,559 [stub] Starting IOLoop
  69. 2020-11-26 12:42:55,559 [noc.core.dcs.base] Attempting to get slot
  70. Ensuring stream message
  71. Creating stream message with 1 partitions
  72. 2020-11-26 12:42:55,905 [noc.core.debug] UNHANDLED EXCEPTION (2020-11-26 12:42:55.578316)
  73. PROCESS: ./commands/migrate-liftbridge.py
  74. VERSION: 20.4+fix-liftbridge-alter.91.a8a124c8
  75. BRANCH: fix-liftbridge-alter CHANGESET: a8a124c8
  76. ERROR FINGERPRINT: 12f1f69d-a55e-50dc-9ec6-fdac6483c703
  77. WORKING DIRECTORY: /opt/noc
  78. EXCEPTION: <class 'noc.core.liftbridge.error.LiftbridgeError'> no known metadata leader
  79. START OF TRACEBACK
  80. ------------------------------------------------------------------------
  81. File: core/liftbridge/error.py (Line: 62)
  82. Function: __exit__
  83. 55 pass
  84. 56
  85. 57 def __exit__(self, exc_type, exc_val, exc_tb):
  86. 58 if exc_type and issubclass(exc_type, AioRpcError):
  87. 59 code = exc_val.code()
  88. 60 details = exc_val.details()
  89. 61 xcls = RPC_CODE_TO_ERR.get(code) or LiftbridgeError
  90. 62 ==> raise xcls(details)
  91.  
  92. Variables:
  93. self = <noc.core.liftbridge.error.rpc_error object at 0x7f1e4e093c40>
  94. exc_type = <class 'grpc.aio._call.AioRpcError'>
  95. exc_val =
  96. <AioRpcError of RPC that terminated with:
  97. status = StatusCode.INTERNAL
  98. details = "no known metadata leader"
  99. debug_error_string = "{"created":"@1606383775.566406594","description":"Error received from peer ipv4:172.22.2.229:9292","file":"src/core/lib/surface/call.cc","file_line":1061,"grpc_message":"no known metadata leader","grpc_status":13}"
  100. >
  101. exc_tb = <traceback object at 0x7f1e4e01d180>
  102. code = <StatusCode.INTERNAL: (13, 'internal')>
  103. details = 'no known metadata leader'
  104. xcls = <class 'noc.core.liftbridge.error.LiftbridgeError'>
  105. ------------------------------------------------------------------------
  106. File: core/liftbridge/base.py (Line: 396)
  107. Function: create_stream
  108. 389 group=group,
  109. 390 replicationFactor=replication_factor,
  110. 391 partitions=partitions,
  111. 392 )
  112. 393 if enable_compact:
  113. 394 req.CompactEnabled.value = True
  114. 395 channel = await self.get_channel()
  115. 396 ==> await channel.CreateStream(req)
  116. 397
  117. 398 async def delete_stream(self, name: str) -> None:
  118. 399 with rpc_error():
  119. 400 channel = await self.get_channel()
  120. 401 await channel.DeleteStream(DeleteStreamRequest(name=name))
  121. 402
  122. Variables:
  123. self = <noc.core.liftbridge.base.LiftBridgeClient object at 0x7f1e4e093e50>
  124. subject = 'message'
  125. name = 'message'
  126. group = None
  127. replication_factor = 1
  128. partitions = 1
  129. enable_compact = False
  130. req = subject: "message"
  131. name: "message"
  132. replicationFactor: 1
  133. partitions: 1
  134.  
  135. channel = <noc.core.liftbridge.base.GRPCChannel object at 0x7f1e4e093f10>
  136. ------------------------------------------------------------------------
  137. File: commands/migrate-liftbridge.py (Line: 96)
  138. Function: wrapper
  139. 89 await client.delete_stream(name)
  140. 90
  141. 91 run_sync(wrapper)
  142. 92
  143. 93 def create_stream(name: str, n_partitions: int, replication_factor: int):
  144. 94 async def wrapper():
  145. 95 async with LiftBridgeClient() as client:
  146. 96 ==> await client.create_stream(
  147. 97 subject=name,
  148. 98 name=name,
  149. 99 partitions=n_partitions,
  150. 100 replication_factor=replication_factor,
  151. 101 )
  152. 102
  153. Variables:
  154. client = <noc.core.liftbridge.base.LiftBridgeClient object at 0x7f1e4e093e50>
  155. n_partitions = 1
  156. name = 'message'
  157. replication_factor = 1
  158. ------------------------------------------------------------------------
  159. File: core/ioloop/util.py (Line: 92)
  160. Function: wrapper
  161. 85 :return: Callable result
  162. 86 """
  163. 87 global _setup_completed
  164. 88
  165. 89 async def wrapper():
  166. 90 nonlocal result, error
  167. 91 try:
  168. 92 ==> result = await cb()
  169. 93 except Exception:
  170. 94 error = sys.exc_info()
  171. 95
  172. 96 if not _setup_completed:
  173. 97 setup_asyncio()
  174. 98
  175. Variables:
  176. cb =
  177. <function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>
  178. error =
  179. (<class 'noc.core.liftbridge.error.LiftbridgeError'>,
  180. LiftbridgeError('no known metadata leader'),
  181. <traceback object at 0x7f1e4e099f40>)
  182. result = None
  183. ------------------------------------------------------------------------
  184. File: core/comp.py (Line: 39)
  185. Function: reraise
  186. 32
  187. 33 def reraise(tp, value, tb=None):
  188. 34 try:
  189. 35 if value is None:
  190. 36 value = tp()
  191. 37 if value.__traceback__ is not tb:
  192. 38 raise value.with_traceback(tb)
  193. 39 ==> raise value
  194. 40 finally:
  195. 41 value = None
  196. 42 tb = None
  197. Variables:
  198. tp = <class 'noc.core.liftbridge.error.LiftbridgeError'>
  199. value = None
  200. tb = None
  201. ------------------------------------------------------------------------
  202. File: core/ioloop/util.py (Line: 105)
  203. Function: run_sync
  204. 98
  205. 99 result: Optional[T] = None
  206. 100 error: Optional[Tuple[Any, Any, Any]] = None
  207. 101
  208. 102 with IOLoopContext() as loop:
  209. 103 loop.run_until_complete(wrapper())
  210. 104 if error:
  211. 105 ==> reraise(*error)
  212. 106 return result
  213. 107
  214. 108
  215. 109 _setup_completed = False
  216. 110
  217. 111
  218. Variables:
  219. close_all = True
  220. wrapper = <function run_sync.<locals>.wrapper at 0x7f1e4e096b80>
  221. loop = <_UnixSelectorEventLoop running=False closed=True debug=False>
  222. error =
  223. (<class 'noc.core.liftbridge.error.LiftbridgeError'>,
  224. LiftbridgeError('no known metadata leader'),
  225. <traceback object at 0x7f1e4e099f40>)
  226. result = None
  227. cb =
  228. <function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>
  229. ------------------------------------------------------------------------
  230. File: commands/migrate-liftbridge.py (Line: 103)
  231. Function: create_stream
  232. 96 await client.create_stream(
  233. 97 subject=name,
  234. 98 name=name,
  235. 99 partitions=n_partitions,
  236. 100 replication_factor=replication_factor,
  237. 101 )
  238. 102
  239. 103 ==> run_sync(wrapper)
  240. 104
  241. 105 def alter_stream(
  242. 106 current_meta: StreamMetadata, new_partitions: int, replication_factor: int
  243. 107 ):
  244. 108 name = current_meta.name
  245. 109 old_partitions = len(current_meta.partitions)
  246. Variables:
  247. wrapper =
  248. <function Command.apply_stream_settings.<locals>.create_stream.<locals>.wrapper at 0x7f1e4e096ca0>
  249. n_partitions = 1
  250. name = 'message'
  251. replication_factor = 1
  252. ------------------------------------------------------------------------
  253. File: commands/migrate-liftbridge.py (Line: 232)
  254. Function: apply_stream_settings
  255. 225 partitions,
  256. 226 )
  257. 227 )
  258. 228 alter_stream(stream_meta, partitions, rf)
  259. 229 return True
  260. 230 # Create stream
  261. 231 self.print("Creating stream %s with %d partitions" % (stream, partitions))
  262. 232 ==> create_stream(stream, partitions, rf)
  263. 233 return True
  264. 234
  265. 235
  266. 236 if __name__ == "__main__":
  267. 237 Command().run()
  268. Variables:
  269. meta =
  270. Metadata(brokers=[Broker(id='centos-noc1', host='172.22.2.229', port=9292)], metadata=[])
  271. partitions = 1
  272. rf = 1
  273. delete_stream =
  274. <function Command.apply_stream_settings.<locals>.delete_stream at 0x7f1e4e096af0>
  275. create_stream =
  276. <function Command.apply_stream_settings.<locals>.create_stream at 0x7f1e4e096a60>
  277. alter_stream =
  278. <function Command.apply_stream_settings.<locals>.alter_stream at 0x7f1e4e0969d0>
  279. stream_meta = None
  280. self = <__main__.Command object at 0x7f1e5f68d0a0>
  281. stream = 'message'
  282. ------------------------------------------------------------------------
  283. File: commands/migrate-liftbridge.py (Line: 50)
  284. Function: handle
  285. 43 rf = min(len(meta.brokers), 2)
  286. 44 # Apply settings
  287. 45 for stream, partitions in self.iter_limits():
  288. 46 if not partitions:
  289. 47 self.print("Stream '%s' without partition. Skipping.." % partitions)
  290. 48 continue
  291. 49 self.print("Ensuring stream %s" % stream)
  292. 50 ==> changed |= self.apply_stream_settings(meta, stream, partitions, rf)
  293. 51 if changed:
  294. 52 self.print("CHANGED")
  295. 53 else:
  296. 54 self.print("OK")
  297. 55
  298. 56 def get_meta(self) -> Metadata:
  299. Variables:
  300. self = <__main__.Command object at 0x7f1e5f68d0a0>
  301. args = ()
  302. options = {}
  303. changed = False
  304. meta =
  305. Metadata(brokers=[Broker(id='centos-noc1', host='172.22.2.229', port=9292)], metadata=[])
  306. rf = 1
  307. stream = 'message'
  308. partitions = 1
  309. ------------------------------------------------------------------------
  310. File: core/management/base.py (Line: 78)
  311. Function: run_from_argv
  312. 71 self.no_progressbar = cmd_options.pop("no_progressbar", False)
  313. 72 if enable_profiling:
  314. 73 # Start profiler
  315. 74 import yappi
  316. 75
  317. 76 yappi.start()
  318. 77 try:
  319. 78 ==> return self.handle(*args, **cmd_options) or 0
  320. 79 except CommandError as e:
  321. 80 self.print(str(e))
  322. 81 return 1
  323. 82 except KeyboardInterrupt:
  324. 83 self.print("Ctrl+C")
  325. 84 return 3
  326. Variables:
  327. self = <__main__.Command object at 0x7f1e5f68d0a0>
  328. argv = []
  329. parser =
  330. ArgumentParser(prog='noc migrate-liftbridge', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
  331. options = Namespace()
  332. cmd_options = {}
  333. args = ()
  334. loglevel = 'info'
  335. enable_profiling = False
  336. show_metrics = False
  337. error_report = <function error_report at 0x7f1e4e08c160>
  338. ------------------------------------------------------------------------
  339. END OF TRACEBACK
  340.  
  341.  
  342. MSG:
  343.  
  344. non-zero return code
Advertisement
Add Comment
Please, Sign In to add comment