Skip to content

Instantly share code, notes, and snippets.

@iNecas
Created February 24, 2017 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iNecas/feb162cbc0b76936820772164f634bf9 to your computer and use it in GitHub Desktop.
Save iNecas/feb162cbc0b76936820772164f634bf9 to your computer and use it in GitHub Desktop.
rex-in-batch.patch
diff --git a/app/lib/actions/remote_execution/run_hosts_job.rb b/app/lib/actions/remote_execution/run_hosts_job.rb
index 40dd320..c146ea8 100644
--- a/app/lib/actions/remote_execution/run_hosts_job.rb
+++ b/app/lib/actions/remote_execution/run_hosts_job.rb
@@ -25,7 +25,7 @@ module Actions
job_invocation = JobInvocation.find(input[:job_invocation_id])
proxy_selector = RemoteExecutionProxySelector.new
- ::Host.where(:id => current_batch).map do |host|
+ current_batch.map do |host|
# composer creates just "pattern" for template_invocations because target is evaluated
# during actual run (here) so we build template invocations from these patterns
template_invocation = job_invocation.pattern_template_invocation_for_host(host).deep_clone
@@ -35,15 +35,15 @@ module Actions
end
def batch(from, size)
- host_ids.slice(from, size)
+ hosts.slice(from, size)
end
def total_count
- host_ids.count
+ hosts.count
end
- def host_ids
- JobInvocation.find(input[:job_invocation_id]).targeting.host_ids
+ def hosts
+ JobInvocation.find(input[:job_invocation_id]).targeting.hosts.order(:name, :id)
end
def set_up_concurrency_control(invocation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment