Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
25810d03
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
25810d03
编写于
5月 02, 2018
作者:
S
Shinya Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added flush-to-db process for the cron worker. Rename to RescueStaleLiveTraceWorker.
上级
93103bb0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
27 deletion
+43
-27
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/fource_archive_stale_live_trace_worker.rb
app/workers/fource_archive_stale_live_trace_worker.rb
+0
-23
app/workers/rescue_stale_live_trace_worker.rb
app/workers/rescue_stale_live_trace_worker.rb
+39
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+3
-3
未找到文件。
app/workers/all_queues.yml
浏览文件 @
25810d03
...
...
@@ -17,7 +17,7 @@
-
cronjob:stuck_ci_jobs
-
cronjob:stuck_import_jobs
-
cronjob:stuck_merge_jobs
-
cronjob:
fource_archiv
e_stale_live_trace
-
cronjob:
rescu
e_stale_live_trace
-
cronjob:trending_projects
-
cronjob:issue_due_scheduler
...
...
app/workers/fource_archive_stale_live_trace_worker.rb
已删除
100644 → 0
浏览文件 @
93103bb0
class
FourceArchiveStaleLiveTraceWorker
include
ApplicationWorker
include
CronjobQueue
def
perform
# Find jobs with the following condition
# - Finished 4 hours ago (Jobs finished 4 hours ago should have an archived trace)
# - Not archived yet (Because ArchiveTraceWorker failed by some reason)
Ci
::
Build
.
finished
.
where
(
'finished_at < ?'
,
4
.
hours
.
ago
)
.
where
(
'NOT EXISTS (?)'
,
Ci
::
JobArtifact
.
select
(
1
).
trace
.
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
.
find_each
(
batch_size:
1000
)
do
|
job
|
begin
job
.
trace
.
archive!
rescue
=>
e
Rails
.
logger
.
error
"
#{
job
.
id
}
: Failed to archive stable live trace:
#{
e
.
message
}
"
end
Rails
.
logger
.
warning
"
#{
job
.
id
}
: Live trace was force archived because it was considered as stale"
end
end
end
end
app/workers/rescue_stale_live_trace_worker.rb
0 → 100644
浏览文件 @
25810d03
class
RescueStaleLiveTraceWorker
include
ApplicationWorker
include
CronjobQueue
def
perform
# Reschedule to archive live traces
#
# The target jobs are with the following conditions
# - Finished 4 hours ago, but it's not archived yet
# Jobs finished 4 hours ago should have an archived trace. Probably ArchiveTraceWorker failed by Sidekiq's inconsistancy
Ci
::
Build
.
finished
.
where
(
'finished_at BETWEEN ? AND ?'
,
1
.
week
.
ago
,
4
.
hours
.
ago
)
.
where
(
'NOT EXISTS (?)'
,
Ci
::
JobArtifact
.
select
(
1
).
trace
.
where
(
'ci_builds.id = ci_job_artifacts.job_id'
))
.
find_in_batch
(
batch_size:
1000
)
do
|
jobs
|
job_ids
=
jobs
.
map
{
|
job
|
[
job
.
id
]
}
ArchiveTraceWorker
.
bulk_perform_async
(
job_ids
)
Rails
.
logger
.
warning
"Scheduled to archive stale live traces from
#{
job_ids
.
min
}
to
#{
job_ids
.
max
}
"
end
# Schedule to flush redis-chunk to database
#
# The target build_trace_chunks are with the following conditions
# - The last patching of the trace was 1 hour ago
# - The job is still running
Ci
::
BuildTraceChunk
.
redis
.
joins
(
:build
)
.
where
(
'ci_builds.update_at < ?'
,
1
.
hour
.
ago
)
.
where
(
'ci_builds.status = ?'
,
'running'
)
.
find_in_batch
(
batch_size:
1000
)
do
|
build_trace_chunks
|
build_trace_chunk_ids
=
build_trace_chunks
.
map
{
|
build_trace_chunk
|
[
build_trace_chunk
.
id
]
}
BuildTraceChunkFlushToDBWorker
.
bulk_perform_async
(
build_trace_chunk_ids
)
Rails
.
logger
.
warning
"Scheduled to flush stale live traces to database from
#{
build_trace_chunk_ids
.
min
}
to
#{
build_trace_chunk_ids
.
max
}
"
end
end
end
config/initializers/1_settings.rb
浏览文件 @
25810d03
...
...
@@ -289,9 +289,9 @@ Settings.cron_jobs['repository_archive_cache_worker']['job_class'] = 'Repository
Settings
.
cron_jobs
[
'import_export_project_cleanup_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'import_export_project_cleanup_worker'
][
'cron'
]
||=
'0 * * * *'
Settings
.
cron_jobs
[
'import_export_project_cleanup_worker'
][
'job_class'
]
=
'ImportExportProjectCleanupWorker'
Settings
.
cron_jobs
[
'
fource_archiv
e_stale_live_trace_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'
fource_archive_stale_live_trace_worker'
][
'cron'
]
||=
'*/4
* * * *'
Settings
.
cron_jobs
[
'
fource_archiv
e_stale_live_trace_worker'
][
'job_class'
]
=
'BuildTraceChunkArchiveStaleObjectsWorker'
Settings
.
cron_jobs
[
'
rescu
e_stale_live_trace_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'
rescue_stale_live_trace_worker'
][
'cron'
]
||=
'*/1
* * * *'
Settings
.
cron_jobs
[
'
rescu
e_stale_live_trace_worker'
][
'job_class'
]
=
'BuildTraceChunkArchiveStaleObjectsWorker'
Settings
.
cron_jobs
[
'requests_profiles_worker'
]
||=
Settingslogic
.
new
({})
Settings
.
cron_jobs
[
'requests_profiles_worker'
][
'cron'
]
||=
'0 0 * * *'
Settings
.
cron_jobs
[
'requests_profiles_worker'
][
'job_class'
]
=
'RequestsProfilesWorker'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录