Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Events recorder example does not work #192

Closed
guilhermedemouraa opened this issue Apr 18, 2024 · 5 comments
Closed

[Bug]: Events recorder example does not work #192

guilhermedemouraa opened this issue Apr 18, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@guilhermedemouraa
Copy link
Contributor

guilhermedemouraa commented Apr 18, 2024

Describe the bug

The events recorder example does not work. It creates an empty log file with no events on it.

Service log:

Apr 18 23:06:43 green-guava python[1672347]: /start None: configs {
Apr 18 23:06:43 green-guava python[1672347]:   name: "record_default"
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=gps"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=oak0"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=oak1"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]: }
Apr 18 23:06:43 green-guava python[1672347]: INFO:recorder:/start None: configs {
Apr 18 23:06:43 green-guava python[1672347]:   name: "record_default"
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=gps"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=oak0"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]:   subscriptions {
Apr 18 23:06:43 green-guava python[1672347]:     uri {
Apr 18 23:06:43 green-guava python[1672347]:       path: "*"
Apr 18 23:06:43 green-guava python[1672347]:       query: "service_name=oak1"
Apr 18 23:06:43 green-guava python[1672347]:     }
Apr 18 23:06:43 green-guava python[1672347]:     every_n: 1
Apr 18 23:06:43 green-guava python[1672347]:   }
Apr 18 23:06:43 green-guava python[1672347]: }
Apr 18 23:06:43 green-guava python[1672347]: WARNING:record_default:Invalid subscription: gps
Apr 18 23:06:43 green-guava python[1672347]: WARNING:record_default:Invalid subscription: oak0
Apr 18 23:06:43 green-guava python[1672347]: WARNING:record_default:Invalid subscription: oak1
Apr 18 23:09:03 green-guava python[1672347]: /stop
Apr 18 23:09:03 green-guava python[1672347]: INFO:recorder:/stop
Apr 18 23:09:03 green-guava python[1672347]: INFO:record_default:stopping recording
Apr 18 23:09:03 green-guava python[1672347]: INFO:record_default:done recording

Also:

farm-ng-user-gui@green-guava:/mnt/data$ ls -lh 2024_04_18_23_11_48_584295_green-guava.0000.bin 
-rw-rw-r-- 1 adminfarmng adminfarmng 0 Apr 18 23:11 2024_04_18_23_11_48_584295_green-guava.0000.bin

And

(venv) farm-ng-user-gui@green-guava:/mnt/data$ python /opt/farmng/services/foxglove/mcap_conversor.py --events-file 2024_04_18_23_11_48_584295_green-guava.0000.bin 
Loading events file: 2024_04_18_23_11_48_584295_green-guava.0000.bin ...
Traceback (most recent call last):
  File "/opt/farmng/services/foxglove/mcap_conversor.py", line 73, in <module>
    main(Path(args.events_file))
  File "/opt/farmng/services/foxglove/mcap_conversor.py", line 30, in main
    raise RuntimeError(f"No events in file: {events_file}")
RuntimeError: No events in file: 2024_04_18_23_11_48_584295_green-guava.0000.bin

Further, the config file for the filter example, is incorrectly formatted:

