Skip to content

Instantly share code, notes, and snippets.

View kstevens715's full-sized avatar

Kyle Stevens kstevens715

View GitHub Profile
def alive
end
# app@1290894361f7:/opt/app$ pgrep -af resq
# 461 resque-1.26.0: Waiting for etl_applicant_deferred_heavyweight
# 464 resque-1.26.0: Waiting for cas_3_gpa_deferred_heavyweight
#
# app@1290894361f7:/opt/app$ pgrep -af resq
# 461 resque-1.26.0: Forked 1698 at 1484951377
# 464 resque-1.26.0: Waiting for cas_3_gpa_deferred_heavyweight
# 1698 resque-1.26.0: Processing etl_applicant_deferred_heavyweight since 1484951377 [Etl::ApplicantJob]
#
# for each queue:
module Etl
class Liveness
extend Forwardable
ProcessInfo = Struct.new(:pid, :text)
def initialize(command_runner: CommandRunner)
@command_runner = command_runner
end
desc 'Determine if Resque is Alive or not'
task :liveness, [:queue_name] => [:environment] do |_task, args|
Resque.workers.select { |w| w.hostname == Socket.gethostname }.each do |worker|
begin
Process.kill(0, worker.pid)
rescue Errno::ESRCH
puts "Dead: Resque process with pid #{worker.pid} should exist, but cannot be found."
exit 1
end
class ActiveRecordComparer
def initialize(original, new)
@original = original
@new = new
end
def method_missing(m, *arg)
puts arg
@original = @original.send(m, *arg)
@new = @new.send(m, *arg)

On ETL K8:

failures = Resque::Failure.all(0, Resque::Failure.count).map { |f| f["payload"]["args"][0].gsub("applicant/", "").split("/") }.reject { |j| j[0] =~ /gpa/ }
file = File.open('/tmp/applicants.txt', 'w')
failures.each { |failure| file.write("#{failure[0]},#{failure[1]}\n") }

On local host

kubectl cp wa-etl-resque-web-386939940-dp406:/tmp/applicants.txt applicants.txt
require "test_helper"
require "csv_parser"
require "support/reports_unit_test_helper"
require "benchmark"
describe Reports::HighSchoolCourseworkReport do
let(:described_class) { Reports::HighSchoolCourseworkReport }
def random_word(l)
(0...l).map { (65 + rand(26)).chr }.join
module Documents
class Loader
def initialize(current_user_identity, current_organization, applicant, programs)
@current_user_identity = current_user_identity
@current_organization = current_organization
@applicant = applicant
@programs = programs
@panels = {}
end
require 'benchmark'
class Lots
def run
time = Benchmark.realtime do
10_000.times do |n|
n = n.to_s
puts n
l = GlobalLookup.new(identifier: n, name: n)
l.type = 'TempTest2'

Here are things I would like to see to give this PR a plus-one. Please make updates to this PR or let me know why they cannot or should not be done and then I will re-review.