On Thu, Jan 14, 2021 at 09:03:35AM +0800, Wu Zhende wrote:
Use es-jobs to summarizes information about a group of related jobs.
[Example] es-jobs submit_id=xxx -f 'job_state,dmesg.timestamp:last' -r '-1' -s 'on_fail' means:
- query the job whose submit_id is xxx
- I want to get job_state,dmesg.timestamp:last
- don't refine jobs
- -s 'on_fail' to get data in stats which contain 'on_fail'
[Output] { "job_state": [ "crystal.605716.failed" ], "dmesg.timestamp:last": [ 657.181408 ], "stats_filter_result": { "crystal.605716.openeuler_docker.\u001b[0mwordpress_build_on_fail": 1 }, "stats.count": { "stats.has_error": 1, "stats.has_error_jobs": [ "crystal.605716" ] } }
Signed-off-by: Wu Zhende wuzhende666@163.com
lib/es_jobs.rb | 139 +++++++++++++++++++++++++++++++++++++++++++++++++ sbin/es-jobs | 58 +++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 lib/es_jobs.rb create mode 100755 sbin/es-jobs
diff --git a/lib/es_jobs.rb b/lib/es_jobs.rb new file mode 100644 index 0000000..a90b1ba --- /dev/null +++ b/lib/es_jobs.rb @@ -0,0 +1,139 @@ +# SPDX-License-Identifier: GPL-2.0-only +# frozen_string_literal: true
Add the copyright.
- opts.separator 'like es-jobs submit_id=xxx -r "-1,0,1,2,3"'
-r can use only one number of "-1,0,1,2,3"?
- opts.separator '-1 means not refine'
- opts.separator '{
- -1 => null,
- 0 => stats.succes,
- 1 => stats.unknow,
- 2 => stats.warning,
- 3 => stats.has_error
+}'
Add a clear help info.
Thanks, Xueliang