Skip to content

Adds record at close functionality to the RecorderManager #2826

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jtigue-bdai
Copy link
Collaborator

@jtigue-bdai jtigue-bdai commented Jun 30, 2025

Description

Introducing a close function to the recorder manager which exports the data to file when the environment is closed and closes the recorder terms.

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

mmungai-bdai and others added 2 commits June 30, 2025 17:03
* flushing data to file when env closes

* formatting changes

* addressed changes requested in PR

* calling the del function for reward manager

* modified doc string

* add test for close function of recorder manager

* Update source/extensions/omni.isaac.lab/omni/isaac/lab/managers/recorder_manager.py

Co-authored-by: James Smith <142246516+jsmith-bdai@users.noreply.github.com>

* minor docstring fix

---------

Co-authored-by: James Smith <142246516+jsmith-bdai@users.noreply.github.com>
@jtigue-bdai jtigue-bdai marked this pull request as ready for review June 30, 2025 21:09
@jtigue-bdai jtigue-bdai self-assigned this Jul 1, 2025
Copy link
Contributor

@ooctipus ooctipus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kellyguo11
Copy link
Contributor

@peterd-NV do you mind taking a quick look at this change to make sure it's ok for mimic?

@peterd-NV
Copy link
Contributor

Hi @kellyguo11 @jtigue-bdai, I just have a couple of questions to make sure that everything will work with Mimic workflows:

  1. The new recorder manager close function will always be called during env.close(). This will result in whatever existing episode data for each env to be written to the dataset file. This will not overwrite any previously written data/episodes to the dataset file, correct?
  2. The current episode when recording manager close is called may not be a complete episode. For example, when doing multi-env data generation, there may be envs in the middle of an episode when the script is shutdown. In these cases, we do not want these episodes written to file. Can we continue to prevent the close function from writing the remaining incomplete episodes to file by using the episode_succeeded mechanism in the export_epsiodes function of the recorder manager?

@jtigue-bdai
Copy link
Collaborator Author

Hi @kellyguo11 @jtigue-bdai, I just have a couple of questions to make sure that everything will work with Mimic workflows:

  1. The new recorder manager close function will always be called during env.close(). This will result in whatever existing episode data for each env to be written to the dataset file. This will not overwrite any previously written data/episodes to the dataset file, correct?
  2. The current episode when recording manager close is called may not be a complete episode. For example, when doing multi-env data generation, there may be envs in the middle of an episode when the script is shutdown. In these cases, we do not want these episodes written to file. Can we continue to prevent the close function from writing the remaining incomplete episodes to file by using the episode_succeeded mechanism in the export_epsiodes function of the recorder manager?

Thanks @peterd-NV

  1. Correct this shouldn't affect any previous episode data.
  2. I believe it should still follow the same rules for recording as the original so the episode_succeeded should still function but what I don't know is if the success_results will be set if not entering the record_pre_reset. We could add a cfg parameter export_in_close to be able to toggle this though. Similar to the export_in_record_pre_reset.

@peterd-NV
Copy link
Contributor

Thanks for the answers @jtigue-bdai.

Yes, if we could add a cfg parameter to toggle if export occurs in close that would be great. Ideally, if we could have this parameter default to be False that may be the safest option for existing Mimic workflow users. I believe most Mimic users are running parallel data generation/recording so having export in close default to False will guarantee their generated datasets don't contain unwanted incomplete demos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants