4 Star 18 Fork 184

Fengguang/lkp-tests

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cancel 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
#! /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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wu_fengguang/lkp-tests.git
git@gitee.com:wu_fengguang/lkp-tests.git
wu_fengguang
lkp-tests
lkp-tests
master

搜索帮助