-
Notifications
You must be signed in to change notification settings - Fork 0
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
Move executable code in separate scripts and add argparse option for … #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, well done :) I pointed to a few issues in the code, please solve them and then you can directly merge. Also, I recommend that we remove the main
bloc at the end of the files when this code is already in the new scripts (better to avoid code duplication). I think it concerns simulator.py
and simulator_server.py
. But let me know if you don't agree
README.md
Outdated
``` | ||
|
||
### Interact with it from a web interface | ||
|
||
And launch the web interface from another terminal : | ||
|
||
```bash | ||
panel serve vivarium/interface/panel_app.py --autoreload | ||
panel serve scrits/run_interface.py --autoreload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed I forgot to remove the main
bloc in some old files, thanks for noticing !
vivarium/interface/panel_app.py
Outdated
# if __name__ == "__main__": | ||
# # Serve the app | ||
# wm = WindowManager() | ||
# wm.app.servable(title="Vivarium") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove these commented lines?
…configs
Description
Aims to enhance the organization and usability of the project by restructuring executable scripts and integrating argparse functionality.
Firstly, it relocates executable parts of files in the vivarium directory to the root directory, separating source code from execution scripts for improved clarity and ease of use. For instance, the main execution logic currently embedded within individual files like
vivarium/simulator/simulator.py
,vivarium/simulator/grpc_server/simulator_server.py
andvivarium/interface/panel_app.py
are moved to dedicated scripts namedsimulate.py
(to run simulations without server mode, on a cluster of GPUs for example),run_server.py
andinterface_app.py
(removed panel from the name as we discussed), respectively. This reorganization simplifies command-line usage for script executionSecondly,
argparse
options are added to executable scripts to define default simulation parameters and enable command-line parameter customization. It allows for easy adjustment of simulation parameters such as max number of agents, box size, and physics parameters without necessitating code modifications in various files. At the moment I only implemented it for the simulator_config, but it could be useful for other arguments as discussed in #35 (especially if we launch simulations in GPU clusters where we don't have access to an IDE).@Marsolo1 also added an option for the logging level to set it with argparse (with a default value of INFO). This way we only define it in the script we run instead of doing so in all the files from which we import functions/classes to run the script.
I also renamed the executable files with more explicit names (starting with 'run'):
interface_app.py
-->run_interface.py
simulate.py
-->run_simulation.py
After a discussion with Clément Romac, I decided to put all the executable script in a directory named
scripts
to make the organization of the project cleaner.For example if you want to run a simulation with 20 agents and 5 objects in a server, run :
Related Issue (if applicable)
#38
How to Test (!! This has been modified !!)
Launch the server
Launch the Panel interface