-
-
Save tsucchi/22533296d7314076cd7c7d648e9f482e to your computer and use it in GitHub Desktop.
闇のツール 優先度調整くん1号
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 1 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 1 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 5 ) as subqueue ) );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 5 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 5 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 10 ) as subqueue ) );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 10 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 10 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 20 ) as subqueue ) );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 15 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 15 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 30 ) as subqueue ) );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 25 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 25 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 50 ) as subqueue ) );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 1 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 50 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') and subqueue_id in ( select subqueue_id from ( select subqueue_id, count(*) from minion_jobs where delayed < now() - interval '1 seconds' * 60 * 50 and task in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') group by subqueue_id having count(*) <= 100 ) as subqueue ) order by delayed limit 50 );" | |
psql -U jobqueue -h rds_for_jobqueue jobqueue -c "update minion_jobs set priority = priority + 5 where id in (select id from minion_jobs where state = 'inactive' and delayed < now() - interval '1 seconds' * 60 * 5 and task not in ('Omoi::Job::Ichigou', 'Omoi::Job::Nigou') order by delayed limit 500 )" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment