Skip to content

Cronjob not running #142

@mtlballer

Description

@mtlballer

Script no longer runs automatically, but still works manually. The log shows the error below. Feel like I'm missing something simple but I can't currently find it.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
Job "maintenance (trigger: cron[month='*', day='*', day_of_week='*', hour='4', minute='0'], next run at: 2023-12-16 04:00:00 EST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/app/app/scripts.py", line 2044, in maintenance
    from app import db, module
  File "/app/app/module.py", line 19, in <module>
    config = Plex.query.filter(Plex.id == '1')
  File "/usr/local/lib/python3.9/site-packages/flask_sqlalchemy/model.py", line 31, in __get__
    cls, session=cls.__fsa__.session()  # type: ignore[arg-type]
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/scoping.py", line 211, in __call__
    sess = self.registry()
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/_collections.py", line 639, in __call__
    key = self.scopefunc()
  File "/usr/local/lib/python3.9/site-packages/flask_sqlalchemy/session.py", line 102, in _app_ctx_id
    return id(app_ctx._get_current_object())  # type: ignore[attr-defined]
  File "/usr/local/lib/python3.9/site-packages/werkzeug/local.py", line 513, in _get_current_object
    raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.

This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions