Skip to content

Instantly share code, notes, and snippets.

Warning: Encountered two children with the same key, `.$secondary_»Environments«`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
in ul (created by ListGroup)
in ListGroup (created by BaseVerticalNavItemHelper)
in Unknown (created by withContext(Component))
in withContext(Component) (created by BaseVerticalNavItemHelper)
in div (created by BaseVerticalNavItemHelper)
in li (created by ListGroupItem)
in ListGroupItem (created by BaseVerticalNavItemHelper)
in BaseVerticalNavItemHelper (created by VerticalNavItemHelper)
in VerticalNavItemHelper (created by BaseVerticalNavItem)
source 'https://rubygems.org'
gem 'daemons'
import asyncio
import json
class ResponseQueue(asyncio.Queue):
def __init__(self, *args, **kwargs):
self.done = False
super().__init__(*args, **kwargs)
@adamruzicka
adamruzicka / gist:b6b19d08e2bdce828fa3ca22eda97fb6
Created January 9, 2020 11:34
Removing undeliverable dynflow envelopes
--
-- Delete all undeliverable envelopes
--
DELETE FROM dynflow_envelopes
WHERE receiver_id NOT IN (SELECT id FROM dynflow_coordinator_records);
# /usr/share/foreman/config/initializers/foreman-tasks-db-pool-size.rb
ForemanTasks.dynflow.config.db_pool_size = 30
@adamruzicka
adamruzicka / scaling.md
Last active October 30, 2020 14:36
Dynflow workers scaling

Intro

Out of the box, foreman ships with orchestrator and a single worker If you have Katello, you will get an additional worker for processing of the host queue

root@modest-gator:~# ls -l /etc/foreman/dynflow/
total 1
-rw-r--r--. 1 root foreman 51 May 14 07:35 orchestrator.yml
-rw-r--r--. 1 root foreman 59 May 14 07:35 worker.yml
From 81cb056aaa972a0c1ad9a49b7c4887d0df8111d6 Mon Sep 17 00:00:00 2001
From: Adam Ruzicka <[email protected]>
Date: Wed, 22 Jul 2020 12:26:17 +0200
Subject: [PATCH] Workaround undefined method singleton_class? error
NoMethodError: undefined method `singleton_class?' for #<Class:0x0000556b7d6b69b0>
/tmp/foreman/app/models/operatingsystem.rb:91:in `<class:Jail>'
/tmp/foreman/app/models/operatingsystem.rb:90:in `<class:Operatingsystem>'
/tmp/foreman/app/models/operatingsystem.rb:4:in `<main>'
/tmp/foreman/app/models/concerns/audit_search.rb:82:in `block in audited_classes_without_sti'
@adamruzicka
adamruzicka / memory recycling.md
Last active July 30, 2020 09:17
Memory recycler in the age of Sidekiq

Memory recycler in the age of Sidekiq

Starting with the move to sidekiq, the memory recycler is gone. Luckily, by splitting the executor into several systemd services, we can leverage the resource control features[1] provided by systemd and cgroups to fill the feature gap created by removal of the memory recycler.

Prerequisites

Before we can get to the memory limiting, let's take a look at how the default state looks. There are the orchestrator, worker and worker-hosts-queue processes running as instances of the [email protected] template

#!/usr/bin/env ruby
# frozen_string_literal: true
# examples/excessive_logging.rb
# Reproducer for https://bugzilla.redhat.com/show_bug.cgi?id=1877917
# Run with something like
# for i in 1 2 5 10 50 100 500 1000; do echo -n "$i: "; COUNT=$i bundle exec ruby examples/excessive_logging.rb >/dev/null 2>&1 | wc -l -c | column -t; done
require_relative 'example_helper'
# Save this script as $LOCATION/queues.rb
# Run with foreman-rake console < $LOCATION/queues.rb
# Kill with C-c
# It collects sidekiq statistics every $INTERVAL seconds
# The statistics are saved into three CSV files
INTERVAL = (ENV['interval'] || 15).to_i
stats_csv = CSV.open(ENV['STATS'] || '/tmp/stats.csv', 'wb')