virocon-organization / viroconweb

A software to compute environmental contours. Django web-application package.
MIT License
2 stars 1 forks source link

Computing a contour can cause a timeout #145

Closed ahaselsteiner closed 6 years ago

ahaselsteiner commented 6 years ago

I'm submitting a ...

Expected behavior

How should it work (with the bug fixed or the feature implemented)? Users should not be allowed to perform calculations which cause a time out. In case a timeout occurs the user should be preseneted with an appropriate error message.

Screenshot

Actual behavior

How does it currently work (with the bug causing problems or without the feature)? Timeouts can occur and the user does get the information "application error".

Screenshot Probabilistic model: image

HDC setting: image

Error: image

Steps to reproduce the problem (how to see the actual behavior)

  1. Define the given probabilistic model (see screenshot)
  2. Calculate a HDC on heroku (see screenshot)
  3. Get the error
ahaselsteiner commented 6 years ago

I will write a function, which roughly approximates the required computing time to calculate an environmental contour. If it would be too long, the user is not allowed to perform the calculation if RUN_MODE is online-dev or production (in local-dev there is no limit).

A similar approach should be applied to too much computing time required for fitting, see #138

ahaselsteiner commented 6 years ago

@janlehmk As discussed your idea of using the multiprocessing timeout method sounds great. Go ahead and try to implementing it.

Consequently, I will not write the function, which approximates computing time.

ahaselsteiner commented 6 years ago

I am implementing a function so estimate the required computing time nevertheless. In case the timeout method works we do not need to use it.

janlehmk commented 6 years ago

@kawindme @ahaselsteiner I created a pull request in the Viroconcom repository for this issue. The timeout can be defined as parameter by creating a Fit/Contour -object. The default value for this parameter is '1e6' the highest possible value on Windows systems.

https://github.com/ahaselsteiner/viroconcom/pull/19

ahaselsteiner commented 6 years ago

@janlehmk Thanks. @kawindme had a look at it. Although he does not like the changes, which were necessary, too much, he does not have a better idea, so we go with this solution. I will implement to catch the TimeOutError you are reaising in viroconweb properly and will then merge your viroconcom pull request.

ahaselsteiner commented 6 years ago

Impemented for fit: image

And for the contour: image

ahaselsteiner commented 6 years ago

Done and merged into master.