From 3793d50f8b32a3a73724d0b1d0d4723238f7a4e7 Mon Sep 17 00:00:00 2001 From: henricasanova Date: Wed, 2 Oct 2019 10:09:48 -1000 Subject: [PATCH] test fix (#2) --- .../workflow/execution_events/FailureCause.h | 22 ---------------- .../work_unit_executor/WorkunitExecutor.cpp | 5 ++-- .../execution_events/FailureCause.cpp | 25 +------------------ .../BareMetalComputeServiceOneTaskTest.cpp | 21 +++++++++------- ...areMetalComputeServiceTestStandardJobs.cpp | 4 +-- 5 files changed, 18 insertions(+), 59 deletions(-) diff --git a/include/wrench/workflow/execution_events/FailureCause.h b/include/wrench/workflow/execution_events/FailureCause.h index 3ff8d41c39..b6e8ce83ce 100644 --- a/include/wrench/workflow/execution_events/FailureCause.h +++ b/include/wrench/workflow/execution_events/FailureCause.h @@ -60,28 +60,6 @@ namespace wrench { }; - /** - * @brief A "file cannot be found anywhere" failure cause - */ - class NoStorageServiceForFile : public FailureCause { - - public: - /***********************/ - /** \cond INTERNAL */ - /***********************/ - NoStorageServiceForFile(WorkflowFile *file); - /***********************/ - /** \endcond */ - /***********************/ - - WorkflowFile *getFile(); - std::string toString(); - - private: - WorkflowFile *file; - }; - - /** * @brief A "no scratch space" failure cause */ diff --git a/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp b/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp index afafcc3dcc..d32ff89ea7 100644 --- a/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp +++ b/src/wrench/services/compute/work_unit_executor/WorkunitExecutor.cpp @@ -327,8 +327,9 @@ namespace wrench { if (work->file_locations.find(f) != work->file_locations.end()) { files_to_read[f] = work->file_locations[f]; } else { - if (this->scratch_space == nullptr) { - WRENCH_INFO("DUCK!!"); + if (this->scratch_space == nullptr) { // File should be in scratch, but there is no scratch + throw WorkflowExecutionException( + std::make_shared(f, FileLocation::SCRATCH)); } files_to_read[f] = FileLocation::LOCATION(this->scratch_space, job->getName()); this->files_stored_in_scratch.insert(f); diff --git a/src/wrench/workflow/execution_events/FailureCause.cpp b/src/wrench/workflow/execution_events/FailureCause.cpp index 3d36269594..1dedc98c95 100644 --- a/src/wrench/workflow/execution_events/FailureCause.cpp +++ b/src/wrench/workflow/execution_events/FailureCause.cpp @@ -21,13 +21,6 @@ WRENCH_LOG_NEW_DEFAULT_CATEGORY(falure_cause, "Log category for FailureCause"); namespace wrench { - /** - * @brief Constructor - * @param file: the file that could not be found on any storage service - */ - NoStorageServiceForFile::NoStorageServiceForFile(WorkflowFile *file) { - this->file = file; - } /** * @brief Constructor @@ -42,24 +35,8 @@ namespace wrench { * @return the message */ std::string NoScratchSpace::toString() { - return error; - } - - /** - * @brief Getter - * @return the file - */ - WorkflowFile *NoStorageServiceForFile::getFile() { - return this->file; - } + return error;} - /** - * @brief Get the human-readable failure message - * @return the message - */ - std::string NoStorageServiceForFile::toString() { - return "No Storage Service location is specified for file " + this->file->getID(); - } /** * @brief Constructor diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp index 687672d4d9..a6b0ce3570 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp @@ -1266,10 +1266,12 @@ class ExecutionWithPrePostCopiesNoTaskNoCleanupTestWMS : public wrench::WMS { } // Test file locations - if (!this->test->storage_service2->lookupFile(this->test->input_file, nullptr)) { + if (not wrench::StorageService::lookupFile(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service2))) { throw std::runtime_error("Input file should be on Storage Service #2"); } - if (!this->test->storage_service3->lookupFile(this->test->input_file, nullptr)) { + if (not wrench::StorageService::lookupFile(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service3))) { throw std::runtime_error("Input file should be on Storage Service #3"); } @@ -1392,7 +1394,8 @@ class ExecutionWithPreNoPostCopiesNoTaskCleanupTestWMS : public wrench::WMS { } // Test file locations - if (this->test->storage_service2->lookupFile(this->test->input_file, nullptr)) { + if (wrench::StorageService::lookupFile(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service2))) { throw std::runtime_error("Input file should not be on Storage Service #2"); } @@ -1489,11 +1492,11 @@ class ExecutionWithMissingFileTestWMS : public wrench::WMS { // Create a job manager auto job_manager = this->createJobManager(); - // Remove the staged file! - wrench::StorageService::deleteFile(test->input_file, - wrench::FileLocation::LOCATION(test->storage_service1)); +// // Remove the staged file! +// wrench::StorageService::deleteFile(test->input_file, +// wrench::FileLocation::LOCATION(test->storage_service1)); - // Create a job + // Create a job (that doesn't say where the file should come from!) wrench::StandardJob *job = job_manager->createStandardJob({test->task}, {}, {}, @@ -1506,11 +1509,11 @@ class ExecutionWithMissingFileTestWMS : public wrench::WMS { std::shared_ptr event = this->getWorkflow()->waitForNextExecutionEvent(); auto real_event = std::dynamic_pointer_cast(event); if (real_event) { - auto cause = std::dynamic_pointer_cast(real_event->failure_cause); + auto cause = std::dynamic_pointer_cast(real_event->failure_cause); if (not cause) { throw std::runtime_error( "Got an Standard Job Failure as expected, but unexpected failure cause: " + - real_event->failure_cause->toString() + " (expected: NoStorageServiceForFile"); + real_event->failure_cause->toString() + " (expected: FileNotFound"); } std::string error_msg = cause->toString(); if (cause->getFile() != test->input_file) { diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp index 0061870095..8615cd0d1c 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp @@ -1530,10 +1530,10 @@ class BareMetalComputeServiceShutdownStorageServiceBeforeJobIsSubmittedTestWMS : } auto real_event = std::dynamic_pointer_cast(event); if (real_event) { - auto cause = std::dynamic_pointer_cast(real_event->failure_cause); + auto cause = std::dynamic_pointer_cast(real_event->failure_cause); if (not cause) { throw std::runtime_error("Got the expected job failure but unexpected failure cause: " + - real_event->failure_cause->toString() + " (expected: NoStorageServiceForFile)"); + real_event->failure_cause->toString() + " (expected: FileNotFound)"); } if (cause->getFile() != this->test->input_file) { throw std::runtime_error(