mirror of
https://github.com/sartography/uva-covid19-testing-communicator.git
synced 2025-02-22 11:58:10 +00:00
Modify the scheduler to check for local files, and send emails. Don't worry about IVY transfers anymore.
This commit is contained in:
parent
348c5deb1b
commit
27cd4e2bfd
@ -21,22 +21,10 @@ def within_notification_window():
|
||||
|
||||
def update():
|
||||
with app.app_context():
|
||||
# Always run the updates, do not wait for the window anymore.
|
||||
admin._update_data()
|
||||
# if within_notification_window():
|
||||
# app.logger.info("Do not load new files during the notification window.")
|
||||
# else:
|
||||
# admin._update_data()
|
||||
|
||||
def notify():
|
||||
with app.app_context():
|
||||
# Just immediately notify by email, do not wait. Never notify by text.
|
||||
# Do not request IVY transfers, they happen automatically, just load the local files if they exist,
|
||||
# and send any emails that need sending.
|
||||
admin.load_local_files()
|
||||
admin._notify_by_email()
|
||||
# if within_notification_window():
|
||||
# app.logger.info("Within Notification Window, sending messages.")
|
||||
# admin._notify_by_text()
|
||||
# else:
|
||||
# app.logger.info("Not within the notification window, not sending messages.")
|
||||
|
||||
|
||||
if app.config['RUN_SCHEDULED_TASKS']:
|
||||
@ -44,11 +32,7 @@ if app.config['RUN_SCHEDULED_TASKS']:
|
||||
scheduler.add_jobstore('sqlalchemy', url=db.engine.url)
|
||||
scheduler.add_job(
|
||||
update, 'interval', minutes=app.config['SCHEDULED_TASK_MINUTES'],
|
||||
id='update_data', replace_existing=True
|
||||
)
|
||||
scheduler.add_job(
|
||||
notify, 'interval', minutes=app.config['SCHEDULED_TASK_MINUTES'],
|
||||
id='notify', replace_existing=True
|
||||
id='update', replace_existing=True
|
||||
)
|
||||
scheduler.start()
|
||||
|
||||
|
@ -167,6 +167,7 @@ class IvyService(object):
|
||||
def get_access_token(self):
|
||||
"""Purely for the command line, in the event we need to create a new access token,
|
||||
but this should be exceedingly rare, a good token can last a very very long time."""
|
||||
|
||||
client = globus_sdk.NativeAppAuthClient(self.GLOBUS_CLIENT_ID)
|
||||
client.oauth2_start_flow(refresh_tokens=True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user