Top Level Namespace
Defined Under Namespace
Modules: CMake, Configuration, Lcov, ResultsProcessor, Runners
Classes: Build, CMakeBuildArgs, CannotMatchCompiler, CodeMessage, DecentCIKnownError, NoDecentCIFiles, PotentialBuild, TestMessage, TestResult
Instance Method Summary
collapse
Instance Method Details
#github_check_rate_limit(headers) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/github.rb', line 3
def github_check_rate_limit()
rate_limit = ['x-ratelimit-limit'].to_i
rate_limit_remaining = ['x-ratelimit-remaining'].to_i
rate_limit_reset = ['x-ratelimit-reset'].to_i
rate_limit_start = rate_limit_reset - 60 * 60
t = Time.now
t.utc
rate_limit_current_time = t.to_i
burn_rate_queries_per_second = (rate_limit - rate_limit_remaining).to_f / (rate_limit_current_time - rate_limit_start).to_f
burn_rate_queries_per_hour = burn_rate_queries_per_second * 60 * 60
$logger.info("ratelimit #{rate_limit}")
$logger.info("ratelimit_remaining #{rate_limit_remaining}")
$logger.info("ratelimit_reset #{rate_limit_reset}")
$logger.info("ratelimit_start #{rate_limit_start}")
$logger.info("ratelimit_current_time #{rate_limit_current_time}")
$logger.info("ratelimit_burn_rate_queries_per_hour #{burn_rate_queries_per_hour}")
rate_limit_reset - rate_limit_current_time end
|
#github_query(client, num_retries = 2) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/github.rb', line 26
def github_query(client, num_retries = 2)
count = 0
loop do
begin
return yield
rescue Octokit::TooManyRequests
count += 1
if count > num_retries
$logger.error('Rate limit has been exceeded retries exhausted, re-throwing error')
raise
end
time_to_sleep = github_check_rate_limit(client.last_response.) + 3 $logger.info("Rate limit has been exceeded, rate limit will be reset in: #{time_to_sleep}s")
$logger.info("Rate limit has been exceeded, sleeping for: #{time_to_sleep}s")
sleep(time_to_sleep) if time_to_sleep.positive?
end
end
end
|
#processor_count ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/processor.rb', line 3
def processor_count
os_name = RbConfig::CONFIG['target_os']
if os_name.match(/mingw|mswin/)
require 'win32ole'
result = WIN32OLE.connect('winmgmts://').ExecQuery('select NumberOfLogicalProcessors from Win32_Processor')
result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)
elsif File.readable?('/proc/cpuinfo')
IO.read('/proc/cpuinfo').scan(/^processor/).size
elsif File.executable?('/usr/bin/hwprefs')
IO.popen('/usr/bin/hwprefs thread_count').read.to_i
elsif File.executable?('/usr/sbin/psrinfo')
IO.popen('/usr/sbin/psrinfo').read.scan(/^.*on-*line/).size
elsif File.executable?('/usr/sbin/ioscan')
IO.popen('/usr/sbin/ioscan -kC processor') do |out|
out.read.scan(/^.*processor/).size
end
elsif File.executable?('/usr/sbin/pmcycles')
IO.popen('/usr/sbin/pmcycles -m').read.count("\n")
elsif File.executable?('/usr/sbin/lsdev')
IO.popen('/usr/sbin/lsdev -Cc processor -S 1').read.count("\n")
elsif File.executable?('/usr/sbin/sysconf') && os_name =~ /irix/i
IO.popen('/usr/sbin/sysconf NPROC_ONLN').read.to_i
elsif File.executable?('/usr/sbin/sysctl')
IO.popen('/usr/sbin/sysctl -n hw.ncpu').read.to_i
elsif File.executable?('/sbin/sysctl')
IO.popen('/sbin/sysctl -n hw.ncpu').read.to_i
else
warn("Unknown platform: #{RbConfig::CONFIG['target_os']}")
warn('Assuming 1 processor.')
1
end
end
|