mara / mara-pipelines

A lightweight opinionated ETL framework, halfway between plain scripts and Apache Airflow
MIT License
2.07k stars 100 forks source link

Install from PyPI missing statics, run_time_chart.sql #52

Closed mmanhertz closed 3 years ago

mmanhertz commented 3 years ago

It appears when I pip install mara-pipelines from pypi (instead of from github as is done in the example project), the statics don't get installed and neither does mara_pipelines/ui/run_time_chart.sql, which causes a bunch of 404s and a 500, when trying to access the flask page:

➜  app git:(master) ✗ flask run
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET / HTTP/1.1" 302 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/common.css HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/node-page.css HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/timeline-chart.css HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/node-page.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/utils.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/run-time-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/system-stats-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/kolorwheel.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/timeline-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:58] "GET /pipelines/static/node-page.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/static/utils.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/static/run-time-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/static/system-stats-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/static/timeline-chart.js HTTP/1.1" 404 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/static/kolorwheel.js HTTP/1.1" 404 -
[2020-10-13 13:41:59,141] ERROR in app: Exception on /pipelines/run-time-chart [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, 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 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/site-packages/mara_page/acl.py", line 108, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/mara_pipelines/ui/run_time_chart.py", line 30, in run_time_chart
    query = (pathlib.Path(__file__).parent / 'run_time_chart.sql').read_text()
  File "/usr/local/lib/python3.7/pathlib.py", line 1221, in read_text
    with self.open(mode='r', encoding=encoding, errors=errors) as f:
  File "/usr/local/lib/python3.7/pathlib.py", line 1208, in open
    opener=self._opener)
  File "/usr/local/lib/python3.7/pathlib.py", line 1063, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/site-packages/mara_pipelines/ui/run_time_chart.sql'
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/run-time-chart HTTP/1.1" 500 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/pipeline-children-table HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/dependency-graph HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/system-stats HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/timeline-chart HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/last-runs-selector HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /pipelines/run-output-limited HTTP/1.1" 200 -
172.19.0.1 - - [13/Oct/2020 13:41:59] "GET /mara-app/navigation-bar HTTP/1.1" 200 -
martin-loetzsch commented 3 years ago

Thanks for noticing. Apparently there is now a two-liner for this: https://stackoverflow.com/a/57932258/243519