Replies: 4 comments
-
If this was done, we could change the Dockerfile (or add a new Dockerfile) that runs it in that same headless mode:
The variable $SHEADLESS could default to the empty string. |
Beta Was this translation helpful? Give feedback.
-
I think it is simpler to have a 1 line change, server.launch(open_browser=True) instead of the additional conditional to check the sysarg. Fewer boilerplate lines, and also the argument can be toggled quickly if the model needs to be run on a Docker container. |
Beta Was this translation helpful? Give feedback.
-
Changed it accordingly. Thanks for the comments. |
Beta Was this translation helpful? Give feedback.
-
Merged in, so I'm closing this. |
Beta Was this translation helpful? Give feedback.
-
Would it be too much to ask model creators to change their run.py files to take an optional argument using something like sys.argv[], perhaps labelled headless. So that to run the server in a headless mode, one could run
mesa runserver --headlesss project
Then main.py in the mesa project could be modified to look for the
--headless
option and include it:In turn, run,.py would look for that argument. If the option was present, they could use server.launch() with the open_browser parameter set to false.
server.launch(open_browser = False)
Here is an example: https://github.com/projectmesa/mesa-examples/pull/29/files . If this seems acceptable, an issue could be raised to modify the examples in mesa-examples in a similar fashion and to update documentation in repo mesa accordingly.
This change would allow people to more easily run a model inside a docker container. Or it would be a lighter way of running a long model if you didn't care about seeing the output until the work is done.
Beta Was this translation helpful? Give feedback.
All reactions