[PATCH v2 compass-ci] sched: throw an exception when deps/pkg does not exist

When submitting a job, an exception is thrown when deps/pkg does not exist on the server. Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..7785c2a 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,10 +389,12 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) end end -- 2.23.0

What exception? On Fri, Oct 16, 2020 at 10:51:48AM +0800, Cao Xueliang wrote:
When submitting a job, an exception is thrown when deps/pkg does not exist on the server.
Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..7785c2a 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,10 +389,12 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) end end -- 2.23.0

On Mon, Oct 19, 2020 at 04:04:05PM +0800, Wu Fengguang wrote:
What exception?
Use File.real_path in JobHelper.service_path, it will throw an exception like: Error resolving real path of 'srv/initrd/deps/initramfs/openeuler/aarch65/20.03/sysbench-mysql.cgz': No such file or directory. Thanks, Xueliang
On Fri, Oct 16, 2020 at 10:51:48AM +0800, Cao Xueliang wrote:
When submitting a job, an exception is thrown when deps/pkg does not exist on the server.
Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..7785c2a 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,10 +389,12 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) end end -- 2.23.0

On Mon, Oct 19, 2020 at 04:28:07PM +0800, Cao Xueliang wrote:
On Mon, Oct 19, 2020 at 04:04:05PM +0800, Wu Fengguang wrote:
What exception?
Use File.real_path in JobHelper.service_path, it will throw an exception like: Error resolving real path of 'srv/initrd/deps/initramfs/openeuler/aarch65/20.03/sysbench-mysql.cgz': No such file or directory.
Why File.exists? will raise such exception? Your patch only changed that. Thanks, Fengguang
On Fri, Oct 16, 2020 at 10:51:48AM +0800, Cao Xueliang wrote:
When submitting a job, an exception is thrown when deps/pkg does not exist on the server.
Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..7785c2a 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,10 +389,12 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) end end -- 2.23.0

On Mon, Oct 19, 2020 at 04:36:29PM +0800, Wu Fengguang wrote:
On Mon, Oct 19, 2020 at 04:28:07PM +0800, Cao Xueliang wrote:
On Mon, Oct 19, 2020 at 04:04:05PM +0800, Wu Fengguang wrote:
What exception?
Use File.real_path in JobHelper.service_path, it will throw an exception like: Error resolving real path of 'srv/initrd/deps/initramfs/openeuler/aarch65/20.03/sysbench-mysql.cgz': No such file or directory.
Why File.exists? will raise such exception? Your patch only changed that.
I deleted the File.exists?, the cgz file is must for pp if pp has a program and service_path will throw an exception if the cgz does not exist. I should describe that in the change log. Thanks, Xueliang
Thanks, Fengguang
On Fri, Oct 16, 2020 at 10:51:48AM +0800, Cao Xueliang wrote:
When submitting a job, an exception is thrown when deps/pkg does not exist on the server.
Signed-off-by: Cao Xueliang <caoxl78320@163.com> --- src/lib/job.cr | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/job.cr b/src/lib/job.cr index 32aa662..7785c2a 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -389,10 +389,12 @@ class Job program_params.keys.each do |program| deps_dest_file = "#{SRV_INITRD}/deps/#{mount_type}/#{os_dir}/#{program}.cgz" pkg_dest_file = "#{SRV_INITRD}/pkg/#{mount_type}/#{os_dir}/#{program}.cgz" - if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") && File.exists?(deps_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/distro/depends/#{program}") initrd_deps_arr << "#{initrd_http_prefix}" + JobHelper.service_path(deps_dest_file) end - if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") && File.exists?(pkg_dest_file) + + if File.exists?("#{ENV["LKP_SRC"]}/pkg/#{program}") initrd_pkg_arr << "#{initrd_http_prefix}" + JobHelper.service_path(pkg_dest_file) end end -- 2.23.0

On Mon, Oct 19, 2020 at 04:48:18PM +0800, Cao Xueliang wrote:
On Mon, Oct 19, 2020 at 04:36:29PM +0800, Wu Fengguang wrote:
On Mon, Oct 19, 2020 at 04:28:07PM +0800, Cao Xueliang wrote:
On Mon, Oct 19, 2020 at 04:04:05PM +0800, Wu Fengguang wrote:
What exception?
Use File.real_path in JobHelper.service_path, it will throw an exception like: Error resolving real path of 'srv/initrd/deps/initramfs/openeuler/aarch65/20.03/sysbench-mysql.cgz': No such file or directory.
Why File.exists? will raise such exception? Your patch only changed that.
I deleted the File.exists?, the cgz file is must for pp if pp has a program and service_path will throw an exception if the cgz does not exist.
Well that's still not so clear. Perhaps better mainly in code context. Thanks, Fengguang
participants (2)
-
Cao Xueliang
-
Wu Fengguang