Commit 963afbea authored by peterd-NV's avatar peterd-NV Committed by Kelly Guo

Adds aysnc event cleanup before Mimic shutdown (#515)

# Description

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Adds a cleanup of remaining async events in the Mimic data generation
code. The cleanup cancels remaining events after the environment is
closed and prior to sim app shutdown. This prevents left over events
from trying to use the env after it is closed.

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] 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

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->
parent a171f206
......@@ -127,7 +127,7 @@ def main():
)
try:
asyncio.ensure_future(asyncio.gather(*async_components["tasks"]))
data_gen_tasks = asyncio.ensure_future(asyncio.gather(*async_components["tasks"]))
env_loop(
env,
async_components["reset_queue"],
......@@ -137,6 +137,16 @@ def main():
)
except asyncio.CancelledError:
print("Tasks were cancelled.")
finally:
# Cancel all async tasks when env_loop finishes
data_gen_tasks.cancel()
try:
# Wait for tasks to be cancelled
async_components["event_loop"].run_until_complete(data_gen_tasks)
except asyncio.CancelledError:
print("Remaining async tasks cancelled and cleaned up.")
except Exception as e:
print(f"Error cancelling remaining async tasks: {e}")
if __name__ == "__main__":
......
[package]
# Semantic Versioning is used: https://semver.org/
version = "1.0.9"
version = "1.0.10"
# Description
category = "isaaclab"
......
Changelog
---------
1.0.10 (2025-07-08)
~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Updated generate dataset script to cancel remaining async tasks before closing the simulation app.
1.0.9 (2025-05-20)
~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment