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
6e3c6e63
Unverified
Commit
6e3c6e63
authored
5 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Include Quartz task trigger misfire instruction in debugging page
parent
bb90acae
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/admin/tasks/containers/JobTriggersModal.jsx
+2
-0
2 additions, 0 deletions
.../src/metabase/admin/tasks/containers/JobTriggersModal.jsx
src/metabase/task.clj
+25
-3
25 additions, 3 deletions
src/metabase/task.clj
with
27 additions
and
3 deletions
frontend/src/metabase/admin/tasks/containers/JobTriggersModal.jsx
+
2
−
0
View file @
6e3c6e63
...
...
@@ -24,6 +24,7 @@ const renderTriggersTable = triggers => {
<
th
>
{
t
`End Time`
}
</
th
>
<
th
>
{
t
`Final Fire Time`
}
</
th
>
<
th
>
{
t
`May Fire Again?`
}
</
th
>
<
th
>
{
t
`Misfire Instruction`
}
</
th
>
</
tr
>
</
thead
>
<
tbody
>
...
...
@@ -40,6 +41,7 @@ const renderTriggersTable = triggers => {
<
td
>
{
trigger
[
"
end-time
"
]
}
</
td
>
<
td
>
{
trigger
[
"
final-fire-time
"
]
}
</
td
>
<
td
>
{
trigger
[
"
may-fire-again?
"
]
?
t
`Yes`
:
t
`No`
}
</
td
>
<
td
>
{
trigger
[
"
misfire-instruction
"
]
}
</
td
>
</
tr
>
))
}
</
tbody
>
...
...
This diff is collapsed.
Click to expand it.
src/metabase/task.clj
+
25
−
3
View file @
6e3c6e63
...
...
@@ -6,7 +6,11 @@
The most appropriate way to initialize tasks in any `metabase.task.*` namespace is to implement the `task-init`
function which accepts zero arguments. This function is dynamically resolved and called exactly once when the
application goes through normal startup procedures. Inside this function you can do any work needed and add your
task to the scheduler as usual via `schedule-task!`."
task to the scheduler as usual via `schedule-task!`.
## Quartz JavaDoc
Find the JavaDoc for Quartz here: http://www.quartz-scheduler.org/api/2.3.0/index.html"
(
:require
[
clojure.java.jdbc
:as
jdbc
]
[
clojure.string
:as
str
]
[
clojure.tools.logging
:as
log
]
...
...
@@ -18,7 +22,7 @@
[
metabase.util.i18n
:refer
[
trs
]]
[
schema.core
:as
s
]
[
toucan.db
:as
db
])
(
:import
[
org.quartz
JobDetail
JobKey
Scheduler
Trigger
TriggerKey
]))
(
:import
[
org.quartz
CronTrigger
JobDetail
JobKey
Scheduler
Trigger
TriggerKey
]))
;;; +----------------------------------------------------------------------------------------------------------------+
;;; | SCHEDULER INSTANCE |
...
...
@@ -202,7 +206,12 @@
:durable?
(
.isDurable
job-detail
)
:requests-recovery?
(
.requestsRecovery
job-detail
)})
(
defn-
trigger->info
[
^
Trigger
trigger
]
(
defmulti
^
:private
trigger->info
{
:arglists
'
([
trigger
])}
class
)
(
defmethod
trigger->info
Trigger
[
^
Trigger
trigger
]
{
:description
(
.getDescription
trigger
)
:end-time
(
.getEndTime
trigger
)
:final-fire-time
(
.getFinalFireTime
trigger
)
...
...
@@ -214,6 +223,19 @@
:start-time
(
.getStartTime
trigger
)
:may-fire-again?
(
.mayFireAgain
trigger
)})
(
defmethod
trigger->info
CronTrigger
[
^
CronTrigger
trigger
]
(
merge
((
get-method
trigger->info
Trigger
)
trigger
)
{
:misfire-instruction
;; not 100% sure why `case` doesn't work here...
(
condp
=
(
.getMisfireInstruction
trigger
)
CronTrigger/MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
"IGNORE_MISFIRE_POLICY"
CronTrigger/MISFIRE_INSTRUCTION_SMART_POLICY
"SMART_POLICY"
CronTrigger/MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
"FIRE_ONCE_NOW"
CronTrigger/MISFIRE_INSTRUCTION_DO_NOTHING
"DO_NOTHING"
(
format
"UNKNOWN: %d"
(
.getMisfireInstruction
trigger
)))}))
(
defn
scheduler-info
"Return raw data about all the scheduler and scheduled tasks (i.e. Jobs and Triggers). Primarily for debugging
purposes."
...
...
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