TACC / tacc_stats

TACC Stats is an automated resource-usage monitoring and analysis package.
GNU Lesser General Public License v2.1
41 stars 15 forks source link

manage.py migrate issues #12

Closed einjen closed 1 year ago

einjen commented 5 years ago

I'm having trouble with the last few bits of this install.

the monitor part and rabbitmq is working, but the django part is cumbersome: Not sure if this is an issue or an error on my behalf.

Using centos7 python 3.6 in virtualenv python 3.7 has same issue

manage.py runserver Performing system checks...

Unhandled exception in thread started by <function check_errors..wrapper at 0x7fbb6e70de18> Traceback (most recent call last): File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute return self.cursor.execute(sql, params) psycopg2.ProgrammingError: relation "machine_host" does not exist LINE 1: SELECT DISTINCT "machine_host"."name" FROM "machine_host" OR... ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper fn(*args, kwargs) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/management/base.py", line 379, in check include_deployment_checks=include_deployment_checks, File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/management/base.py", line 366, in _run_checks return checks.run_checks(kwargs) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/checks/registry.py", line 71, in run_checks new_errors = check(app_configs=app_configs) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/urls/resolvers.py", line 396, in check for pattern in self.url_patterns: File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/utils/functional.py", line 37, in get res = instance.dict[self.name] = self.func(instance) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/urls/resolvers.py", line 533, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/utils/functional.py", line 37, in get res = instance.dict[self.name] = self.func(instance) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/urls/resolvers.py", line 526, in urlconf_module return import_module(self.urlconf_name) File "/opt/rh/rh-python36/root/usr/lib64/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/einjen/tacc/Fram/tacc_stats/tacc_stats/site/tacc_stats_site/urls.py", line 6, in from tacc_stats.site.machine.views import dates File "/home/einjen/tacc/Fram/tacc_stats/tacc_stats/site/machine/views.py", line 34, in for host in Host.objects.values_list('name', flat=True).distinct(): File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/models/query.py", line 268, in iter self._fetch_all() File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/models/query.py", line 1186, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/models/query.py", line 176, in iter for row in compiler.results_iter(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size): File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1017, in results_iter results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch, chunk_size=chunk_size) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1065, in execute_sql cursor.execute(sql, params) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute return super().execute(sql, params) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute return self.cursor.execute(sql, params) File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/utils.py", line 89, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/einjen/tacc/Fram/lib64/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "machine_host" does not exist LINE 1: SELECT DISTINCT "machine_host"."name" FROM "machine_host" OR...

rtevans commented 5 years ago

OK, if you look at the updated

tacc_stats/tacc_stats/site/machine/views.py

you will see I've commented out line 31-44. Evidently they prevent the DB from being initialized.

Another thing that might help with the installation is to go into psql and run

alter database fram_db owner to taccstats;

(where fram_db is the name of the database) There are lots of permissions issues that I've run into in Django/Postgres that seem to change all the time but this gives all rights in the DB to the user taccstats.

Thank you for identifying and reporting this issue.