diff --git a/CMakeLists.txt b/CMakeLists.txt index 3da2060192..7284a680a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,7 +181,7 @@ set(SOURCE_FILES src/wrench/services/storage/StorageServiceMessage.cpp src/wrench/services/storage/StorageServiceMessage.h include/wrench/services/storage/storage_helpers/FileTransferThread.h - src/wrench/services/storage/storage_helpers/LocicalFileSystem.cpp + src/wrench/services/storage/storage_helpers/LogicalFileSystem.cpp src/wrench/services/storage/storage_helpers/LogicalFileSystem.h src/wrench/services/storage/storage_helpers/FileTransferThread.cpp src/wrench/services/storage/storage_helpers/FileTransferThreadMessage.h diff --git a/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp b/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp index d32ff89ea7..67037a437d 100644 --- a/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp +++ b/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp @@ -331,7 +331,7 @@ namespace wrench { throw WorkflowExecutionException( std::make_shared(f, FileLocation::SCRATCH)); } - files_to_read[f] = FileLocation::LOCATION(this->scratch_space, job->getName()); + files_to_read[f] = FileLocation::LOCATION(this->scratch_space, this->scratch_space->getMountPoint() + "/" + job->getName()); this->files_stored_in_scratch.insert(f); } } @@ -369,7 +369,7 @@ namespace wrench { if (work->file_locations.find(f) != work->file_locations.end()) { files_to_write[f] = work->file_locations[f]; } else { - files_to_write[f] = FileLocation::LOCATION(this->scratch_space, job->getName()); + files_to_write[f] = FileLocation::LOCATION(this->scratch_space, this->scratch_space->getMountPoint() + "/" + job->getName()); } } StorageService::writeFiles(files_to_write); diff --git a/src/wrench/services/storage/storage_helpers/FileLocation.cpp b/src/wrench/services/storage/storage_helpers/FileLocation.cpp index 45e54c6104..449b9322c9 100644 --- a/src/wrench/services/storage/storage_helpers/FileLocation.cpp +++ b/src/wrench/services/storage/storage_helpers/FileLocation.cpp @@ -140,7 +140,7 @@ namespace wrench { /** - * @brief Method to sanitize an absolute path + * @brief Method to sanitize an absolute path (and make it absolute if it's not) * @param path * @return */ @@ -151,11 +151,6 @@ namespace wrench { throw std::invalid_argument("FileLocation::sanitizePath(): path cannot be empty"); } - // Must terminate with a / - if (path.at(0) != '/') { - throw std::invalid_argument("FileLocation::sanitizePath(): An absolute path must start with '/' (" + path + ")"); - } - // Cannot have certain substring (why not) std::string unallowed_characters[] = {"\\", " ", "~", "`", "\"", "&", "*", "?"}; for (auto const &c : unallowed_characters) { @@ -164,9 +159,9 @@ namespace wrench { } } - // Make it /-terminated + // Make it /-started and /-terminated if (path.at(path.length()-1) != '/') { - path = path + "/"; + path = "/" + path + "/"; } // Deal with "", "." and ".." diff --git a/src/wrench/services/storage/storage_helpers/FileTransferThread.cpp b/src/wrench/services/storage/storage_helpers/FileTransferThread.cpp index 339684e24e..f3324a7008 100644 --- a/src/wrench/services/storage/storage_helpers/FileTransferThread.cpp +++ b/src/wrench/services/storage/storage_helpers/FileTransferThread.cpp @@ -440,13 +440,14 @@ namespace wrench { try { message = S4U_Mailbox::getMessage(request_answer_mailbox, this->network_timeout); } catch (std::shared_ptr &cause) { - throw WorkflowExecutionException(cause); + throw cause; } + if (auto msg = std::dynamic_pointer_cast(message)) { // If it's not a success, throw an exception if (not msg->success) { - throw WorkflowExecutionException(msg->failure_cause); + throw msg->failure_cause; } } else { throw std::runtime_error("FileTransferThread::downloadFileFromStorageService(): Received an unexpected [" + @@ -499,7 +500,7 @@ namespace wrench { dst_location->getStorageService()->getHostname(), dst_location->getMountPoint()); } catch (std::shared_ptr &e) { - throw WorkflowExecutionException(e); + throw; } } diff --git a/src/wrench/services/storage/storage_helpers/LocicalFileSystem.cpp b/src/wrench/services/storage/storage_helpers/LogicalFileSystem.cpp similarity index 97% rename from src/wrench/services/storage/storage_helpers/LocicalFileSystem.cpp rename to src/wrench/services/storage/storage_helpers/LogicalFileSystem.cpp index 27f35eecb9..95b14cd70e 100644 --- a/src/wrench/services/storage/storage_helpers/LocicalFileSystem.cpp +++ b/src/wrench/services/storage/storage_helpers/LogicalFileSystem.cpp @@ -231,8 +231,9 @@ namespace wrench { } if (this->reserved_space.find(key) == this->reserved_space.end()) { - throw std::runtime_error("LogicalFileSystem::unreserveSpace(): Space was not being reserved for storing file " + - file->getID() + "at path " + absolute_path); + return; // oh well +// throw std::runtime_error("LogicalFileSystem::unreserveSpace(): Space was not being reserved for storing file " + +// file->getID() + "at path " + absolute_path); } this->reserved_space.erase(key); diff --git a/test/compute_services/StandardJobExecutorTest.cpp b/test/compute_services/StandardJobExecutorTest.cpp index 3895acd907..068c74ffc4 100644 --- a/test/compute_services/StandardJobExecutorTest.cpp +++ b/test/compute_services/StandardJobExecutorTest.cpp @@ -2099,7 +2099,7 @@ void StandardJobExecutorTest::do_TwoMultiCoreTasksTest_test() { // Create another Storage Services ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname2, {"/"}))); + new wrench::SimpleStorageService(hostname2, {"/disk2"}))); // Create a WMS std::shared_ptr wms = nullptr;; @@ -2364,7 +2364,7 @@ void StandardJobExecutorTest::do_MultiHostTest_test() { ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); // Get a hostname - std::string hostname = simulation->getHostnameList()[0]; + std::string hostname = "Host1"; // Create a Compute Service (we don't use it) std::shared_ptr compute_service; @@ -2378,7 +2378,7 @@ void StandardJobExecutorTest::do_MultiHostTest_test() { // Create another Storage Services ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, {"/"}))); + new wrench::SimpleStorageService(hostname, {"/disk2"}))); // Create a WMS std::shared_ptr wms = nullptr;;