[original style] os: openeuler os_version: 20.03 os_arch: aarch64
os: openeuler os_version: 20 os_arch: aarch64
[now style] os os_version os_arch: - openeuler 20.03 aarch64 - openeuler 20 aarch64
[point] Currently, only one key of this style(xx xxx xx) can be contained in YAML files.
Signed-off-by: Bai Jing 799286817@qq.com --- lib/job.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 01719c2e..f3b7a092 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -250,7 +250,7 @@ class Job hash.delete('override') end hash.merge!(@overrides) - @jobs << hash + @jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end rescue StandardError => e log_error "#{jobfile}: " + e.message @@ -280,6 +280,30 @@ class Job @jobfile = jobfile end
+ def multi_args(hash) + jobs_array = [] + hash.each { |key, value| + next unless key =~ /^\w.*\s+.*\w$/ + + next unless value.class == Array + + key_array = key.split + value.each do |v| + v_array = v.split + next unless key_array.size == v_array.size + + hash_job = hash.clone + key_array.size.times do |i| + hash_job[key_array[i]] = v_array[i] + end + hash_job.delete(key) + jobs_array << hash_job + end + } + jobs_array = [hash] if jobs_array.empty? + return jobs_array + end + def delete_keys_from_spec(spec_file) return unless File.exist? spec_file
On Tue, Nov 17, 2020 at 03:56:04PM +0800, Bai Jing wrote:
[original style] os: openeuler os_version: 20.03 os_arch: aarch64
os: openeuler os_version: 20 os_arch: aarch64
[now style] os os_version os_arch:
- openeuler 20.03 aarch64
- openeuler 20 aarch64
How to use this in scheduler or will this be splited atom job?
Thanks, Xueliang
[point] Currently, only one key of this style(xx xxx xx) can be contained in YAML files.
Signed-off-by: Bai Jing 799286817@qq.com
lib/job.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 01719c2e..f3b7a092 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -250,7 +250,7 @@ class Job hash.delete('override') end hash.merge!(@overrides)
@jobs << hash
rescue StandardError => e log_error "#{jobfile}: " + e.message@jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end
@@ -280,6 +280,30 @@ class Job @jobfile = jobfile end
- def multi_args(hash)
- jobs_array = []
- hash.each { |key, value|
next unless key =~ /^\w.*\s+.*\w$/
next unless value.class == Array
key_array = key.split
value.each do |v|
v_array = v.split
next unless key_array.size == v_array.size
hash_job = hash.clone
key_array.size.times do |i|
hash_job[key_array[i]] = v_array[i]
end
hash_job.delete(key)
jobs_array << hash_job
end
- }
- jobs_array = [hash] if jobs_array.empty?
- return jobs_array
- end
- def delete_keys_from_spec(spec_file) return unless File.exist? spec_file
-- 2.23.0
On Tue, Nov 17, 2020 at 04:05:16PM +0800, Cao Xueliang wrote:
On Tue, Nov 17, 2020 at 03:56:04PM +0800, Bai Jing wrote:
[original style] os: openeuler os_version: 20.03 os_arch: aarch64
os: openeuler os_version: 20 os_arch: aarch64
[now style] os os_version os_arch:
- openeuler 20.03 aarch64
- openeuler 20 aarch64
How to use this in scheduler or will this be splited atom job?
I have see that in 2/2 patch.
Thanks, Xueliang
Thanks, Xueliang
[point] Currently, only one key of this style(xx xxx xx) can be contained in YAML files.
Signed-off-by: Bai Jing 799286817@qq.com
lib/job.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 01719c2e..f3b7a092 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -250,7 +250,7 @@ class Job hash.delete('override') end hash.merge!(@overrides)
@jobs << hash
rescue StandardError => e log_error "#{jobfile}: " + e.message@jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end
@@ -280,6 +280,30 @@ class Job @jobfile = jobfile end
- def multi_args(hash)
- jobs_array = []
- hash.each { |key, value|
next unless key =~ /^\w.*\s+.*\w$/
next unless value.class == Array
key_array = key.split
value.each do |v|
v_array = v.split
next unless key_array.size == v_array.size
hash_job = hash.clone
key_array.size.times do |i|
hash_job[key_array[i]] = v_array[i]
end
hash_job.delete(key)
jobs_array << hash_job
end
- }
- jobs_array = [hash] if jobs_array.empty?
- return jobs_array
- end
- def delete_keys_from_spec(spec_file) return unless File.exist? spec_file
-- 2.23.0
On Tue, Nov 17, 2020 at 04:05:16PM +0800, Cao Xueliang wrote:
On Tue, Nov 17, 2020 at 03:56:04PM +0800, Bai Jing wrote:
[original style] os: openeuler os_version: 20.03 os_arch: aarch64
os: openeuler os_version: 20 os_arch: aarch64
[now style] os os_version os_arch:
- openeuler 20.03 aarch64
- openeuler 20 aarch64
How to use this in scheduler or will this be splited atom job?
It will be split into atom jobs.
Thanks, Baijing
[point] Currently, only one key of this style(xx xxx xx) can be contained in YAML files.
Signed-off-by: Bai Jing 799286817@qq.com
lib/job.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 01719c2e..f3b7a092 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -250,7 +250,7 @@ class Job hash.delete('override') end hash.merge!(@overrides)
@jobs << hash
rescue StandardError => e log_error "#{jobfile}: " + e.message@jobs.concat(multi_args(hash)) # return [hash] or [h1,h2] end
@@ -280,6 +280,30 @@ class Job @jobfile = jobfile end
- def multi_args(hash)
- jobs_array = []
- hash.each { |key, value|
next unless key =~ /^\w.*\s+.*\w$/
next unless value.class == Array
key_array = key.split
value.each do |v|
v_array = v.split
next unless key_array.size == v_array.size
hash_job = hash.clone
key_array.size.times do |i|
hash_job[key_array[i]] = v_array[i]
end
hash_job.delete(key)
jobs_array << hash_job
end
- }
- jobs_array = [hash] if jobs_array.empty?
- return jobs_array
- end
- def delete_keys_from_spec(spec_file) return unless File.exist? spec_file
-- 2.23.0