Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Dive into MaintenanceTasks
Search
hatsu
August 01, 2024
Programming
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dive into MaintenanceTasks
hatsu
August 01, 2024
More Decks by hatsu
See All by hatsu
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
210
MySQL初心者が311個のカラムにNot NULL制約を追加していってALTER TABLEについて学んだ話
hatsu38
2
430
introduction_scriptor_gem.pdf
hatsu38
1
200
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
25
20k
Just a Rails Patch Update
hatsu38
2
990
GitHub Actions is Fun
hatsu38
1
220
Other Decks in Programming
See All in Programming
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
170
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
400
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
410
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
8
5.7k
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
2
900
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
220
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
470
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
190
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
140
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
120
Built Our Own Background Agent at LayerX #aidevex_findy
layerx
PRO
9
3.6k
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
190
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
430
Optimising Largest Contentful Paint
csswizardry
37
3.8k
Tell your own story through comics
letsgokoyo
1
1k
ラッコキーワード サービス紹介資料
rakko
1
4.1M
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
45k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
190
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Prompt Engineering for Job Search
mfonobong
0
380
Ethics towards AI in product and experience design
skipperchong
2
330
BBQ
matthewcrist
89
10k
Google's AI Overviews - The New Search
badams
0
1.1k
Transcript
Dive into MaintenanceTasks omotesando.rb#100, roppongirb#21 2024/08/01 @hatsu_38
ࣗݾհ • Rubyྺ 5 = ΤϯδχΞྺ • SHE Inc. •
React.js / TypeScript / GitHub Actions • Ruby͕Ұ൪͖
͓அΓɻ ίʔυͷղઆͱ͔ೖΕͨΒεϥΠυ͕ 81ຕʹͳͬͯ5ͰऴΘΔΘ͚͕ͳ͍ ͷͰޙۦ͚&ં͍͖ͬͯ·͢🏃
ٕज़ελοΫ • Backend: Ruby, Ruby on Rails, GraphQL, Sidekiq •
Frontend: React.js, TypeScript, Next.js • CI: GitHub Actions • Infrastructure: Kubernetes
Initial commit͔Β7…
Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle exec
rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β…
ຊ൪αʔόʔʹೖΔͷා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β…
ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅
ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle
exec rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
Rake taskͷ࣮ߦํ๏ 1. podʹkubectl exec … bashͰೖΔ 2. bundle exec
rake … 3. ్தͰࣦഊͨ͠Β࢝Ί͔Β… ຊ൪αʔόʔͰखಈͰίϚϯυ࣮ߦා͍🙅 ຊ൪αʔόʔʹೖΔͷා͍🙅 ࢝Ί͔Β࣮ߦ͢Δͷ͕͔͔࣌ؒΔ🙅
MaintenanceTasks͍࢝Ίͨ🚀
MaintenanceTasks is Կ
MaintenanceTasks is Կ • UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ •
Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ
MaintenanceTasks is Կ • UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ •
Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
• UI্͔ΒCLI͔ΒJobΛ։࢝Ͱ͖Δ • UI্͔ΒJobʹ͍ͨ͠ύϥϝʔλͷઃఆͰ͖Δ • ։࢝ͨ͠+PCΛதஅɾ࠶։ɾΩϟϯηϧͳͲͰ͖Δ • Jobͷ࣮ߦཤྺ࣮ߦঢ়گ͕֬ೝͰ͖Δ MaintenanceTasks is
Կ
MaintenanceTasksͷ͍ํ
MaintenanceTasksͷ͍ํ Collectionʹॲཧ͍ͨ͠σʔλΛఆٛ(ActiveRecord::Relation CSV)
MaintenanceTasksͷ͍ํ processʹ֤σʔλͷॲཧ͢Δ༰Λఆٛ Collectionʹॲཧ͍ͨ͠σʔλΛఆٛ(ActiveRecord::Relation CSV)
MaintenanceTasksͷ͍ํ bin/rails generate maintenance_tasks:install
MaintenanceTasksͷ͍ํ ͲͷTaskΛ࣮ߦ͍ͯ͠Δ͔ ։࢝࣌ࠁ ऴྃ࣌ࠁ ࣮ߦ࣌ؒ ࣮ߦ݅ ࣮ߦ(༧ఆ)݅ SecureRandom .uuid ࠶։ॴͷIndex(ID)
࣮ߦεςʔλε(Enum) enqueued / running / succeeded / cancelling / cancelled / interrupted / pausing / paused / errored bin/rails generate maintenance_tasks:install ΤϥʔͷClass ΤϥʔMessage Backtrace
ɾαʔόʔʹೖΒͣʹJobΛ࣮ߦͰ͖Δ✨ ɾMaintenanceTaskͳΒ్தͰ࠶։Ͱ͖Δ✨
ศརʂ✨
MaintenanceTasks࣮ߦʂ🚀
JobʹΤϥʔൃੜʂ💥
్த͔Β࠶։✨
Ͳ͏࣮ͬͯ͞ΕͯΔ͔ݟͯΈΔ🔍 MaintenanceTasks & JobIteration
MaintenanceTaskͷςʔϒϧ ͲͷTaskΛ࣮ߦ͍ͯ͠Δ͔ ։࢝࣌ࠁ ऴྃ࣌ࠁ ࣮ߦ࣌ؒ ࣮ߦ݅ ࣮ߦ(༧ఆ)݅ SecureRandom .uuid ࠶։ॴͷIndex(ID)
࣮ߦεςʔλε(Enum) enqueued / running / succeeded / cancelling / cancelled / interrupted / pausing / paused / errored bin/rails generate maintenance_tasks:install ΤϥʔͷClass ΤϥʔMessage Backtrace
CursorͷอଘλΠϛϯάΛ୳͢🔬
Job͕Enqueue͞ΕΔ·ͰΛ ͬͯΈΔ🏃
Job͕enqueue͞ΕΔ·Ͱ(ͬ͘͟Γ) RunϘλϯ show.html.erb Runner.run(*) RunsController#create 1. DBʹRunϨίʔυ࡞ 2. Jobͷenqueue Runner#run
show.html.erb
show.html.erb
show.html.erb MaintenanceTasks::RunsController#create
MaintenanceTasks::RunsController#create
MaintenanceTasks::RunsController#create MaintenanceTasks::Runnerͷݺͼग़͠
MaintenanceTasks::Runner#run
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run)
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) enqueue͢Δ MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ
MaintenanceTasks::Runner#run MaintenanceTasks::Run modelͷnew MaintenanceTasks::TaskJob.new(run) = ActiveJob::Base.new(run) enqueue͢Δ MaintenanceTasks::Run modelͷstatusΛenqueuedʹมߋͯ͠อଘ Job͕enqueue͞Εͨʂ
Enqueue͞Εͨ͋ͱͷྲྀΕΛݟΔ🔍
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D ActiveJobͰఆٛ͞Ε͍ͯΔCallback ActiveJobͰఆٛ͞Ε͍ͯΔCallback
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D job-iteration gem͕ఆ͍ٛͯ͠ΔCallback sidekiq v7.3ʹsidekiq-iteration gemͰࣅͨϝιου͕Ճ͞Εͨ
ͦΕͧΕͷStepͰ ͬͯΔ͜ͱΛௐࠪ🛠
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 ରσʔλͷྻ࡞
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ) ରσʔλͷྻ࡞
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 shutdown callbackͷ࣮ߦ ରσʔλͷྻ࡞ 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTasks::RunͷσʔλΛrunningεςʔλεʹมߋ 2. perform͕࣮ߦ͞ΕΔ 1 1 2 2 shutdown callbackͷ࣮ߦ complete callbackͷ࣮ߦ ରσʔλͷྻ࡞ 1ͭ1ͭσʔλΛॲཧ(Processϝιουͷ࣮ߦ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count) 3
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. ॲཧ͖͢σʔλͷྻΛ࡞ 2. on_startϝιου࣮ߦ 3. RunϞσϧͷσʔλͷ։࢝࣌ࠁͱॲཧ༧ఆ݅Λߋ৽ 1. update!(started_at: Time.now, tick_total: count) 3 3
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. MaintenanceTaskʹࣗͰॻ͍ͨdef process͕࣮ߦ͞ΕΔ 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 3 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1 3 3 1. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 2. cursorͷૠೖ 3. ΤϥʔͷClassBacktraceErrorϝοηʔδΛrunσʔλʹอଘ 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. εςʔλεʹcancelled / paused / interrupted ͱcursorૠೖ(อଘ·ͩ) 2. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽ 1 1 2
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D 1 1 3 2 1. εςʔλεʹcancelled / paused / interruptedͷૠೖ(อଘ·ͩ) 2. Cursorૠೖ(อଘ·ͩ) 3. ݱࡏͷॲཧ݅ͱܦա࣌ؒΛߋ৽
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. statusʹsucceededΛɺended_atʹTime.nowʹૠೖ(อଘ·ͩ)
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. statusʹsucceededΛɺended_atʹTime.nowʹૠೖ(อଘ·ͩ) 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ 1
Enqueue͞Εͨ͋ͱͷྲྀΕ(ͬ͘͟Γ) 1. before_perform: Perform͕ݺΕΔલʹ࣮ߦ͞ΕΔɻ 2. on_start: Perform͞Εͨޙʹ࣮ߦ͞ΕΔɻ 3. each_iteration: ActiveRecord::RelationΛҰͭͣͭॲཧ͢Δɻ
1. on_error: StandardErrorͰݺΕΔ 4. on_shutdown: ॲཧ͕ऴΘͬͨͱ͖ɻதஅ͞Εͨͱ͖ʹ࣮ߦ͞ΕΔɻ 5. on_complete: on_shutdownͷޙɻ࠶enqueueͷඞཁ͕ͳ͍ͱ͖ɻ 6. after_perform: Perform͕ऴΘͬͨޙʹ࣮ߦ͞ΕΔɻ D D 1. ૠೖ͍ͯͨ͠cursorstatusended_atΛอଘ 1 1
on_error after_performͰ ࠶։ॴΛه͍ͯͨ͠✨ (Ωϟϯηϧதஅͨ͠ͱ͖ಉ͡)
·ͱΊ • MaintenanceTasksศར • UI্ͰJob࣮ߦͰ͖Δ͠ɺجຊతʹ్தͰதஅɾ࠶։Ͱ͖Δ • SIGKILLͷ࣌࠶։Ͱ͖ͳ͍ɻSIGTERMͱ͔ͳΒ࠶։Ͱ͖Δ • Sidekiq v7.3ͰࣅͨΑ͏ͳػೳ͕ೖͬͨ
• RunsςʔϒϧͰͳ͘ɺredisͰཧͯ͠Δ