[SCM] ci-tooling packaging branch, master, updated. 2501cbd793ae999db97b63f9b0c15cb636276086

Harald Sitter apachelogger-guest at moszumanska.debian.org
Mon Feb 23 14:17:44 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=2501cbd

The following commit has been merged in the master branch:
commit 2501cbd793ae999db97b63f9b0c15cb636276086
Author: Harald Sitter <sitter at kde.org>
Date:   Mon Feb 23 15:17:41 2015 +0100

    move all-jobs-built to blockingthreadpool
---
 kci/all-jobs-built.rb | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/kci/all-jobs-built.rb b/kci/all-jobs-built.rb
index e5313be..037dc85 100644
--- a/kci/all-jobs-built.rb
+++ b/kci/all-jobs-built.rb
@@ -2,11 +2,10 @@
 
 Dir.chdir('/tmp/') # Containers by default have a bugged out pwd, force /tmp.
 
-require 'thwait'
 require_relative 'lib/jenkins'
 require_relative 'lib/lp'
+require_relative 'lib/thread_pool'
 
-THREAD_COUNT = 16
 QUALIFIER_STATES = %w(success unstable)
 
 def abort(name)
@@ -14,33 +13,31 @@ def abort(name)
   exit 1
 end
 
-Project = Struct.new(:series, :type)
-project = Project.new(ENV.fetch('DIST'), ENV.fetch('TYPE'))
+dist = ENV.fetch('DIST')
+type = ENV.fetch('TYPE')
 
 job_name_queue = Queue.new
-job_names = Jenkins.job.list("^#{project.series}_#{project.type}_.*")
+job_names = Jenkins.job.list("^#{dist}_#{type}_.*")
 job_names.each { |j| job_name_queue << j }
 
 # Check status of the jobs through a very simply threaded queue.
 # This allows $threadcount concurrent connections which is heaps
 # faster than doing this sequentially. In particular when run
 # outside localhost.
-threads = []
-THREAD_COUNT.times do
-  threads << Thread.new do
-    loop do
-      # Non-waiting pop will raise a ThreadError, stopping the thread.
-      name = job_name_queue.pop(true)
-      begin
-        abort(name) unless QUALIFIER_STATES.include?(Jenkins.job.status(name))
-        abort(name) if Jenkins.client.queue.list.include?(name)
-      rescue
-        retry
-      end
+BlockingThreadPool.run do
+  until job_name_queue.empty?
+    name = job_name_queue.pop(true)
+    retries = 5
+    begin
+      abort(name) unless QUALIFIER_STATES.include?(Jenkins.job.status(name))
+      abort(name) if Jenkins.client.queue.list.include?(name)
+    rescue => e
+      raise e if retries == 0
+      print "Error on job #{name} :: #{e}
"
+      retries -= 1
+      retry
     end
   end
 end
 
-ThreadsWait.all_waits(threads)
-
 exit 0

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list