-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make spawn pass worker options again #16199
Make spawn pass worker options again #16199
Conversation
300efc5
to
3bd2f4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 tested with 2 vSphere providers and a SCVMM provider, and confirmed it doesn't work for Amazon/multiple ems_ids yet
@agrare according to a link @juliancheal sent me here, we shouldn't need to pass multiple ems_ids to the runner initialize. It sounds like as long as you have an amazon ems with many managers, it should automatically, pickup the managers in the refresh worker. |
@agrare Or, more importantly, if we need to have multiple ems_id's passed to the runner initialize, what is the proper queue name for that worker? |
@jrafanie hm well amazon workers weren't starting up so there is something else up. |
Not at work today. But can look tonight.
…Sent from my iPhone
On 17 Oct 2017, at 15:01, Adam Grare ***@***.***> wrote:
@jrafanie hm well amazon workers weren't starting up so there is something else up.
@juliancheal can you help debug this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
Just waiting on @juliancheal to give the 👍 for the amazon multi-manager stuff.
@@ -43,8 +43,6 @@ def self.interrupt_signals | |||
|
|||
def initialize(cfg = {}) | |||
@cfg = cfg | |||
@cfg[:guid] ||= ENV['MIQ_GUID'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/models/miq_worker.rb
Outdated
@@ -370,8 +375,12 @@ def self.runner_script | |||
script | |||
end | |||
|
|||
def command_line | |||
self.class.build_command_line(worker_options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If guid and ems_id are the only things we are using worker_options
for, I think we should probably make this less opaque and pass those values explicitly.
The fact that worker_options
is a hash makes it tough to see if we are covering all the cases for all the worker sub classes.
This can definitely be done in a follow up though.
I need to see what's going on, as so far with Amazon we get as far as this
|
0539b65
to
54462a1
Compare
def self.build_command_line(guid) | ||
command_line = "#{Gem.ruby} #{runner_script} --heartbeat --guid=#{guid} #{name}" | ||
ENV['APPLIANCE'] ? "nice #{nice_increment} #{command_line}" : command_line | ||
def self.build_command_line(guid, ems_id = nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is for @carbonin 🎁
@juliancheal I added a commit to address @carbonin's concern about YAOH (yet another options hash) |
Fixed the Amazon provider issue over here #16297 |
Fixes a bug first discovered after ManageIQ#16130 was merged. That PR was subsequently reverted. We'll remove fork support once spawn has complete parity without bugs.
Don't break an interface for yet another option hash. Change the tests to not care about the order of some of the CLI arguments since awesome spawn builds them in hash insertion order and we don't really care of the order of some of them anyway.
Sometimes a provider handles multiple managers with a single worker. This change allows spawn to be passed multiple ids (or just one id) in the format 1,2,3,4 with no spaces. The queue_name is then generated from the ids to look like either ems_1 or ["ems_1", "ems_2", "ems_3"]
54462a1
to
1c75bc4
Compare
Checked commits jrafanie/manageiq@26b5ac9~...1c75bc4 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 |
@@ -27,6 +27,10 @@ | |||
options[:guid] = val | |||
end | |||
|
|||
opts.on("-e=ems_id", "--ems-id=ems_id,ems_id", Array, "Provide a list of ems ids (without spaces) to a provider worker. This requires, at least one argument.") do |val| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be explained better, and formatted better.
runner_options[:ems_id] = worker_class.ems_id_from_queue_name(ENV["QUEUE"]) if worker_class.respond_to?(:ems_id_from_queue_name) | ||
if options[:ems_id] | ||
create_options[:queue_name] = options[:ems_id].length == 1 ? "ems_#{options[:ems_id].first}" : options[:ems_id].collect { |id| "ems_#{id}" } | ||
runner_options[:ems_id] = options[:ems_id].length == 1 ? options[:ems_id].first : options[:ems_id].collect { |id| id } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like how I did this. The problem is, create_options[:queue_name]
& runner_options[:ems_id]
can accept an array when there are multiple ems ids
. However when there is just a singular ems id
, I don't think that works as well. So I am trying to pass a single ems id
, but it just makes this look a mess.
Any suggestions to make it look nicer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to find a better way to do it. I can't think of one right now. Your changes are great for now. We can clean this up when we find a better place for this logic.
Make systemd optional on systemd enabled systems Api/web service worker needs ui-classic as it can try to read an existing UI session, which can contain serialized classes from ui-classic. Previously, we tried removing fork here: ManageIQ#16130 It was reverted here: ManageIQ#16154 Some of the followups needed to fix the original problems including passing down ems_id to per ems workers, resolved in: ManageIQ#16199 and ManageIQ#18648 At this point, things should just work.
Make systemd optional on systemd enabled systems Api/web service worker needs ui-classic as it can try to read an existing UI session, which can contain serialized classes from ui-classic. Previously, we tried removing fork here: ManageIQ#16130 It was reverted here: ManageIQ#16154 Some of the followups needed to fix the original problems including passing down ems_id to per ems workers, resolved in: ManageIQ#16199 and ManageIQ#18648 At this point, things should just work.
Make systemd optional on systemd enabled systems Api/web service worker needs ui-classic as it can try to read an existing UI session, which can contain serialized classes from ui-classic. Previously, we tried removing fork here: ManageIQ#16130 It was reverted here: ManageIQ#16154 Some of the followups needed to fix the original problems including passing down ems_id to per ems workers, resolved in: ManageIQ#16199 and ManageIQ#18648 At this point, things should just work.
Make systemd optional on systemd enabled systems Api/web service worker needs ui-classic as it can try to read an existing UI session, which can contain serialized classes from ui-classic. Previously, we tried removing fork here: ManageIQ#16130 It was reverted here: ManageIQ#16154 Some of the followups needed to fix the original problems including passing down ems_id to per ems workers, resolved in: ManageIQ#16199 and ManageIQ#18648 At this point, things should just work.
Make systemd optional on systemd enabled systems Api/web service worker needs ui-classic as it can try to read an existing UI session, which can contain serialized classes from ui-classic. Previously, we tried removing fork here: ManageIQ#16130 It was reverted here: ManageIQ#16154 Some of the followups needed to fix the original problems including passing down ems_id to per ems workers, resolved in: ManageIQ#16199 and ManageIQ#18648 At this point, things should just work.
When #16130 was merged, it revealed that spawn was not properly passing worker_options, specifically, the ems id needed by provider workers.
That PR was reverted and now we need to get spawn working properly again.
This PR adds the
--ems-id
option to run_single_worker.rb, updates the Procfile example to leverage this instead of the QUEUE environment variable, removes support for that env variable and the now unused MIQ_GUID environment variable.There's still some bugs to fix with spawn + BUNDLER_GROUPS excluding ui-classic for all non-ui workers but those can be done as follows up while fork is still the default (report_formatter in ui repo being used by our reporting code, ick).
We also want to support passing multiple ems id values for amazon workers cc @juliancheal @agrare but that will be done also as a followup to this PR.
To test this PR as is, you'll need to enable spawn workers locally:
MIQ_SPAWN_WORKERS=true bin/rake evm:start
or use the Procfile viabin/rake evm:foreman:start
and make sure your provider workers get the proper ems_id passed down.