代码拉取完成,页面将自动刷新
#! /usr/bin/env ruby
# frozen_string_literal: true
LKP_SRC = ENV['LKP_SRC'] || File.dirname(File.dirname(File.realpath($PROGRAM_NAME)))
require 'yaml'
require 'optparse'
require "#{LKP_SRC}/lib/load_file"
require "#{LKP_SRC}/lib/scheduler_client"
def format_result(result)
info = "job_id: #{result['job_id']}"
info += ' ' * (20 - result['job_id'].size) + "result: #{result['result']}"
return info if result['result'] == 'success'
info += ' ' * (20 - result['result'].size)
info + "message: #{result['message']}"
end
options = OptionParser.new do |opts|
opts.banner = 'Usage: cancel job_id1 job_id2 ...'
opts.separator ' cancel jobs that have not been consumed'
opts.separator ''
opts.separator 'options:'
opts.on('-h', '--help', 'show this message') do
puts options
exit
end
end
options.parse!(ARGV)
if ARGV.empty?
puts(options)
exit
end
hash = load_my_config
hash['job_ids'] = ARGV
raise 'Please configure SCHED_HOST' unless hash['SCHED_HOST']
raise 'Please configure SCHED_PORT' unless hash['SCHED_PORT']
scheduler_client = SchedulerClient.new(hash['SCHED_HOST'], hash['SCHED_PORT'])
response = scheduler_client.cancel_jobs(hash.to_json)
response = JSON.parse(response)
if response['error_msg']
puts response['error_msg']
exit
end
response['results'].each do |res|
puts format_result(res)
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。