[Why] When submit -m xxx.yaml, may split to many jobs, and return many job_id. In this scenario, these jobs need to be monitored at the same time. [How] Use array replace string, like this: {"job_id": ["1", "2", "3"]} [Example] submit -m iperf.yaml submit iperf.yaml, got job_id=z9.109165 submit iperf.yaml, got job_id=z9.109166 query=>{"job_id":["z9.109165","z9.109166"]} connect to ws://localhost:11310/filter {"job_id"=>"z9.109165", "job_state"=>"boot"} {"job_id"=>"z9.109166", "job_state"=>"boot"}
Signed-off-by: Wu Zhende wuzhende666@163.com --- lib/monitor.rb | 4 ++++ sbin/submit | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/monitor.rb b/lib/monitor.rb index c20794e8..e0098390 100755 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -99,6 +99,10 @@ class Monitor def run(timeout = nil) merge_overrides field_check + + @query.each do |k, v| + @query[k] = JSON.parse(v) + end query = @query.to_json puts "query=>#{query}"
diff --git a/sbin/submit b/sbin/submit index 4884ad63..bc90e2e0 100755 --- a/sbin/submit +++ b/sbin/submit @@ -157,7 +157,7 @@ end
if opt_monitor job_hash_list[0].delete('define_files') - opt_monitor_query.merge!({'job_id' => job_ids[0]}) + opt_monitor_query.merge!({'job_id' => job_ids}) cmd = "#{LKP_SRC}/sbin/monitor -f '#{opt_monitor_query.to_json}' -j '#{job_hash_list[0].to_json}' -a #{actions.join(',')} -s 'job_state: extract_finished'" exec cmd end