Skip to content

Commit

Permalink
Merge pull request #15443 from mkanoor/change_to_use_tracking_label
Browse files Browse the repository at this point in the history
Changed task_id to tracking_label
  • Loading branch information
Fryguy authored Jul 5, 2017
2 parents b0dbb77 + 5b4b1ea commit 41f95f0
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 81 deletions.
16 changes: 8 additions & 8 deletions app/models/miq_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,14 @@ def execute

# self.create_request_tasks
MiqQueue.put(
:class_name => self.class.name,
:instance_id => id,
:method_name => "create_request_tasks",
:zone => options.fetch(:miq_zone, my_zone),
:role => my_role,
:task_id => "#{self.class.name.underscore}_#{id}",
:msg_timeout => 3600,
:deliver_on => deliver_on
:class_name => self.class.name,
:instance_id => id,
:method_name => "create_request_tasks",
:zone => options.fetch(:miq_zone, my_zone),
:role => my_role,
:tracking_label => "#{self.class.name.underscore}_#{id}",
:msg_timeout => 3600,
:deliver_on => deliver_on
)
end

Expand Down
28 changes: 14 additions & 14 deletions app/models/miq_request_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ def deliver_to_automate(req_type = request_type, zone = nil)

zone ||= source.respond_to?(:my_zone) ? source.my_zone : MiqServer.my_zone
MiqQueue.put(
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => options.fetch(:miq_zone, zone),
:task_id => my_task_id,
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => options.fetch(:miq_zone, zone),
:tracking_label => my_task_id,
)
update_and_notify_parent(:state => "pending", :status => "Ok", :message => "Automation Starting")
else
Expand All @@ -166,14 +166,14 @@ def execute_queue(queue_options = {})
zone = source.respond_to?(:my_zone) ? source.my_zone : MiqServer.my_zone

queue_options.reverse_merge!(
:class_name => self.class.name,
:instance_id => id,
:method_name => "execute",
:zone => options.fetch(:miq_zone, zone),
:role => miq_request.my_role,
:task_id => my_task_id,
:deliver_on => deliver_on,
:miq_callback => {:class_name => self.class.name, :instance_id => id, :method_name => :execute_callback}
:class_name => self.class.name,
:instance_id => id,
:method_name => "execute",
:zone => options.fetch(:miq_zone, zone),
:role => miq_request.my_role,
:tracking_label => my_task_id,
:deliver_on => deliver_on,
:miq_callback => {:class_name => self.class.name, :instance_id => id, :method_name => :execute_callback}
)
MiqQueue.put(queue_options)

Expand Down
12 changes: 6 additions & 6 deletions app/models/miq_request_task/post_install_callback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ def post_install_callback_url

def provision_completed_queue
MiqQueue.put(
:class_name => self.class.name,
:instance_id => id,
:method_name => 'provision_completed',
:zone => my_zone,
:role => my_role,
:task_id => my_task_id,
:class_name => self.class.name,
:instance_id => id,
:method_name => 'provision_completed',
:zone => my_zone,
:role => my_role,
:tracking_label => my_task_id,
)
end

Expand Down
28 changes: 14 additions & 14 deletions app/models/miq_request_task/state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def signal(phase)
def signal_queue(phase)
method_name, args = phase == :abort ? [:signal_abort, []] : [:signal, [phase]]
MiqQueue.put(
:class_name => self.class.name,
:instance_id => id,
:method_name => method_name,
:args => args,
:zone => my_zone,
:role => my_role,
:task_id => my_task_id,
:class_name => self.class.name,
:instance_id => id,
:method_name => method_name,
:args => args,
:zone => my_zone,
:role => my_role,
:tracking_label => my_task_id,
)
end

Expand All @@ -71,13 +71,13 @@ def prematurely_finished?
def requeue_phase
save # Save current phase_context
MiqQueue.put(
:class_name => self.class.name,
:instance_id => id,
:method_name => phase,
:deliver_on => 10.seconds.from_now.utc,
:zone => my_zone,
:role => my_role,
:task_id => my_task_id,
:class_name => self.class.name,
:instance_id => id,
:method_name => phase,
:deliver_on => 10.seconds.from_now.utc,
:zone => my_zone,
:role => my_role,
:tracking_label => my_task_id,
:miq_callback => {:class_name => self.class.name, :instance_id => id, :method_name => :execute_callback}
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/mixins/miq_provision_quota_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def quota_find_active_prov_request(_options)
prov_ids = []
MiqQueue
.where(:method_name => 'deliver', :state => %w(ready dequeue), :class_name => 'MiqAeEngine')
.where("task_id like ?", '%miq_provision_%')
.where("tracking_label like ?", '%miq_provision_%')
.each do |q|
if q.args
args = q.args.first
Expand Down
12 changes: 6 additions & 6 deletions app/models/service_reconfigure_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def deliver_to_automate(req_type = request_type, zone = nil)
}

