hsorby / docker_opencor_run_model Goto Github PK
View Code? Open in Web Editor NEWA Docker file for running a CellML simulation and passing parameters through the command line.
License: Apache License 2.0
A Docker file for running a CellML simulation and passing parameters through the command line.
License: Apache License 2.0
Python support has recently been officially added to OpenCOR. So, rather than referencing and using https://github.com/dbrnz/opencor/releases/download/snapshot-2019-06-11/OpenCOR-2019-06-11-Linux.tar.gz, we should now be using https://github.com/opencor/opencor/releases/download/snapshot-2019-12-20/OpenCOR-2019-12-20-Linux.tar.gz. We should also update the run_model.py
script to use our updated Python module and wrappers.
Application run does return non-zero code upon failure.
Running w/o arguments displays help and exit code 1
$ docker run hsorby/opencor-python
...
$ echo $?
1
Running w/ arguments runs through and returns exit code 0
$ docker run hsorby/opencor-python 1000.0
... [json result in stdout] ...
$ echo $?
0
Running w/ an invalid input runs though, reports error message in the std::err
BUT still returns exit code 0
$ docker run hsorby/opencor-python 5
Traceback (most recent call last):
File "run_model.py", line 39, in <module>
main(period)
File "run_model.py", line 21, in main
s.run()
RuntimeError: std::runtime_error: at t = 7.89335, mxstep steps taken before reaching tout
$ echo $?
0
In this case, the expected behavior would be to get a non-zero. This way, the client can detect that something went wrong and e.g. show the user the std::err
In order to understand better this, I built myself the image and tagged as opencor-python:dev
, run the container and executed the command in the entrypoint.sh
.
$ docker run -it --entrypoint /bin/bash opencor-python:dev
I noticed that i can reproduce the same in the executable
root@f801628872b5:/home/opencor# ./OpenCOR-2019-05-23-Linux/bin/OpenCOR -c PythonRunScript::script run_model.py 5
Traceback (most recent call last):
File "run_model.py", line 39, in <module>
main(period)
File "run_model.py", line 21, in main
s.run()
RuntimeError: std::runtime_error: at t = 7.89335, mxstep steps taken before reaching tout
root@f801628872b5:/home/opencor# echo $?
0
See that python interpreter, would return 1 if there is an exception raised:
root@f801628872b5:/home/opencor# OpenCOR-2019-05-23-Linux/python/bin/python -c "raise Exception"
Traceback (most recent call last):
File "<string>", line 1, in <module>
Exception
root@f801628872b5:/home/opencor# echo $?
1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.