-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
系统任务执行状态自监控能力支持 #7457
Labels
type/feature
功能
Comments
监控指标:
1.执行中失败的任务
2.执行中的任务
3.schedule轮训次数较多的数据 |
执行失败任务sqlEXPLAIN SELECT
tt.id,cp.name, pp.name
FROM
`taskflow3_taskflowinstance` AS tt,
`core_project` AS cp,
`pipeline_pipelineinstance` AS pp,
`eri_state` AS es
WHERE
pp.instance_id = es.root_id
AND tt.pipeline_instance_id=pp.id
AND tt.project_id=cp.id
AND pp.is_deleted = 0
AND pp.is_expired = 0
AND pp.is_finished = 0
AND pp.is_revoked = 0
AND pp.is_started = 1
AND es.NAME = "FAILED"
ORDER BY
pp.id DESC 执行失败任务ORM sql = """
EXPLAIN SELECT
tt.id,cp.name, pp.name
FROM
`taskflow3_taskflowinstance` AS tt,
`core_project` AS cp,
`pipeline_pipelineinstance` AS pp,
`eri_state` AS es
WHERE
pp.instance_id = es.root_id
AND tt.pipeline_instance_id=pp.id
AND tt.project_id=cp.id
AND pp.is_deleted = 0
AND pp.is_expired = 0
AND pp.is_finished = 0
AND pp.is_revoked = 0
AND pp.is_started = 1
AND es.NAME = "FAILED"
ORDER BY
pp.id DESC
"""
with connection.cursor() as cursor:
cursor.execute(sql)
results = cursor.fetchall()
print(results) 执行中任务sqlexplain SELECT
es.root_id,
COUNT( es.root_id ) AS total_count,
SUM( CASE WHEN es.NAME = 'Failed' THEN 1 ELSE 0 END ) AS failed_count,
SUM( CASE WHEN es.NAME = 'FINISHED' THEN 1 ELSE 0 END ) AS finished_count
FROM
pipeline_pipelineinstance AS pp
INNER JOIN eri_state AS es ON pp.instance_id = es.root_id
WHERE
pp.is_started = 1
AND pp.is_finished = 0
AND pp.is_revoked = 0
AND pp.is_expired = 0
AND is_deleted = 0
GROUP BY
es.root_id
HAVING
failed_count = 0
AND finished_count != total_count
ORDER BY
pp.id
limit 1000 执行中任务ORMsql = """
SELECT
es.root_id,
COUNT( es.root_id ) AS total_count,
SUM( CASE WHEN es.NAME = 'Failed' THEN 1 ELSE 0 END ) AS failed_count,
SUM( CASE WHEN es.NAME = 'FINISHED' THEN 1 ELSE 0 END ) AS finished_count
FROM
pipeline_pipelineinstance AS pp
INNER JOIN eri_state AS es ON pp.instance_id = es.root_id
WHERE
pp.is_started = 1
AND pp.is_finished = 0
AND pp.is_revoked = 0
AND pp.is_expired = 0
AND is_deleted = 0
GROUP BY
es.root_id
HAVING
failed_count = 0
AND finished_count != total_count
ORDER BY
pp.id
limit 1000
"""
with connection.cursor() as cursor:
cursor.execute(sql)
results = cursor.fetchall()
print(results) schedule轮训次数EXPLAIN SELECT
pp.creator,
pp.id,
esc.schedule_times
FROM
eri_schedule AS esc,
eri_state AS es,
pipeline_pipelineinstance AS pp
WHERE
esc.node_id = es.node_id
AND es.root_id = pp.instance_id
AND esc.scheduling = 0
ORDER BY
esc.schedule_times DESC
LIMIT 1000; sql = """
EXPLAIN SELECT
pp.creator,
pp.id,
esc.schedule_times
FROM
eri_schedule AS esc,
eri_state AS es,
pipeline_pipelineinstance AS pp
WHERE
esc.node_id = es.node_id
AND es.root_id = pp.instance_id
AND esc.scheduling = 0
ORDER BY
esc.schedule_times DESC
LIMIT 1000;
"""
with connection.cursor() as cursor:
cursor.execute(sql)
results = cursor.fetchall()
print(results) |
lTimej
added a commit
to lTimej/bk-sops
that referenced
this issue
Jun 14, 2024
补充:
|
lTimej
added a commit
to lTimej/bk-sops
that referenced
this issue
Jun 28, 2024
lTimej
pushed a commit
to lTimej/bk-sops
that referenced
this issue
Jul 5, 2024
lTimej
added a commit
to lTimej/bk-sops
that referenced
this issue
Jul 5, 2024
lTimej
added a commit
to lTimej/bk-sops
that referenced
this issue
Jul 5, 2024
lTimej
added a commit
to lTimej/bk-sops
that referenced
this issue
Jul 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: