From d0c39356675a5fc2513519b0455f82b793bac826 Mon Sep 17 00:00:00 2001 From: Peter Rudenko Date: Thu, 5 May 2022 12:52:56 +0300 Subject: [PATCH] Print error when target file doesn't exist. Signed-off-by: Peter Rudenko --- .../apache/spark/shuffle/ucx/perf/UcxPerfBenchmark.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/scala/org/apache/spark/shuffle/ucx/perf/UcxPerfBenchmark.scala b/src/main/scala/org/apache/spark/shuffle/ucx/perf/UcxPerfBenchmark.scala index 11b5800d..6a570c3d 100755 --- a/src/main/scala/org/apache/spark/shuffle/ucx/perf/UcxPerfBenchmark.scala +++ b/src/main/scala/org/apache/spark/shuffle/ucx/perf/UcxPerfBenchmark.scala @@ -69,7 +69,12 @@ object UcxPerfBenchmark extends App with Logging { } val file = if (cmd.hasOption(FILE_OPTION)) { - new File(cmd.getOptionValue(FILE_OPTION)) + val f = new File(cmd.getOptionValue(FILE_OPTION)) + if (!f.exists()) { + System.err.println(s"File ${cmd.getOptionValue(FILE_OPTION)} does not exists.") + System.exit(-1) + } + f } else { null } @@ -126,7 +131,7 @@ object UcxPerfBenchmark extends App with Logging { ucxTransport.init() val currentThread = Thread.currentThread() - val channel = new RandomAccessFile(options.file, "rw").getChannel + val channel = new RandomAccessFile(options.file, "r").getChannel ShutdownHookManager.addShutdownHook(()=>{ currentThread.interrupt()