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

Readers detect storage plugin automatically #972

Closed
1 task
defunctzombie opened this issue Mar 11, 2022 · 6 comments · Fixed by #1072
Closed
1 task

Readers detect storage plugin automatically #972

defunctzombie opened this issue Mar 11, 2022 · 6 comments · Fixed by #1072
Assignees
Labels
enhancement New feature or request

Comments

@defunctzombie
Copy link

defunctzombie commented Mar 11, 2022

Description

When using the ros2 bag CLI for info, playback, and recording it would be nice to detect the storage plugin based on the file extension.

For example if I record an MCAP file using the mcap storage plugin I record to .mcap files. When I want to go and play those files, I'd like to use

ros2 bag play /path/to/file.mcap

Rather than having to specify the plugin manually via:

ros2 bag play -s mcap /path/to/file.mcap

Similarly, f I specify I want to record to .mcap files, the storage plugin should be detected and used for recording.

If there are multiple plugins installed which could support the extension that should error and require the user to manually specify the name of their desired storage plugin via the command line flag.

Requirements

Definition: "bare bag" is a standalone file, rather than a directory containing a metadata.yaml file and one or more storage files.

  • Readers: automatically choose the storage implementation when a bare bag is specified as input (burst/convert/info/play/reindex )
@defunctzombie defunctzombie added the enhancement New feature or request label Mar 11, 2022
@clalancette
Copy link
Contributor

I think the idea to automatically load the plugin based on the input file is a good one. Another way to determine the right plugin to load would be to look at the beginning of the input file, looking for particular markers. This seems more reliable than the extension name, and is similar to how file works.

@emersonknapp
Copy link
Collaborator

Agreed - though I think it doesn't hurt to use extension as a hint. Could also do a "try all storage plugins" loop and see if one is successful at opening

@alluring-mushroom
Copy link

As the number of storage options grows and/or the number of users of alternate storage options grows, this becomes very valuable. This would be a worthwhile enhancement

@emersonknapp emersonknapp self-assigned this Aug 1, 2022
@emersonknapp
Copy link
Collaborator

emersonknapp commented Aug 4, 2022

Added requirements checklist for this ticket at the bottom of the original description. I think this should address all cases. If those points are completed, it opens up the non-directory ("bare") bag functionality in a way that users have been asking for basically forever.

@MichaelOrlov as current maintainer, let me know if you have any input on that design choice

@MichaelOrlov
Copy link
Contributor

@emersonknapp Thanks for pinging me in this issue.
The design proposals looks reasonable for me.

May be need to add consideration how to handle cases when:

  1. Explicitly specified bag folder without file extension. For instance ros2 bag record --output my_data /chatter or ros2 bag info my_data. In former case could be multiple files inside folder due to the bag split feature.
  2. Explicitly specified bag folder with file extension. For instance ros2 bag record --output my_data.bag /chatter or ros2 bag info my_data.bag. Where my_data.bag is a folder name.

@emersonknapp
Copy link
Collaborator

I am removing the "Writer" portion of this issue, so that it is more self-contained.

@emersonknapp emersonknapp changed the title Detect storage plugin via extension Readers detect storage plugin automatically Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants