+SRV_HTTP_HOST = defaults['SRV_HTTP_HOST'] || Open3.capture3('curl ip.sb')[0].chomp +SRV_HTTP_PORT = defaults['SRV_HTTP_PORT'] || '11300'
we had defined both SRV_HTTP_HOST, SRV_HTTP_PORT in compass-ci/lib/constants.rb, you can also use it.
ok.
+def es_find(job_id, search_field)
- %x(es-find id=#{job_id}| grep #{search_field}| awk -F '"' '{print $4}').chomp
+end
we can use compass-ci/lib/es_query.rb like: es = ESQuery.new job = es.query_by_id($job_id)
result_root = job['result_root'] ...
good
Thanks, Yinsi
Thanks, Weitao
+def get_log_params(os_array, message)
- job_id = message.split('=')[1].chomp
- os_params = os_array.join '/'
- s_time = monitor_job(job_id, 'boot')
- e_time = monitor_job(job_id, 'extract_finished')
- return if s_time.nil? || e_time.nil?
- c_time = (s_time - e_time).floor
- job_state = es_find(job_id, 'job_state')
- result_root = es_find(job_id, 'result_root')
- result_url = SRV_HTTP_HOST.concat ':', SRV_HTTP_PORT, result_root
- logging(job_id, os_params, s_time, e_time, c_time, job_state, result_url)
+end
def submit_job(os_array, testbox) os = os_array[0] os_arch = os_array[1] @@ -42,6 +95,8 @@ def submit_job(os_array, testbox) # Process.fork do # %x(./my-qemu.sh >/dev/null 2>&1) # end
- get_log_params(os_array, message)
end
def get_os_array(os_mount, testbox) @@ -56,4 +111,6 @@ def get_testbox(os_mount) TESTBOX.each { |testbox| get_os_array(os_mount, testbox) } end
+logging('Job_ID', 'OS', 'Begin', 'End', 'Cost/sec', 'Job_State', 'Result_Url')
MOUNT_TYPE.each { |os_mount| get_testbox(os_mount) }
2.23.0