Worker hourly event run -- app context error #12

Closed
opened 2023-03-20 17:33:53 +00:00 by williamp · 2 comments
Owner
createEvents script ran successfully
Job "createEvents (trigger: date[2023-03-20 14:59:00 UTC], next run at: 2023-03-20 14:59:00 UTC)" raised an exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/create_events.py", line 2, in createEvents
    periods = Period.query.all()
              ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/model.py", line 31, in __get__
    cls, session=cls.__fsa__.session()  # type: ignore[arg-type]
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 218, in __call__
    sess = self.registry()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/_collections.py", line 639, in __call__
    key = self.scopefunc()
          ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/session.py", line 81, in _app_ctx_id
    return id(app_ctx._get_current_object())  # type: ignore[attr-defined]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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.
``` createEvents script ran successfully Job "createEvents (trigger: date[2023-03-20 14:59:00 UTC], next run at: 2023-03-20 14:59:00 UTC)" raised an exception Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, **job.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/create_events.py", line 2, in createEvents periods = Period.query.all() ^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/model.py", line 31, in __get__ cls, session=cls.__fsa__.session() # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/scoping.py", line 218, in __call__ sess = self.registry() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/_collections.py", line 639, in __call__ key = self.scopefunc() ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask_sqlalchemy/session.py", line 81, in _app_ctx_id return id(app_ctx._get_current_object()) # type: ignore[attr-defined] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/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. ```
williamp added the
bug
label 2023-03-20 17:33:59 +00:00
Author
Owner

#14 applied in hopes to remedy issue. has been deployed for testing

https://git.dubyatp.xyz/williamp/BellScheduler/pulls/14 applied in hopes to remedy issue. has been deployed for testing
Author
Owner

Script is now running createEvents on the :59 of every hour, as intended.

Script is now running createEvents on the :59 of every hour, as intended.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: williamp/BellScheduler#12
No description provided.