Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
046254ff
Unverified
Commit
046254ff
authored
6 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Load task namespaces *before* initializing Quartz scheduler
parent
631a618e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/metabase/task.clj
+10
-4
10 additions, 4 deletions
src/metabase/task.clj
with
10 additions
and
4 deletions
src/metabase/task.clj
+
10
−
4
View file @
046254ff
...
...
@@ -53,9 +53,11 @@
{
:arglists
'
([
job-name-string
])}
keyword
)
(
defn-
find-and-load-tasks!
(
defn-
find-and-load-task
-namespace
s!
"Search Classpath for namespaces that start with `metabase.tasks.`, then `require` them so initialization can happen."
[]
;; make sure current thread is using canonical MB classloader
(
classloader/the-classloader
)
;; first, load all the task namespaces
(
doseq
[
ns-symb
@
u/metabase-namespace-symbols
:when
(
.startsWith
(
name
ns-symb
)
"metabase.task."
)]
...
...
@@ -63,8 +65,11 @@
(
log/debug
(
trs
"Loading tasks namespace:"
)
(
u/format-color
'blue
ns-symb
))
(
require
ns-symb
)
(
catch
Throwable
e
(
log/error
e
(
trs
"Error loading tasks namespace {0}"
ns-symb
)))))
;; next, call all implementations of `init!`
(
log/error
e
(
trs
"Error loading tasks namespace {0}"
ns-symb
))))))
(
defn-
init-tasks!
"Call all implementations of `init!`"
[]
(
doseq
[[
k
f
]
(
methods
init!
)]
(
try
;; don't bother logging namespace for now, maybe in the future if there's tasks of the same name in multiple
...
...
@@ -158,8 +163,9 @@
(
set-jdbc-backend-properties!
)
(
let
[
new-scheduler
(
qs/initialize
)]
(
when
(
compare-and-set!
quartz-scheduler
nil
new-scheduler
)
(
find-and-load-task-namespaces!
)
(
qs/start
new-scheduler
)
(
f
in
d-and-load
-tasks!
)))))
(
in
it
-tasks!
)))))
(
defn
stop-scheduler!
"Stop our Quartzite scheduler and shutdown any running executions."
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment