[Why] When use 'submit -m -a' may get error. Because -a add 'define_file' may include ' xxxx', this causes 'monitor -j' parsing errors. [Error info] Traceback (most recent call last): 11: from /code/lkp-tests/sbin/monitor:59:in `<main>' 10: from /usr/share/ruby/optparse.rb:1648:in `parse!' 9: from /usr/share/ruby/optparse.rb:1626:in `permute!' 8: from /usr/share/ruby/optparse.rb:1532:in `order!' 7: from /usr/share/ruby/optparse.rb:1538:in `parse_in_order' 6: from /usr/share/ruby/optparse.rb:1538:in `catch' 5: from /usr/share/ruby/optparse.rb:1584:in `block in parse_in_order' 4: from /home/wuzhende/code/lkp-tests/sbin/monitor:51:in `block (2 levels) in <main>' 3: from /usr/share/ruby/psych.rb:263:in `load' 2: from /usr/share/ruby/psych.rb:350:in `parse' 1: from /usr/share/ruby/psych.rb:402:in `parse_stream' /usr/share/ruby/psych.rb:402:in `parse': (<unknown>): found unexpected end of stream while scanning a quoted scalar at line 1 column 1595 (Psych::SyntaxError)
Signed-off-by: Wu Zhende wuzhende666@163.com --- sbin/submit | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sbin/submit b/sbin/submit index c49e1e9a..4884ad63 100755 --- a/sbin/submit +++ b/sbin/submit @@ -79,7 +79,7 @@ if ARGV.size.zero? end
job_ids = [] -job_json_list = [] +job_hash_list = []
def find_jobfile(jobfile) return jobfile if File.exist?(jobfile) @@ -126,7 +126,7 @@ ARGV.each do |jobfile|
# merge job info job_hash = job.to_hash - job_json_list << job_hash.to_json + job_hash_list << job_hash job_hash = job_hash.merge(sh_hash)
# save job to yaml @@ -156,7 +156,8 @@ ARGV.each do |jobfile| end
if opt_monitor + job_hash_list[0].delete('define_files') opt_monitor_query.merge!({'job_id' => job_ids[0]}) - cmd = "#{LKP_SRC}/sbin/monitor -f '#{opt_monitor_query.to_json}' -j '#{job_json_list[0]}' -a #{actions.join(',')} -s 'job_state: extract_finished'" + 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
On Wed, Oct 28, 2020 at 05:31:39PM +0800, Wu Zhende wrote:
[Why] When use 'submit -m -a' may get error. Because -a add 'define_file' may include ' xxxx', this causes 'monitor -j' parsing errors. [Error info] Traceback (most recent call last): 11: from /code/lkp-tests/sbin/monitor:59:in `<main>' 10: from /usr/share/ruby/optparse.rb:1648:in `parse!' 9: from /usr/share/ruby/optparse.rb:1626:in `permute!' 8: from /usr/share/ruby/optparse.rb:1532:in `order!' 7: from /usr/share/ruby/optparse.rb:1538:in `parse_in_order' 6: from /usr/share/ruby/optparse.rb:1538:in `catch' 5: from /usr/share/ruby/optparse.rb:1584:in `block in parse_in_order' 4: from /home/wuzhende/code/lkp-tests/sbin/monitor:51:in `block (2 levels) in <main>' 3: from /usr/share/ruby/psych.rb:263:in `load' 2: from /usr/share/ruby/psych.rb:350:in `parse' 1: from /usr/share/ruby/psych.rb:402:in `parse_stream' /usr/share/ruby/psych.rb:402:in `parse': (<unknown>): found unexpected end of stream while scanning a quoted scalar at line 1 column 1595 (Psych::SyntaxError)
Signed-off-by: Wu Zhende wuzhende666@163.com
Looks good to me.
Thanks, Yale
sbin/submit | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sbin/submit b/sbin/submit index c49e1e9a..4884ad63 100755 --- a/sbin/submit +++ b/sbin/submit @@ -79,7 +79,7 @@ if ARGV.size.zero? end
job_ids = [] -job_json_list = [] +job_hash_list = []
def find_jobfile(jobfile) return jobfile if File.exist?(jobfile) @@ -126,7 +126,7 @@ ARGV.each do |jobfile|
# merge job info job_hash = job.to_hash
- job_json_list << job_hash.to_json
job_hash_list << job_hash job_hash = job_hash.merge(sh_hash)
# save job to yaml
@@ -156,7 +156,8 @@ ARGV.each do |jobfile| end
if opt_monitor
- job_hash_list[0].delete('define_files') opt_monitor_query.merge!({'job_id' => job_ids[0]})
- cmd = "#{LKP_SRC}/sbin/monitor -f '#{opt_monitor_query.to_json}' -j '#{job_json_list[0]}' -a #{actions.join(',')} -s 'job_state: extract_finished'"
- 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
2.23.0