-
Notifications
You must be signed in to change notification settings - Fork 8
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
Run workflows asyncrhonously on MiqAutomationWorker #50
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class ManageIQ::Providers::Workflows::AutomationManager::WorkflowInstance < ManageIQ::Providers::EmbeddedAutomationManager::ConfigurationScript | ||
def run_queue(zone: nil, role: "automate", object: nil) | ||
def run_queue(zone: nil, role: "automate", object: nil, deliver_on: nil, server_guid: nil) | ||
raise _("run_queue is not enabled") unless Settings.prototype.ems_workflows.enabled | ||
|
||
args = {:zone => zone, :role => role} | ||
|
@@ -12,9 +12,12 @@ def run_queue(zone: nil, role: "automate", object: nil) | |
:class_name => self.class.name, | ||
:instance_id => id, | ||
:method_name => "run", | ||
:queue_name => "automate", | ||
:role => role, | ||
:zone => zone, | ||
:args => [args], | ||
:deliver_on => deliver_on, | ||
:server_guid => server_guid | ||
} | ||
|
||
if miq_task_id | ||
|
@@ -69,7 +72,7 @@ def run(args = {}) | |
end | ||
|
||
wf = Floe::Workflow.new(payload, context, creds) | ||
wf.step | ||
wf.run_nonblock | ||
|
||
update!(:context => wf.context.to_h, :status => wf.status, :output => wf.output) | ||
|
||
|
@@ -87,6 +90,6 @@ def run(args = {}) | |
object.after_ae_delivery(ae_result) | ||
end | ||
|
||
run_queue(:zone => zone, :role => role, :object => object) unless wf.end? | ||
run_queue(:zone => zone, :role => role, :object => object, :deliver_on => 10.seconds.from_now.utc, :server_guid => MiqServer.my_server.guid) unless wf.end? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @agrare Is this what you mentioned to me? So my question here is why we need the pinning and deliver time at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because this re-queue while the docker/podman/k8s task is still running so we don't want it to spin (hence deliver on) and we need to run it on the same server so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohhh I see - ok, this is what I wasn't understanding in our discussion yesterday because I thought it worked differently. |
||
end | ||
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.
🎉