Closes #415: Make data source health monitoring an extension.#444
Closes #415: Make data source health monitoring an extension.#444
Conversation
42c191e to
faf9c84
Compare
20ae13c to
0401214
Compare
0401214 to
360f245
Compare
There was a problem hiding this comment.
We should be more defensive here in case no other extension has created app.periodic_tasks and use something like:
periodic_tasks = getattr(app, 'periodic_tasks', {})
for params in periodic_tasks:
# ...Also, we need to open a PR upstream using this change as a new feature "ability for extensions to add periodic tasks". The code change is small, but will be effective. I'm sure upstream has some use for this as well for their own modifications.
There was a problem hiding this comment.
We can just rely on the fact that the app.periodic_tasks dict has the API of "variables to be passed to send.add_periodic_task" and write those three lines as:
sender.add_periodic_task(**params)That way we stay future-proof in case other parameters are added to add_periodic_task.
There was a problem hiding this comment.
Unfortunately the argument names for add_periodic_task() are schedule and sig, not signature so this didn't work when I tried it.
We could either change the extension to ensure it labels the arguments correctly or we can do this:
sender.add_periodic_task(*params.values()) but I think this is more fragile because the ordering of the params.values() array is not guaranteed.
There was a problem hiding this comment.
Ah, I missed that, we should update the extension to match the argument name then, unpacking the keyword arguments is indeed too fragile.
360f245 to
5a6f1d6
Compare
This PR requires the datasource extension (mozilla/redash-stmo#5) to be merged and deployed first.
This PR then does 2 things:
Note: Once the extension is deployed, this PR should also be updated to include the new redash-stmo dependency version