remotivelabs-cli 0.0.36__tar.gz → 0.0.37__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.
Files changed (52) hide show
  1. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/PKG-INFO +1 -1
  2. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/lib/broker.py +8 -0
  3. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/signals.py +29 -2
  4. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/errors.py +2 -0
  5. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/pyproject.toml +1 -1
  6. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/LICENSE +0 -0
  7. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/README.md +0 -0
  8. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/__init__.py +0 -0
  9. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/brokers.py +0 -0
  10. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/export.py +0 -0
  11. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/files.py +0 -0
  12. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/lib/__about__.py +0 -0
  13. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/license_flows.py +0 -0
  14. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/licenses.py +0 -0
  15. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/playback.py +0 -0
  16. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/record.py +0 -0
  17. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/broker/scripting.py +0 -0
  18. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/__init__.py +0 -0
  19. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/auth/__init__.py +0 -0
  20. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/auth/cmd.py +0 -0
  21. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/auth/login.py +0 -0
  22. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/auth_tokens.py +0 -0
  23. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/brokers.py +0 -0
  24. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/cloud_cli.py +0 -0
  25. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/configs.py +0 -0
  26. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/organisations.py +0 -0
  27. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/projects.py +0 -0
  28. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/recordings.py +0 -0
  29. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/recordings_playback.py +0 -0
  30. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/rest_helper.py +0 -0
  31. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/resumable_upload.py +0 -0
  32. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/sample_recordings.py +0 -0
  33. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/service_account_tokens.py +0 -0
  34. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/service_accounts.py +0 -0
  35. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/storage/__init__.py +0 -0
  36. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/storage/cmd.py +0 -0
  37. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/storage/copy.py +0 -0
  38. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/storage/uri_or_path.py +0 -0
  39. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/cloud/uri.py +0 -0
  40. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/connect/__init__.py +0 -0
  41. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/connect/connect.py +0 -0
  42. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/connect/protopie/protopie.py +0 -0
  43. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/remotive.py +0 -0
  44. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/settings/__init__.py +0 -0
  45. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/settings/cmd.py +0 -0
  46. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/settings/core.py +0 -0
  47. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/settings/token_file.py +0 -0
  48. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/tools/__init__.py +0 -0
  49. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/tools/can/RemotiveLabs.can1.log +0 -0
  50. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/tools/can/__init__.py +0 -0
  51. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/tools/can/can.py +0 -0
  52. {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.37}/cli/tools/tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotivelabs-cli
3
- Version: 0.0.36
3
+ Version: 0.0.37
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -14,6 +14,7 @@ from threading import Thread
14
14
  from typing import Any, Callable, Dict, Iterable, List, Sequence, Union
15
15
 
16
16
  import grpc
17
+ import remotivelabs.broker.generated.sync.network_api_pb2 as network_api
17
18
  import remotivelabs.broker.generated.sync.traffic_api_pb2 as traffic_api
18
19
  import remotivelabs.broker.sync as br
19
20
  import remotivelabs.broker.sync.helper as br_helper
@@ -220,6 +221,13 @@ class Broker:
220
221
  self.play(recording_and_namespace)
221
222
  callback(offset_length, total_length, get_mode(mode))
222
223
 
224
+ def listen_on_frame_distribution(self, namespace: str, callback: Callable[[Dict[str, Any]], None]) -> None:
225
+ config = network_api.FramesDistributionConfig(namespace=br.common_pb2.NameSpace(name=namespace))
226
+ frame_distribution_stream = self.network_stub.SubscribeToFramesDistribution(config)
227
+ for frame in frame_distribution_stream:
228
+ f = MessageToDict(frame, including_default_value_fields=True, preserving_proto_field_name=True)
229
+ callback(f)
230
+
223
231
  def pause(self, namespace: str, path: str, silent: bool = False) -> br.traffic_api_pb2.PlaybackInfos:
224
232
  playback_list = [
225
233
  {
@@ -4,6 +4,7 @@ import json
4
4
  import numbers
5
5
  import os
6
6
  import signal as os_signal
7
+ from datetime import datetime
7
8
  from pathlib import Path
8
9
  from typing import Any, Dict, Iterable, List, TypedDict, Union
9
10
 
@@ -64,7 +65,7 @@ def read_scripted_code_file(file_path: Path) -> bytes:
64
65
  def subscribe( # noqa: C901
65
66
  url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
66
67
  api_key: str = typer.Option(None, help="Cloud Broker API-KEY or access token", envvar="REMOTIVE_BROKER_API_KEY"),
67
- signal: List[str] = typer.Option(None, help="Signal names to subscribe to, mandatory when not using script"),
68
+ signal: List[str] = typer.Option([], help="Signal names to subscribe to, mandatory when not using script"),
68
69
  script: Path = typer.Option(
69
70
  None,
70
71
  exists=True,
@@ -96,7 +97,7 @@ def subscribe( # noqa: C901
96
97
 
97
98
  if script is None:
98
99
  if len(signal) == 0:
99
- ErrorPrinter.print_generic_error("You must use include at least one signal and one namespace or use script when subscribing")
100
+ ErrorPrinter.print_generic_error("You must use --signal or use --script when subscribing")
100
101
  exit(1)
101
102
 
102
103
  if script is not None:
@@ -194,3 +195,29 @@ def namespaces(
194
195
  print(json.dumps(namespaces_json))
195
196
  except grpc.RpcError as rpc_error:
196
197
  ErrorPrinter.print_grpc_error(rpc_error)
198
+
199
+
200
+ @app.command()
201
+ def frame_distribution(
202
+ url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
203
+ api_key: str = typer.Option(None, help="Cloud Broker API-KEY or access token", envvar="REMOTIVE_BROKER_API_KEY"),
204
+ namespace: str = typer.Option(..., help="Namespace"),
205
+ ) -> None:
206
+ """
207
+ Use this command to get frames currently available on the specified namespace.
208
+ """
209
+ try:
210
+ broker = Broker(url, api_key)
211
+
212
+ def on_data(data: Dict[str, Any]) -> None:
213
+ timestamp: str = datetime.now().strftime("%H:%M:%S")
214
+ distribution = data["countsByFrameId"]
215
+ if len(distribution) == 0:
216
+ ErrorPrinter.print_hint(f"{timestamp} - No frames available")
217
+ else:
218
+ for d in distribution:
219
+ ErrorPrinter.print_generic_message(f"{timestamp}: {d}")
220
+
221
+ broker.listen_on_frame_distribution(namespace, on_data)
222
+ except grpc.RpcError as rpc_error:
223
+ ErrorPrinter.print_grpc_error(rpc_error)
@@ -7,6 +7,8 @@ from rich.console import Console
7
7
  err_console = Console(stderr=True)
8
8
 
9
9
 
10
+ # This should be renamed to Printer since print_generic_message is not an error message.
11
+ # Then we can also add more things here
10
12
  class ErrorPrinter:
11
13
  @staticmethod
12
14
  def print_grpc_error(error: grpc.RpcError) -> None:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "remotivelabs-cli"
3
- version = "0.0.36"
3
+ version = "0.0.37"
4
4
  description = "CLI for operating RemotiveCloud and RemotiveBroker"
5
5
  authors = ["Johan Rask <johan.rask@remotivelabs.com>"]
6
6
  readme = "README.md"