(venv) gdemoura@MacbookPro:~/farm-ng/workspace/farm_ng_amiga/py/examples/event_recorder$ python main.py --service-config service_config.json start_recording --recording-profile record_filter_config.json 
Traceback (most recent call last):
  File "/home/gdemoura/farm-ng/workspace/amiga/venv/lib/python3.8/site-packages/google/protobuf/json_format.py", line 554, in _ConvertFieldValuePair
    raise ParseError(
google.protobuf.json_format.ParseError: Message type "farm_ng.core.proto.EventServiceConfigList" has no field named "config" at "EventServiceConfigList".
 Available Fields(except extensions): "['configs']"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 53, in <module>
    recording_profile = proto_from_json_file(args.recording_profile, EventServiceConfigList())
  File "/home/gdemoura/farm-ng/workspace/farm_ng_core/py/farm_ng/core/events_file_reader.py", line 56, in proto_from_json_file
    return json_format.ParseDict(json_pb, empty_proto_message)
  File "/home/gdemoura/farm-ng/workspace/amiga/venv/lib/python3.8/site-packages/google/protobuf/json_format.py", line 471, in ParseDict
    parser.ConvertMessage(js_dict, message, '')
  File "/home/gdemoura/farm-ng/workspace/amiga/venv/lib/python3.8/site-packages/google/protobuf/json_format.py", line 512, in ConvertMessage
    self._ConvertFieldValuePair(value, message, path)
  File "/home/gdemoura/farm-ng/workspace/amiga/venv/lib/python3.8/site-packages/google/protobuf/json_format.py", line 641, in _ConvertFieldValuePair
    raise ParseError(str(e)) from e
google.protobuf.json_format.ParseError: Message type "farm_ng.core.proto.EventServiceConfigList" has no field named "config" at "EventServiceConfigList".
 Available Fields(except extensions): "['configs']"

Relevant Versions

Amiga Brain pinned to v2.2.1 Amiga OS Dragonfruit Patch Release (beta)

Local PC where code was executed:

commit 6f032116b4a0915669713a9a88167c1463aadc76 (HEAD, origin/main, origin/HEAD)
Author: Kyle Coble <53625197+Hackerman342@users.noreply.github.com>
Date:   Thu Apr 11 16:27:17 2024 -0400

    Add `TRACK_CANCELLED` to `TrackStatusEnum` (#190)

Reproduction steps

1. Execute the [events recorder](https://amiga.farm-ng.com/docs/examples/events_recorder/) example
2.
3.
...

Expected behavior

A log file containing events for the selected services and their respective streams

Additional context

No response

@guilhermedemouraa guilhermedemouraa added the bug Something isn't working label Apr 18, 2024
@MScatolin
Copy link
Contributor

MScatolin commented Apr 19, 2024

I did some experimentation, fixed request_reply arg to "/start" here:

async def start_recording(service_config: EventServiceConfig, recording_profile: EventServiceConfigList) -> None:
    reply = await EventClient(service_config).request_reply("start", recording_profile, decode=True)
    print(reply)

and "/" at the path (also signing in to /pvt only) here:

           {
                    "uri": {
                    "path": "/*",
                    "query": "service_name=gps"
                    },
                    "every_n": 1
                },

no luck. I was thikning about serching docks for EventClient.requestreply, bu help is appreciated.

@guilhermedemouraa
Copy link
Contributor Author

I did some experimentation, fixed request_reply arg to "/start" here:

async def start_recording(service_config: EventServiceConfig, recording_profile: EventServiceConfigList) -> None:
    reply = await EventClient(service_config).request_reply("start", recording_profile, decode=True)
    print(reply)

and "/" at the path (also signing in to /pvt only) here:

           {
                    "uri": {
                    "path": "/*",
                    "query": "service_name=gps"
                    },
                    "every_n": 1
                },

no luck. I was thikning about serching docks for EventClient.requestreply, bu help is appreciated.

If you're willing to investigate this further, this how recording is invoked in the Recorder App

@Hackerman342
Copy link
Collaborator

@MScatolin @guilhermedemouraa how this is handled is actively being changed in the AmigaOS codebase. Let's hold off on testing the examples until we are closer to ready with release v2.3.0

@guilhermedemouraa
Copy link
Contributor Author

guilhermedemouraa commented Apr 19, 2024

@MScatolin @guilhermedemouraa how this is handled is actively being changed in the AmigaOS codebase. Let's hold off on testing the examples until we are closer to ready with release v2.3.0

That's for sure. The issue, though, is that I tested the example on the old beta, and it didn't work. I'm just surprised that no customer has ever complained about it on our support channels.

@Hackerman342
Copy link
Collaborator

Complete with #195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants