This file contains hidden or 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
diff --git a/lib/dynflow/action/with_bulk_sub_plans.rb b/lib/dynflow/action/with_bulk_sub_plans.rb | |
index dbff3a2..9dae0e2 100644 | |
--- a/lib/dynflow/action/with_bulk_sub_plans.rb | |
+++ b/lib/dynflow/action/with_bulk_sub_plans.rb | |
@@ -9,6 +9,17 @@ module Dynflow | |
raise NotImplementedError | |
end | |
+ PlanNextBatch = Algebrick.atom | |
+ |
This file contains hidden or 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
# Usage: | |
# 1. edit the TASK_SEARCH and AFTER values | |
# 2. run `foreman-rake console < sat61_tasks_cleaner.rb` | |
TASK_SEARCH='' | |
AFTER='30d' | |
module ForemanTasks | |
# Represents the cleanup mechanism for tasks | |
class Cleaner |
This file contains hidden or 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
# usage | |
# | |
# 1) copy the monitory to be loaded by satellite | |
# | |
# cp dynflow_throughput_monitor.rb /usr/share/foreman/config/initializers | |
# service foreman-tasks restart | |
# | |
# 2) grab the collected data to be shared with engineering: | |
# | |
# tar cvf dynflow_thoughput_monitor.tar /var/log/foreman/dynflow_throughput_monitor.log* |
This file contains hidden or 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
cat <<EOF > /usr/share/foreman/config/initializers/foreman_tasks_workers_bump.rb | |
workers_count = 10 | |
Rails.logger.info("Bumping the number of dynflow worksers to #{workers_count}") | |
ForemanTasks.dynflow.config.pool_size = workers_count | |
ForemanTasks.dynflow.config.db_pool_size = workers_count + 5 | |
EOF | |
service foreman-tasks restart |
This file contains hidden or 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
# Get raw action data from task in JSON format. | |
# | |
# usage: | |
# | |
# TASK_IDS="TASK_ID_1,TASK_ID_2" \ | |
# foreman-rake console 2>/dev/null < foreman_tasks_extract_data.rb | \ | |
# grep "^OUT: " | sed "s/^OUT: //g" | |
task_ids = ENV['TASK_IDS'].split(',').map(&:strip) |
This file contains hidden or 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
scl enable tfm bash | |
gem install pry-remote | |
setenforce 0 | |
# in code: | |
# require 'pry-remote'; binding.remote_pry | |
$(dirname $(gem which pry-remote))/../bin/pry-remote |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'json' | |
require 'csv' | |
unless ARGV.first | |
puts "Usage: HAMMER_USER=admin HAMMER_PASSWORD=changeme rex_outputs.rb JOB_INVOCATION_ID" | |
exit 1 | |
else | |
@job_invocation_id = ARGV.first | |
end |
This file contains hidden or 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
# WARNING: for testing only: don't apply to production without testing. | |
# A set of workaround patches to use different hash algorithm in Foreman and log the usage instead of failing right away. | |
# https://bugzilla.redhat.com/show_bug.cgi?id=1552159#c5 | |
function puppet-certs { | |
if grep empty-password /usr/share/katello-installer-base/modules/certs/manifests/ssltools/nssdb.pp | |
then | |
echo "Puppet - certs already patched" | |
return |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'nokogiri' | |
# Usage: | |
# | |
# # extract the data to csv | |
# ruby tasks-action-times.rb my-tasks-export/*.html > action_times.csv | |
# | |
# # get top 20 actions with the highest execution time: |
This file contains hidden or 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
cat <<EOF | foreman-rake console | |
conf.return_format = "" | |
batch_size = 1000 | |
persistence = ForemanTasks.dynflow.world.persistence | |
adapter = persistence.adapter | |
plans_without_tasks = adapter.db.fetch("select dynflow_execution_plans.uuid from dynflow_execution_plans left join foreman_tasks_tasks on (dynflow_execution_plans.uuid = foreman_tasks_tasks.external_id) where foreman_tasks_tasks.id IS NULL") | |
deleted = 0 | |
total = plans_without_tasks.count | |
plans_without_tasks.all.map{|x| x[:uuid]}.in_groups_of(batch_size, false).each do |uuids| | |
delete_count = persistence.delete_execution_plans({ 'uuid' => uuids }, batch_size) |