noi-techpark / stodt

Official repository for the STODT project
GNU General Public License v3.0
0 stars 3 forks source link

The webapp should show, that there are no calculations yet to be shown #10

Open Piiit opened 4 years ago

Piiit commented 4 years ago

If I install the webapp the first time, I cannot see any data and when I click on for example "predict" I get a server error 500, and the log shows:

[2020-03-09 10:47:56,226] ERROR in app: Exception on /predict [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/code/app.py", line 38, in predict
    labels, outputs, timestamps = _predict_dates([date], predicter)
  File "/code/app.py", line 68, in _predict_dates
    timestamps, labels, outputs = predicter.predict(days)
  File "/code/modules/predict.py", line 31, in predict
    numpy_features = np.load(data_dir + "/features.npy")
  File "/usr/local/lib/python3.7/site-packages/numpy/lib/npyio.py", line 428, in load
    fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: './data/features.npy'
34.255.139.75 - - [09/Mar/2020 10:47:56] "GET /predict?date=2020-03-08 HTTP/1.1" 500 -

That should not happen, instead the webapp should say that the server currently updates data and does number crunching...

giacomo-montibeller commented 4 years ago

The problem is that as you can see here: FileNotFoundError: [Errno 2] No such file or directory: './data/features.npy' this file isn't produced, are you sure you followed the steps below? (that file should be produced during the to-numpy step after the required download step, which we recommend you to do using the provided configurations contained in the config.json file)

image

Piiit commented 4 years ago

@giacomo-montibeller I do not know, I just did a deployment on production, which executes start.sh and adds a cron job which does the steps above through update.sh. I do not run stuff manually on that server. The thing I am asking here is that the webapp and backend jobs should inform the user that the system has not enough data to give information until things have been calculated. And that a server should not just throw exceptions to inform but explain what is missing....