-
- Downloads
Update model caching schedule API (#23734)
* Replace interval-hours and anchor-time with cron Removed the two settings and replaced with a single cron schedule setting Renamed the /set-interval endpoint to /set-refresh-schedule * Ignore "year" part in schedule endpoint * Fix variable * Use a temp scheduler and initialize the refresh job Running into errors when updating the triggers for each database's refresh job because the "job" itself didn't exist. Reminder of what's going on here: There's a single refresh job. It has a trigger for each database. So updating the trigger would fail since it doesn't exist since there was no job to hold the triggers. This error is quite clear in the tests run locally: ``` ERROR in metabase.api.persist-test/set-refresh-schedule-test (util.clj:421) Uncaught exception, not in assertion. clojure.lang.ExceptionInfo: Error in with-temporary-setting-values: Couldn't store trigger 'DEFAULT.metabase.task.PersistenceRefresh.database.trigger.1' for 'DEFAULT.metabase.task.PersistenceRefresh.job' job:The job (DEFAULT.metabase.task.PersistenceRefresh.job) referenced by the trigger does not exist. location: metabase.public-settings/persisted-models-enabled setting: "persisted-models-enabled" value: true ``` But this logging is absent from the logging in Github annoyingly: ``` FAIL in metabase.api.persist-test/set-refresh-schedule-test (persist_test.clj:26) Setting new cron schedule reschedules refresh tasks Setting :persisted-models-enabled = true expected: "0 0 0/12 * * ? *" actual: (nil) ``` Whic doesn't give us the error, just the test result. * update to newer API `set-interval` -> `set-refresh-schedule` ``` ;; old {:hours 4} ;; new {:cron "0 0 0/1 * * ? *"} ``` Co-authored-by:Case Nelson <case@metabase.com> Co-authored-by:
dan sutton <dan@dpsutton.com>
Showing
- enterprise/backend/test/metabase_enterprise/advanced_permissions/api/setting_test.clj 5 additions, 2 deletions...base_enterprise/advanced_permissions/api/setting_test.clj
- src/metabase/api/database.clj 1 addition, 2 deletionssrc/metabase/api/database.clj
- src/metabase/api/persist.clj 18 additions, 26 deletionssrc/metabase/api/persist.clj
- src/metabase/public_settings.clj 3 additions, 9 deletionssrc/metabase/public_settings.clj
- src/metabase/task/persist_refresh.clj 23 additions, 17 deletionssrc/metabase/task/persist_refresh.clj
- test/metabase/api/persist_test.clj 44 additions, 0 deletionstest/metabase/api/persist_test.clj
- test/metabase/task/persist_refresh_test.clj 12 additions, 15 deletionstest/metabase/task/persist_refresh_test.clj
test/metabase/api/persist_test.clj
0 → 100644
Please register or sign in to comment