urbanopt / geojson-modelica-translator

GeoJSON to Modelica Translator that is focused on district energy system design and analysis.
https://www.nrel.gov/buildings/urbanopt.html
Other
20 stars 11 forks source link

Stop and remove containers if user cancels a simulation #563

Closed vtnate closed 1 year ago

vtnate commented 1 year ago

Any background context you want to provide?

When running tests developers often ctrl-c to cancel a test midway through a long-running simulation. The container is then left alive unnecessarily which is a resource drain.

What does this PR accomplish?

Catch KeyboardInterrupt while simulating and kill all containers from the gmt-om-runner image

How should this be manually tested?

vtnate commented 1 year ago

@nllong I have a couple questions:

  1. Is this functionality even necessary/valuable?
  2. The rm compound command works as expected when I manually use it in the terminal, but in the code as written it fails with unknown shorthand flag: 'a' in -a when I use it. Am I not understanding how subprocess.run() works? I've confirmed that the split transforms to a list as expected.
nllong commented 1 year ago

@nllong I have a couple questions:

  1. Is this functionality even necessary/valuable?
  2. The rm compound command works as expected when I manually use it in the terminal, but in the code as written it fails with unknown shorthand flag: 'a' in -a when I use it. Am I not understanding how subprocess.run() works? I've confirmed that the split transforms to a list as expected.

I think I just experienced this myself, so yes to 1.

  1. -- no idea!