MiqQueue.put(
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => zone,
:task_id => "#{self.class.name.underscore}_#{id}"
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => zone,
:tracking_label => "#{self.class.name.underscore}_#{id}"
)
update_and_notify_parent(:state => "pending", :status => "Ok", :message => "Automation Starting")
else
Expand Down
24 changes: 12 additions & 12 deletions app/models/service_template_provision_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def do_request

def queue_post_provision
MiqQueue.put(
:class_name => self.class.name,
:instance_id => id,
:method_name => "do_post_provision",
:deliver_on => 1.minutes.from_now.utc,
:task_id => "#{self.class.name.underscore}_#{id}",
:miq_callback => {:class_name => self.class.name, :instance_id => id, :method_name => :execute_callback}
:class_name => self.class.name,
:instance_id => id,
:method_name => "do_post_provision",
:deliver_on => 1.minutes.from_now.utc,
:tracking_label => "#{self.class.name.underscore}_#{id}",
:miq_callback => {:class_name => self.class.name, :instance_id => id, :method_name => :execute_callback}
)
end

Expand Down Expand Up @@ -145,12 +145,12 @@ def deliver_to_automate(req_type = request_type, _zone = nil)

zone ||= source.respond_to?(:my_zone) ? source.my_zone : MiqServer.my_zone
MiqQueue.put(
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => options.fetch(:miq_zone, zone),
:task_id => "#{self.class.name.underscore}_#{id}"
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [args],
:role => 'automate',
:zone => options.fetch(:miq_zone, zone),
:tracking_label => "#{self.class.name.underscore}_#{id}"
)
update_and_notify_parent(:state => "pending", :status => "Ok", :message => "Automation Starting")
else
Expand Down
12 changes: 6 additions & 6 deletions spec/models/service_reconfigure_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@
}
expect(user.current_tenant).to be_truthy
expect(MiqQueue).to receive(:put).with(
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [automate_args],
:role => 'automate',
:zone => nil,
:task_id => "service_reconfigure_task_#{task.id}")
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [automate_args],
:role => 'automate',
:zone => nil,
:tracking_label => "service_reconfigure_task_#{task.id}")
task.deliver_to_automate
end

Expand Down
28 changes: 14 additions & 14 deletions spec/models/service_template_provision_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ def service_resource_id(index, scaling_max)
}
allow(@request).to receive(:approved?).and_return(true)
expect(MiqQueue).to receive(:put).with(
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [automate_args],
:role => 'automate',
:zone => 'special',
:task_id => "service_template_provision_task_#{@task_0.id}")
:class_name => 'MiqAeEngine',
:method_name => 'deliver',
:args => [automate_args],
:role => 'automate',
:zone => 'special',
:tracking_label => "service_template_provision_task_#{@task_0.id}")
@task_0.deliver_to_automate
end

Expand All @@ -121,14 +121,14 @@ def service_resource_id(index, scaling_max)
allow(@request).to receive(:approved?).and_return(true)
allow(MiqServer).to receive(:my_zone).and_return('a_zone')
expect(MiqQueue).to receive(:put).with(
:class_name => 'ServiceTemplateProvisionTask',
:instance_id => @task_0.id,
:method_name => 'execute',
:role => 'ems_operations',
:zone => 'a_zone',
:task_id => "service_template_provision_task_#{@task_0.id}",
:deliver_on => nil,
:miq_callback => miq_callback)
:class_name => 'ServiceTemplateProvisionTask',
:instance_id => @task_0.id,
:method_name => 'execute',
:role => 'ems_operations',
:zone => 'a_zone',
:tracking_label => "service_template_provision_task_#{@task_0.id}",
:deliver_on => nil,
:miq_callback => miq_callback)
@task_0.execute_queue
end

Expand Down

0 comments on commit 41f95f0

Please sign in to comment.