puppetboard fails to start with scheduler enabled
buzzdeee opened this issue · 0 comments
buzzdeee commented
Describe the bug
Try to update the Puppetboard package for OpenBSD from 4.2.6 to 4.3.0.
With the scheduler enabled, see below related configuration options:
ENABLE_CLASS = True
# mapping between the status of the events (from PuppetDB) and the columns of the table to display
CLASS_EVENTS_STATUS_COLUMNS = [
# ('skipped', 'Skipped'),
('failure', 'Failure'),
('success', 'Success'),
('noop', 'Noop'),
]
#CACHE_TYPE = 'MemcachedCache'
CACHE_TYPE = 'SimpleCache'
# Cache litefime in second
CACHE_DEFAULT_TIMEOUT = 3600
# List of scheduled jobs to trigger
# * `id`: job's ID
# * `func`: full path of the function to execute
# * `trigger`: should be 'interval' if you want to run the job at regular intervals
# * `seconds`: number of seconds between 2 triggered jobs
SCHEDULER_JOBS = [{
'id': 'do_build_async_cache_1',
'func': 'puppetboard.schedulers.classes:build_async_cache',
'trigger': 'interval',
'seconds': 300,
}]
SCHEDULER_ENABLED = True
SCHEDULER_LOCK_BIND_PORT = 49100
Puppetboard refuses to start:
/usr/local/bin/gunicorn --workers 1 puppetboard_wsgi:application
[2023-06-13 14:07:48 +0200] [73476] [INFO] Starting gunicorn 20.0.4
[2023-06-13 14:07:48 +0200] [73476] [INFO] Listening at: http://127.0.0.1:8000 (73476)
[2023-06-13 14:07:48 +0200] [73476] [INFO] Using worker: sync
[2023-06-13 14:07:48 +0200] [86370] [INFO] Booting worker with pid: 86370
scheduler enabled
[2023-06-13 14:07:50 +0200] [86370] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/apscheduler/util.py", line 290, in ref_to_obj
obj = __import__(modulename, fromlist=[rest])
ModuleNotFoundError: No module named 'puppetboard.schedulers'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/var/www/puppetboard/puppetboard_wsgi.py", line 13, in <module>
from puppetboard.app import app as application
File "/var/www/puppetboard/puppetboard/app.py", line 44, in <module>
get_scheduler()
File "/var/www/puppetboard/puppetboard/core.py", line 114, in get_scheduler
scheduler.init_app(app)
File "/usr/local/lib/python3.10/site-packages/flask_apscheduler/scheduler.py", line 84, in init_app
self._load_jobs()
File "/usr/local/lib/python3.10/site-packages/flask_apscheduler/scheduler.py", line 336, in _load_jobs
self.add_job(**job)
File "/usr/local/lib/python3.10/site-packages/flask_apscheduler/scheduler.py", line 168, in add_job
return self._scheduler.add_job(**job_def)
File "/usr/local/lib/python3.10/site-packages/apscheduler/schedulers/base.py", line 438, in add_job
job = Job(self, **job_kwargs)
File "/usr/local/lib/python3.10/site-packages/apscheduler/job.py", line 49, in __init__
self._modify(id=id or uuid4().hex, **kwargs)
File "/usr/local/lib/python3.10/site-packages/apscheduler/job.py", line 162, in _modify
func = ref_to_obj(func)
File "/usr/local/lib/python3.10/site-packages/apscheduler/util.py", line 292, in ref_to_obj
raise LookupError('Error resolving reference %s: could not import module' % ref)
LookupError: Error resolving reference puppetboard.schedulers.classes:build_async_cache: could not import module
[2023-06-13 14:07:50 +0200] [86370] [INFO] Worker exiting (pid: 86370)
[2023-06-13 14:07:50 +0200] [73476] [INFO] Shutting down: Master
[2023-06-13 14:07:50 +0200] [73476] [INFO] Reason: Worker failed to boot.
If I disable the scheduler, it starts happily.
Puppetboard version
Puppetboard 4.3.0,
Environment and installation method
python 3.10.11 on OpenBSD 7.3, amd64.