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

[Question] why is simulation_app.close() in if __name__ == "__main__" ? #314

Closed
1 task
VladimirFokow opened this issue Mar 21, 2024 · 0 comments
Closed
1 task

Comments

@VladimirFokow
Copy link
Contributor

VladimirFokow commented Mar 21, 2024

Question

AppLauncher initialization is needed at the start of the file for further imports to work.
However, the simulation_app.close() is written in if __name__ == "__main__".

What is the purpose of closing it only in if __name__ == "__main__" but not outside of it?

For example, in create_empty.py

# launch omniverse app
app_launcher = AppLauncher(args_cli)
simulation_app = app_launcher.app
if __name__ == "__main__":
    # run the main function
    main()
    # close sim app
    simulation_app.close()

I recently opened #308, where I'm concerned about ensuring that the simulation app is closed.

The purpose of if __name__ == "__main__" is to avoid running its code if the script is imported.
So currently, if the script is imported, the app will be initialized, but will not be closed, correct?
Is this intended?

Why not wrap the app_launcher = AppLauncher(args_cli) into a with context manager? (to ensure that it is closed automatically)

Task completion

  • If this should be done - it should be done in all files (everywhere)
@VladimirFokow VladimirFokow changed the title [Question] Shouldn't the AppLauncher also be initialized in if __name__ == "__main__"? [Question] Shouldn't AppLauncher also be initialized in if __name__ == "__main__"? Mar 21, 2024
@VladimirFokow VladimirFokow changed the title [Question] Shouldn't AppLauncher also be initialized in if __name__ == "__main__"? [Question] Shouldn't AppLauncher be initialized in if __name__ == "__main__"? Mar 21, 2024
@VladimirFokow VladimirFokow changed the title [Question] Shouldn't AppLauncher be initialized in if __name__ == "__main__"? [Question] why is simulation_app.close() in if __name__ == "__main__" ? Mar 22, 2024
ADebor pushed a commit to ADebor/IsaacLab that referenced this issue Apr 8, 2024
…aac-sim#314)

# Description

Currently, the ray-cast and camera sensors don't support having regex
expression in the leaves. While we must address this (isaac-sim#313), we add this
to our future plans.

For now, this MR adds a check to make sure users are aware and don't do
a wrong operation.

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
fatimaanes pushed a commit to fatimaanes/omniperf that referenced this issue Aug 8, 2024
…aac-sim#314)

# Description

Currently, the ray-cast and camera sensors don't support having regex
expression in the leaves. While we must address this (isaac-sim#313), we add this
to our future plans.

For now, this MR adds a check to make sure users are aware and don't do
a wrong operation.

## Type of change

- New feature (non-breaking change which adds functionality)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
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

No branches or pull requests

1 participant