Skip to content

Instantly share code, notes, and snippets.

@blomquisg
Last active September 3, 2017 14:51
Show Gist options
  • Save blomquisg/bde2af08605f128d5538 to your computer and use it in GitHub Desktop.
Save blomquisg/bde2af08605f128d5538 to your computer and use it in GitHub Desktop.
Debugging a MIQ Worker
  1. Remove the worker class name from class_names.rb
  2. Start your sever normally
  3. Make sure your provider is added to your appliance (for provider-specific workers like refreshers and event catchers)
  4. Run rails console (see rails script below)
worker_class = ManageIQ::Providers::Openstack::CloudManager::EventCatcher
runner_class = worker_class::Runner
worker = worker_class.create_worker_record
runner_cfg = {:guid => worker.guid, :ems_id => "25"}
runner = runner_class.new(runner_cfg)
runner.start
@jrafanie
Copy link

It would be nice to be able to run this without a server by injecting the server's zone, server's drb, ignore the worker monitor status, etc. Also, I don't know that we really NEED the worker row (eliminate the create_worker_record). That would eliminate some of this work like modifying the class names and make it much easier to instantiate and test in specs.

That would enable us to instantiate

@jrafanie
Copy link

You could then simulate the DRb messages to send to the worker, etc.

@jameswnl
Copy link

Removal of worker class name from class_names.rb is supposed to prevent the worker from being started, right?

I can't get this expected behavior. I removed the 2 lines of the same worker. I also added a log line to the worker I'm removing. What I had expected was that the log line I added will be gone from evm.log. However, it is still there in evm.log. My 3 lines code change is here

What I would like to do is to start the subject worker in rails console in order to debug it. Thanks for your help.

@moolitayer
Copy link

Anybody know of a way to debug workers that currently works?
@NickLaMuro @jrafanie @carbonin ?

@moolitayer
Copy link

Oh this script works now, yay! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment