Git Product home page Git Product logo

docker_opencor_run_model's Issues

Update to use the official OpenCOR+Python snapshot

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.

Ping @hsorby and @nickerso.

application does not return non-zero code upon failure

Application run does return non-zero code upon failure.

Steps to reproduce

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

Some insight

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.