From 3fad4da24d414807f0d19bf649d45213553cbe87 Mon Sep 17 00:00:00 2001 From: henricasanova Date: Wed, 25 Sep 2019 16:32:44 -1000 Subject: [PATCH] tmp commit (#2) --- .../storage/storage_helpers/FileLocation.h | 1 - .../BareMetalComputeServiceOneTaskTest.cpp | 167 +++--- .../BareMetalComputeServiceSchedulingTest.cpp | 6 +- ...areMetalComputeServiceTestStandardJobs.cpp | 45 +- ...iceBatschedQueueWaitTimePredictionTest.cpp | 166 +++--- .../BatchService/BatchServiceTest.cpp | 263 ++++++---- .../StandardJobExecutorTest.cpp | 248 ++++----- .../compute_services/WorkunitExecutorTest.cpp | 490 +++++------------- .../SimpleStorageServiceFunctionalTest.cpp | 92 ++-- .../SimpleStorageServicePerformanceTest.cpp | 2 +- test/wms/WMSTest.cpp | 58 ++- 11 files changed, 741 insertions(+), 797 deletions(-) diff --git a/include/wrench/services/storage/storage_helpers/FileLocation.h b/include/wrench/services/storage/storage_helpers/FileLocation.h index 425c71e266..080f42766c 100644 --- a/include/wrench/services/storage/storage_helpers/FileLocation.h +++ b/include/wrench/services/storage/storage_helpers/FileLocation.h @@ -25,7 +25,6 @@ namespace wrench { public: - static std::shared_ptr LOCATION(std::shared_ptr ss); static std::shared_ptr LOCATION(std::shared_ptr ss, diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp index ec194f9ef7..d830273458 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp @@ -53,7 +53,7 @@ class BareMetalComputeServiceOneTaskTest : public ::testing::Test { void do_ExecutionWithNotEnoughRAM_test(); void do_ExecutionWithDownService_test(); - + void do_ExecutionWithSuspendedService_test(); @@ -79,9 +79,35 @@ class BareMetalComputeServiceOneTaskTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -322,13 +348,14 @@ void BareMetalComputeServiceOneTaskTest::do_Noop_test() { ASSERT_THROW(simulation->launch(), std::runtime_error); ASSERT_NO_THROW(compute_service = simulation->add( new wrench::BareMetalComputeService(hostname, - {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + {"/scratch"}, {}))); // Create a Storage Service ASSERT_THROW(simulation->launch(), std::runtime_error); ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a WMS ASSERT_THROW(simulation->launch(), std::runtime_error); @@ -344,15 +371,15 @@ void BareMetalComputeServiceOneTaskTest::do_Noop_test() { // Without a file registry service this should fail ASSERT_THROW(simulation->launch(), std::runtime_error); - ASSERT_THROW(simulation->stageFiles({{input_file->getID(),input_file}}, storage_service1), std::runtime_error); + ASSERT_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1)), std::runtime_error); simulation->add(new wrench::FileRegistryService(hostname)); - ASSERT_THROW(simulation->stageFiles({{input_file->getID(), input_file}}, nullptr), std::invalid_argument); - ASSERT_THROW(simulation->stageFiles({{"foo", nullptr}}, storage_service1), std::invalid_argument); + ASSERT_THROW(simulation->stageFile(input_file, nullptr), std::invalid_argument); + ASSERT_THROW(simulation->stageFile(nullptr, wrench::FileLocation::LOCATION(storage_service1)), std::invalid_argument); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}}, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "do nothing" simulation ASSERT_NO_THROW(simulation->launch()); @@ -398,8 +425,8 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptr task (and no file copies) try { job = job_manager->createStandardJob(nullptr, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); throw std::runtime_error("Should not be able to create a job with an empty task"); } catch (std::invalid_argument &e) { } @@ -407,8 +434,8 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with an empty vector of tasks (and no file copies) try { job = job_manager->createStandardJob({}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); throw std::runtime_error("Should not be able to create a job with an empty task vector"); } catch (std::invalid_argument &e) { } @@ -416,8 +443,8 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with a vector of empty tasks (and no file copies) try { job = job_manager->createStandardJob({nullptr, nullptr}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); throw std::runtime_error("Should not be able to create a job with a vector of empty tasks"); } catch (std::invalid_argument &e) { } @@ -429,8 +456,8 @@ class StandardJobConstructorTestWMS : public wrench::WMS { try { job = job_manager->createStandardJob({test->task, task_big}, - {{nullptr, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{nullptr, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); throw std::runtime_error("Should not be able to create a job with an nullptr file in file locations"); } catch (std::invalid_argument &e) { } @@ -439,7 +466,7 @@ class StandardJobConstructorTestWMS : public wrench::WMS { try { job = job_manager->createStandardJob({test->task, task_big}, {{test->input_file, nullptr}, - {test->output_file, test->storage_service1}}); + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); throw std::runtime_error("Should not be able to create a job with an nullptr storage service in file locations"); } catch (std::invalid_argument &e) { } @@ -447,10 +474,9 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in pre file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, - {std::make_tuple(nullptr, test->storage_service1, test->storage_service2) - }, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, + {std::make_tuple(nullptr, wrench::FileLocation::LOCATION((test->storage_service1)), wrench::FileLocation::LOCATION(test->storage_service2))}, {}, {} ); @@ -461,10 +487,9 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in pre file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, - {std::make_tuple(test->output_file, nullptr, test->storage_service2) - }, + {{test->input_file, wrench::FileLocation::LOCATION(test->storage_service1)}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, + {std::make_tuple(test->output_file, nullptr, wrench::FileLocation::LOCATION(test->storage_service2))}, {}, {} ); @@ -475,9 +500,9 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in pre file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, - {std::make_tuple(test->output_file, test->storage_service1, nullptr)}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, + {std::make_tuple(test->output_file, wrench::FileLocation::LOCATION((test->storage_service1)), nullptr)}, {}, {} ); @@ -488,10 +513,10 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in post file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, {}, - {std::make_tuple(nullptr, test->storage_service1, test->storage_service2)}, + {std::make_tuple(nullptr, wrench::FileLocation::LOCATION(test->storage_service1), wrench::FileLocation::LOCATION(test->storage_service2))}, {} ); throw std::runtime_error("Should not be able to create a job with a nullptr file in post file copies"); @@ -501,10 +526,10 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in post file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, {}, - {std::make_tuple(test->output_file, nullptr, test->storage_service2)}, + {std::make_tuple(test->output_file, nullptr, wrench::FileLocation::LOCATION(test->storage_service2))}, {} ); throw std::runtime_error("Should not be able to create a job with a nullptr src storage service in post file copies"); @@ -514,10 +539,10 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in post file copies try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, {}, - {std::make_tuple(test->output_file, test->storage_service1, nullptr) + {std::make_tuple(test->output_file, wrench::FileLocation::LOCATION((test->storage_service1)), nullptr) }, {} ); @@ -528,11 +553,11 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in post file deletions try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, {}, {}, - {std::make_tuple(nullptr, test->storage_service1)} + {std::make_tuple(nullptr, wrench::FileLocation::LOCATION((test->storage_service1)))} ); throw std::runtime_error("Should not be able to create a job with a nullptr file in file deletions"); } catch (std::invalid_argument &e) { @@ -542,8 +567,8 @@ class StandardJobConstructorTestWMS : public wrench::WMS { // Create a job with nullptrs in post file deletions try { job = job_manager->createStandardJob({test->task}, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}, + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}, {}, {}, {std::make_tuple(test->input_file, nullptr)} @@ -750,8 +775,8 @@ class ExecutionWithLocationMapTestWMS : public wrench::WMS { // Create a job auto job = job_manager->createStandardJob(test->task, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION((test->storage_service1))}, + {test->output_file, wrench::FileLocation::LOCATION((test->storage_service1))}}); // Get the job type as a string std::string job_type_as_string = job->getTypeAsString(); @@ -1019,11 +1044,11 @@ class ExecutionWithPrePostCopiesAndCleanupTestWMS : public wrench::WMS { // Create a job wrench::StandardJob *job = job_manager->createStandardJob({test->task}, - {{test->input_file,test->storage_service1},{test->output_file,test->storage_service2}}, //changed this since we don't have default storage now - {std::make_tuple(test->input_file, test->storage_service1, test->storage_service2)}, - {std::make_tuple(test->output_file, test->storage_service2, test->storage_service1)}, - {std::make_tuple(test->input_file, test->storage_service2), - std::make_tuple(test->output_file, test->storage_service2)}); + {{test->input_file,wrench::FileLocation::LOCATION((test->storage_service1))},{test->output_file,wrench::FileLocation::LOCATION(test->storage_service2)}}, //changed this since we don't have default storage now + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION((test->storage_service1)), wrench::FileLocation::LOCATION(test->storage_service2))}, + {std::make_tuple(test->output_file, wrench::FileLocation::LOCATION(test->storage_service2), wrench::FileLocation::LOCATION((test->storage_service1)))}, + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION(test->storage_service2)), + std::make_tuple(test->output_file, wrench::FileLocation::LOCATION(test->storage_service2))}); // Submit the job job_manager->submitJob(job, test->compute_service); @@ -1144,9 +1169,9 @@ class ExecutionWithPrePostCopiesNoTaskNoCleanupTestWMS : public wrench::WMS { public: ExecutionWithPrePostCopiesNoTaskNoCleanupTestWMS(BareMetalComputeServiceOneTaskTest *test, - const std::set> &compute_services, - const std::set> &storage_services, - std::string &hostname) : + const std::set> &compute_services, + const std::set> &storage_services, + std::string &hostname) : wrench::WMS(nullptr, nullptr, compute_services, storage_services, {}, nullptr, hostname, "test") { this->test = test; } @@ -1164,8 +1189,8 @@ class ExecutionWithPrePostCopiesNoTaskNoCleanupTestWMS : public wrench::WMS { // Create a job wrench::StandardJob *job = job_manager->createStandardJob({}, {}, //changed this since we don't have default storage now - {std::make_tuple(test->input_file, test->storage_service1, test->storage_service2)}, - {std::make_tuple(test->input_file, test->storage_service2, test->storage_service3)}, + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION(test->storage_service1), wrench::FileLocation::LOCATION(test->storage_service2))}, + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION(test->storage_service2), test->storage_service3)}, {}); // Submit the job job_manager->submitJob(job, test->compute_service); @@ -1240,9 +1265,9 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesNoTaskNoCl std::shared_ptr wms = nullptr;; ASSERT_NO_THROW(wms = simulation->add( new ExecutionWithPrePostCopiesNoTaskNoCleanupTestWMS(this, - { compute_service }, { - storage_service1, storage_service2 - }, hostname))); + { compute_service }, { + storage_service1, storage_service2 + }, hostname))); ASSERT_NO_THROW(wms->addWorkflow(workflow)); @@ -1290,9 +1315,9 @@ class ExecutionWithPreNoPostCopiesNoTaskCleanupTestWMS : public wrench::WMS { // Create a job wrench::StandardJob *job = job_manager->createStandardJob({}, {}, //changed this since we don't have default storage now - {std::make_tuple(test->input_file, test->storage_service1, test->storage_service2)}, + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION(test->storage_service1), wrench::FileLocation::LOCATION(test->storage_service2))}, {}, - {std::make_tuple(test->input_file, test->storage_service2)}); + {std::make_tuple(test->input_file, wrench::FileLocation::LOCATION(test->storage_service2))}); // Submit the job job_manager->submitJob(job, test->compute_service); @@ -1359,9 +1384,9 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPreNoPostCopiesNoTaskCl std::shared_ptr wms = nullptr;; ASSERT_NO_THROW(wms = simulation->add( new ExecutionWithPreNoPostCopiesNoTaskCleanupTestWMS(this, - { compute_service }, { - storage_service1, storage_service2 - }, hostname))); + { compute_service }, { + storage_service1, storage_service2 + }, hostname))); ASSERT_NO_THROW(wms->addWorkflow(workflow)); @@ -1406,7 +1431,7 @@ class ExecutionWithMissingFileTestWMS : public wrench::WMS { auto job_manager = this->createJobManager(); // Remove the staged file! - this->test->storage_service1->deleteFile(test->input_file); + this->wrench::FileLocation::LOCATION(test->storage_service1)->deleteFile(test->input_file); // Create a job wrench::StandardJob *job = job_manager->createStandardJob({test->task}, @@ -1781,8 +1806,8 @@ class ExecutionWithDownServiceTestWMS : public wrench::WMS { // Create a job job = job_manager->createStandardJob(test->task, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION(test->storage_service1)}, + {test->output_file, wrench::FileLocation::LOCATION(test->storage_service1)}}); // Submit the job try { @@ -1872,9 +1897,9 @@ class ExecutionWithSuspendedServiceTestWMS : public wrench::WMS { public: ExecutionWithSuspendedServiceTestWMS(BareMetalComputeServiceOneTaskTest *test, - const std::set> &compute_services, - const std::set> &storage_services, - std::string &hostname) : + const std::set> &compute_services, + const std::set> &storage_services, + std::string &hostname) : wrench::WMS(nullptr, nullptr, compute_services, storage_services, {}, nullptr, hostname, "test") { this->test = test; } @@ -1896,8 +1921,8 @@ class ExecutionWithSuspendedServiceTestWMS : public wrench::WMS { // Create a job job = job_manager->createStandardJob(test->task, - {{test->input_file, test->storage_service1}, - {test->output_file, test->storage_service1}}); + {{test->input_file, wrench::FileLocation::LOCATION(test->storage_service1)}, + {test->output_file, wrench::FileLocation::LOCATION(test->storage_service1)}}); // Submit the job try { diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceSchedulingTest.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceSchedulingTest.cpp index c95641f553..7f73d4d29f 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceSchedulingTest.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceSchedulingTest.cpp @@ -215,7 +215,7 @@ void BareMetalComputeServiceTestScheduling::do_RAMPressure_test() { // Create a Compute Service ASSERT_NO_THROW(cs = simulation->add( new wrench::BareMetalComputeService("Host1", - (std::set){"Host1", "Host2"}, 0.0, + (std::set){"Host1", "Host2"}, {}, {}, {}))); std::set> compute_services; compute_services.insert(cs); @@ -349,7 +349,7 @@ void BareMetalComputeServiceTestScheduling::do_LoadBalancing1_test() { // Create a Compute Service ASSERT_NO_THROW(cs = simulation->add( new wrench::BareMetalComputeService("Host1", - (std::set){"Host1", "Host2"}, 0.0, + (std::set){"Host1", "Host2"}, "", {}, {}))); std::set> compute_services; compute_services.insert(cs); @@ -483,7 +483,7 @@ void BareMetalComputeServiceTestScheduling::do_LoadBalancing2_test() { // Create a Compute Service ASSERT_NO_THROW(cs = simulation->add( new wrench::BareMetalComputeService("Host1", - (std::set){"Host1", "Host3"}, 0.0, + (std::set){"Host1", "Host3"}, "", {}, {}))); std::set> compute_services; compute_services.insert(cs); diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp index 9255962df0..bb9b16a6e3 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp @@ -120,7 +120,7 @@ class BareMetalComputeServiceTestStandardJobs : public ::testing::Test { " " " " " " - " " + " " " " " " " " @@ -130,7 +130,7 @@ class BareMetalComputeServiceTestStandardJobs : public ::testing::Test { " " " " " " - " " + " " " " " " " " @@ -291,7 +291,9 @@ class MulticoreComputeServiceBogusNumCoresTestWMS : public wrench::WMS { // Create a 1-task job auto two_core_task_job = job_manager->createStandardJob({this->test->task3}, {}, - {std::make_tuple(this->test->input_file, this->test->storage_service, wrench::ComputeService::SCRATCH)}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(this->test->compute_service->getScratch()))}, {}, {}); // Submit the 1-task job for execution with too few cores @@ -333,7 +335,7 @@ void BareMetalComputeServiceTestStandardJobs::do_BogusNumCores_test() { ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); // Get a hostname - std::string hostname = simulation->getHostnameList()[0]; + std::string hostname = "DualCoreHost"; // Create A Storage Services ASSERT_NO_THROW(storage_service = simulation->add( @@ -342,8 +344,8 @@ void BareMetalComputeServiceTestStandardJobs::do_BogusNumCores_test() { // Create a Compute Service ASSERT_NO_THROW(compute_service = simulation->add( new wrench::BareMetalComputeService(hostname, - {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, 101.0, - {}))); //scratch space of size 101 + {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + {"/scratch"}, {}))); //scratch space of size 101 // Create a WMS std::shared_ptr wms = nullptr; @@ -400,9 +402,12 @@ class MulticoreComputeServiceTwoSingleCoreTasksTestWMS : public wrench::WMS { auto file_registry_service = this->getAvailableFileRegistryService(); // Create a 2-task job - wrench::StandardJob *two_task_job = job_manager->createStandardJob({this->test->task1, this->test->task2}, {}, - {std::make_tuple(this->test->input_file, this->test->storage_service, wrench::ComputeService::SCRATCH)}, - {}, {}); + wrench::StandardJob *two_task_job = job_manager->createStandardJob( + {this->test->task1, this->test->task2}, {}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(this->test->compute_service->getScratch()))}, + {}, {}); // Submit the 2-task job for execution job_manager->submitJob(two_task_job, this->test->compute_service); @@ -463,9 +468,11 @@ void BareMetalComputeServiceTestStandardJobs::do_TwoSingleCoreTasks_test() { // Create a Compute Service ASSERT_NO_THROW(compute_service = simulation->add( - new wrench::BareMetalComputeService(hostname, - {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, 101.0, - {}))); //scratch space of size 101 + new wrench::BareMetalComputeService( + hostname, + {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + {"/scratch"}, + {}))); //scratch space of size 101 // Create a WMS std::shared_ptr wms = nullptr; @@ -480,7 +487,7 @@ void BareMetalComputeServiceTestStandardJobs::do_TwoSingleCoreTasks_test() { // Staging the input file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}}, storage_service)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -521,7 +528,9 @@ class MulticoreComputeServiceTwoDualCoreTasksCase1TestWMS : public wrench::WMS { // Create a 2-task job wrench::StandardJob *two_task_job = job_manager->createStandardJob({this->test->task3, this->test->task4}, {}, - {std::make_tuple(this->test->input_file, this->test->storage_service, wrench::ComputeService::SCRATCH)}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(this->test->compute_service->getScratch()))}, {}, {}); // Submit the 2-task job for execution @@ -587,7 +596,7 @@ void BareMetalComputeServiceTestStandardJobs::do_TwoDualCoreTasksCase1_test() { ASSERT_NO_THROW(compute_service = simulation->add( new wrench::BareMetalComputeService(hostname, {std::make_pair("DualCoreHost", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, - 100.0, {}))); + {"/scratch"}, {}))); // Create a WMS std::shared_ptr wms; @@ -601,7 +610,7 @@ void BareMetalComputeServiceTestStandardJobs::do_TwoDualCoreTasksCase1_test() { simulation->add(new wrench::FileRegistryService(hostname)); // Staging the input file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}}, storage_service)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -643,7 +652,9 @@ class MulticoreComputeServiceTwoDualCoreTasksCase2TestWMS : public wrench::WMS { // Create a 2-task job wrench::StandardJob *two_task_job = job_manager->createStandardJob({this->test->task5, this->test->task6}, {}, - {std::make_tuple(this->test->input_file, this->test->storage_service, wrench::ComputeService::SCRATCH)}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(this->test->compute_service->getScratch())}, {}, {}); // Submit the 2-task job for execution diff --git a/test/compute_services/BatchService/BatchServiceBatschedQueueWaitTimePredictionTest.cpp b/test/compute_services/BatchService/BatchServiceBatschedQueueWaitTimePredictionTest.cpp index ca6d7f7216..7802a0ee33 100644 --- a/test/compute_services/BatchService/BatchServiceBatschedQueueWaitTimePredictionTest.cpp +++ b/test/compute_services/BatchService/BatchServiceBatschedQueueWaitTimePredictionTest.cpp @@ -51,10 +51,46 @@ class BatchServiceBatschedQueueWaitTimePredictionTest : public ::testing::Test { "" " " " " - " " - " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -113,15 +149,15 @@ class BatchJobBrokenEstimateWaitingTimeTestWMS : public wrench::WMS { auto job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -211,11 +247,11 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobBrokenEstimateW // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_THROW(compute_service = simulation->add( @@ -246,7 +282,7 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobBrokenEstimateW wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -298,15 +334,15 @@ class BatchJobBasicEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -391,11 +427,11 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobBasicEstimateWa // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -418,7 +454,7 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobBasicEstimateWa wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -471,15 +507,15 @@ class BatchJobEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -536,15 +572,15 @@ class BatchJobEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -617,11 +653,11 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobEstimateWaiting // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -645,7 +681,7 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobEstimateWaiting ASSERT_NO_THROW(wms->addWorkflow(std::move(workflow.get()))); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -697,15 +733,15 @@ class BatchJobLittleComplexEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; @@ -732,15 +768,15 @@ class BatchJobLittleComplexEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job1 = job_manager->createStandardJob( {task1}, { - {*(task1->getInputFiles().begin()), this->test->storage_service1}, - {*(task1->getOutputFiles().begin()), this->test->storage_service1} + {*(task1->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task1->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args1; batch_job_args1["-N"] = "2"; @@ -764,15 +800,15 @@ class BatchJobLittleComplexEstimateWaitingTimeTestWMS : public wrench::WMS { wrench::StandardJob *job2 = job_manager->createStandardJob( {task2}, { - {*(task2->getInputFiles().begin()), this->test->storage_service1}, - {*(task2->getOutputFiles().begin()), this->test->storage_service1} + {*(task2->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task2->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args2; batch_job_args2["-N"] = "4"; @@ -889,11 +925,11 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobLittleComplexEs // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -920,7 +956,7 @@ void BatchServiceBatschedQueueWaitTimePredictionTest::do_BatchJobLittleComplexEs this->workflow->addFile("output_file3", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would diff --git a/test/compute_services/BatchService/BatchServiceTest.cpp b/test/compute_services/BatchService/BatchServiceTest.cpp index 069a4e0e19..65c0294f0f 100644 --- a/test/compute_services/BatchService/BatchServiceTest.cpp +++ b/test/compute_services/BatchService/BatchServiceTest.cpp @@ -62,13 +62,75 @@ class BatchServiceTest : public ::testing::Test { "" " " " " - " " - " " - " " - " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -221,14 +283,16 @@ class TerminateOneStandardJobSubmissionTestWMS : public wrench::WMS { job1 = job_manager->createStandardJob( {task1}, { - {*(task1->getInputFiles().begin()), this->test->storage_service1} + {*(task1->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -255,14 +319,17 @@ class TerminateOneStandardJobSubmissionTestWMS : public wrench::WMS { job2 = job_manager->createStandardJob( {task2}, { - {*(task2->getInputFiles().begin()), this->test->storage_service1}, + {*(task2->getInputFiles().begin()), + wrench::FileLocation::LOCATION(this->test->storage_service1)}, }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "4"; @@ -329,11 +396,11 @@ void BatchServiceTest::do_TerminateStandardJobsTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service @@ -357,7 +424,7 @@ void BatchServiceTest::do_TerminateStandardJobsTest_test() { wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -406,15 +473,17 @@ class OneStandardJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)}); + {std::tuple>( + this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map batch_job_args; batch_job_args["-N"] = "2"; @@ -446,7 +515,7 @@ class OneStandardJobSubmissionTestWMS : public wrench::WMS { } catch (wrench::WorkflowExecutionException &e) { WRENCH_INFO("---> %s", e.getCause()->toString().c_str()); if (not std::dynamic_pointer_cast(e.getCause())) { - throw std::runtime_error("Got an expected exception, but the failure cause is not NotAllowed"); + throw std::runtime_error("Got an expected exception, but the failure cause is not NotAllowed"); } } @@ -488,18 +557,18 @@ void BatchServiceTest::do_OneStandardJobTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( new wrench::BatchComputeService(hostname, {"Host1", "Host2", "Host3", "Host4"}, 0, {{wrench::BatchComputeServiceProperty::BATSCHED_LOGGING_MUTED, "false"}} - ))); + ))); simulation->add(new wrench::FileRegistryService(hostname)); @@ -513,11 +582,11 @@ void BatchServiceTest::do_OneStandardJobTaskTest_test() { // Create two workflow files - wrench::WorkflowFile *input_file = this->workflow->addFile("input_file", 10000.0); - wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); + auto input_file = this->workflow->addFile("input_file", 10000.0); + auto output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -675,11 +744,11 @@ void BatchServiceTest::do_TwoStandardJobSubmissionTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -701,7 +770,7 @@ void BatchServiceTest::do_TwoStandardJobSubmissionTest_test() { auto output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -845,11 +914,11 @@ void BatchServiceTest::do_PilotJobTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -875,7 +944,7 @@ void BatchServiceTest::do_PilotJobTaskTest_test() { wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -929,7 +998,7 @@ class StandardPlusPilotJobSubmissionTestWMS : public wrench::WMS { {*(task->getOutputFiles().begin()), this->test->storage_service1} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -1024,11 +1093,11 @@ void BatchServiceTest::do_StandardPlusPilotJobTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1101,11 +1170,11 @@ class InsufficientCoresJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -1156,11 +1225,11 @@ void BatchServiceTest::do_InsufficientCoresTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1233,11 +1302,11 @@ class NoArgumentsJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -1280,11 +1349,11 @@ void BatchServiceTest::do_noArgumentsJobSubmissionTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1358,11 +1427,11 @@ class StandardJobTimeoutSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -1431,11 +1500,11 @@ void BatchServiceTest::do_StandardJobTimeOutTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1562,11 +1631,11 @@ void BatchServiceTest::do_PilotJobTimeOutTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1647,11 +1716,11 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -1672,11 +1741,11 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job1 = job_manager->createStandardJob( {task1}, { - {*(task1->getInputFiles().begin()), this->test->storage_service1}, - {*(task1->getOutputFiles().begin()), this->test->storage_service1} + {*(task1->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task1->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file_1"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file_1"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file_1"), @@ -1697,11 +1766,11 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job2 = job_manager->createStandardJob( {task2}, { - {*(task2->getInputFiles().begin()), this->test->storage_service1}, - {*(task2->getOutputFiles().begin()), this->test->storage_service1} + {*(task2->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task2->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file_2"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file_2"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file_2"), @@ -1778,11 +1847,11 @@ void BatchServiceTest::do_BestFitTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -1942,11 +2011,11 @@ void BatchServiceTest::do_FirstFitTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2214,11 +2283,11 @@ void BatchServiceTest::do_RoundRobinTask_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2324,7 +2393,7 @@ class StandardJobInsidePilotJobTimeoutSubmissionTestWMS : public wrench::WMS { // Create a StandardJob with some pre-copies and post-deletions wrench::StandardJob *job = job_manager->createStandardJob( - {task}, {{file1,this->test->storage_service1}}, {}, {}, {}); + {task}, {{file1,wrench::FileLocation::LOCATION(this->test->storage_service1)}}, {}, {}, {}); try { job_manager->submitJob(job, pilot_job->getComputeService(), {}); @@ -2397,11 +2466,11 @@ void BatchServiceTest::do_StandardJobInsidePilotJobTimeOutTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2492,18 +2561,18 @@ class StandardJobInsidePilotJobSucessSubmissionTestWMS : public wrench::WMS { throw std::runtime_error("Error while getting and execution event: " + e.getCause()->toString()); } if (not std::dynamic_pointer_cast(event)) { - throw std::runtime_error("Unexpected workflow execution event: " + event->toString()); + throw std::runtime_error("Unexpected workflow execution event: " + event->toString()); } // Create a StandardJob with some pre-copies and post-deletions wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -2558,11 +2627,11 @@ void BatchServiceTest::do_StandardJobInsidePilotJobSucessTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2663,11 +2732,11 @@ class InsufficientCoresInsidePilotJobSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -2710,11 +2779,11 @@ void BatchServiceTest::do_InsufficientCoresInsidePilotJobTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2852,11 +2921,11 @@ void BatchServiceTest::do_MultipleStandardTaskTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -2929,11 +2998,11 @@ class DifferentBatchAlgorithmsSubmissionTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), this->test->storage_service2)}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), @@ -2998,11 +3067,11 @@ void BatchServiceTest::do_DifferentBatchAlgorithmsSubmissionTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a Batch Service ASSERT_NO_THROW(compute_service = simulation->add( diff --git a/test/compute_services/StandardJobExecutorTest.cpp b/test/compute_services/StandardJobExecutorTest.cpp index fcb2207e82..a804017730 100644 --- a/test/compute_services/StandardJobExecutorTest.cpp +++ b/test/compute_services/StandardJobExecutorTest.cpp @@ -138,15 +138,15 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { auto job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service2} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("output_file"), this->test->storage_service2, - this->test->storage_service1)}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -299,15 +299,15 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { job = job_manager->createStandardJob( {task_too_many_cores}, { - {*(task_too_many_cores->getInputFiles().begin()), this->test->storage_service1}, - {*(task_too_many_cores->getOutputFiles().begin()), this->test->storage_service2} + {*(task_too_many_cores->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task_too_many_cores->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("output_file"), this->test->storage_service2, - this->test->storage_service1)}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -343,15 +343,15 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { job = job_manager->createStandardJob( {task_too_much_ram}, { - {*(task_too_much_ram->getInputFiles().begin()), this->test->storage_service1}, - {*(task_too_much_ram->getOutputFiles().begin()), this->test->storage_service2} + {*(task_too_much_ram->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task_too_much_ram->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("output_file"), this->test->storage_service2, - this->test->storage_service1)}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -385,15 +385,15 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service2} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("output_file"), this->test->storage_service2, - this->test->storage_service1)}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -536,15 +536,15 @@ class OneSingleCoreTaskTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service2} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("output_file"), this->test->storage_service2, - this->test->storage_service1)}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -734,15 +734,15 @@ class OneSingleCoreTaskBogusPreFileCopyTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service2} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service2, - this->test->storage_service1)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -915,13 +915,13 @@ class OneSingleCoreTaskMissingFileTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task}, { - {*(task->getInputFiles().begin()), this->test->storage_service2}, - {*(task->getOutputFiles().begin()), this->test->storage_service2} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service2)} }, {}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - this->test->storage_service2)}); + {std::tuple>(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); job->getFileLocations(); // coverage job->getPriority(); // coverage @@ -976,7 +976,7 @@ class OneSingleCoreTaskMissingFileTestWMS : public wrench::WMS { throw std::runtime_error( "Got the expected 'file not found' exception, but the failure cause does not point to the correct file"); } - if (cause->getStorageService() != this->test->storage_service2) { + if (cause->getStorageService() != wrench::FileLocation::LOCATION(this->test->storage_service2)) { throw std::runtime_error( "Got the expected 'file not found' exception, but the failure cause does not point to the correct storage service"); } @@ -1280,8 +1280,8 @@ class OneMultiCoreTaskTestWMSCase1 : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( task, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }); std::string my_mailbox = "test_callback_mailbox"; @@ -1431,8 +1431,8 @@ class OneMultiCoreTaskTestWMSCase2 : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( task, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }); std::string my_mailbox = "test_callback_mailbox"; @@ -1587,8 +1587,8 @@ class OneMultiCoreTaskTestWMSCase3 : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( task, { - {*(task->getInputFiles().begin()), this->test->storage_service1}, - {*(task->getOutputFiles().begin()), this->test->storage_service1} + {*(task->getInputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {*(task->getOutputFiles().begin()), wrench::FileLocation::LOCATION(this->test->storage_service1)} }); std::string my_mailbox = "test_callback_mailbox"; @@ -1747,15 +1747,15 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -1834,15 +1834,15 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -1922,15 +1922,15 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2, task3}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2111,15 +2111,15 @@ class MultiHostTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2199,15 +2199,15 @@ class MultiHostTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2, task3, task4}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2390,16 +2390,16 @@ class JobTerminationTestDuringAComputationWMS : public wrench::WMS { {task1, task2, task3, task4}, // {task1}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file1"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file2"), this->test->storage_service1}, + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file1"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file2"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2545,16 +2545,16 @@ class JobTerminationTestDuringATransferWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {task1, task2, task3, task4}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file1"), this->test->storage_service1}, - {this->getWorkflow()->getFileByID("output_file2"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file1"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, + {this->getWorkflow()->getFileByID("output_file2"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2712,21 +2712,21 @@ class JobTerminationTestAtRandomTimesWMS : public wrench::WMS { {task1, task3}, // {task1}, { - {this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1}, -// {workflow->getFileByID("output_file"), this->test->storage_service1} + {this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)}, +// {workflow->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, { - std::make_tuple(this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2) -// std::tuple, std::shared_ptr>( -// workflow->getFileByID("input_file"), this->test->storage_service1, -// this->test->storage_service2) + std::make_tuple(this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2)) +// std::tuple, std::shared_ptr>( +// workflow->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), +// wrench::FileLocation::LOCATION(this->test->storage_service2)) }, {}, { - std::tuple>( + std::tuple>( this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2) + wrench::FileLocation::LOCATION(this->test->storage_service2)) } ); @@ -2857,17 +2857,17 @@ void StandardJobExecutorTest::do_WorkUnit_test() { // Create two WorkUnits std::shared_ptr wu1 = std::make_shared(nullptr, - (std::set, std::shared_ptr>>){}, + (std::set, std::shared_ptr>>){}, nullptr, (std::map>){}, - (std::set, std::shared_ptr>>){}, - (std::set>>){}); + (std::set, std::shared_ptr>>){}, + (std::set>>){}); std::shared_ptr wu2 = std::make_shared(nullptr, - (std::set, std::shared_ptr>>){}, + (std::set, std::shared_ptr>>){}, nullptr, (std::map>){}, - (std::set, std::shared_ptr>>){}, - (std::set>>){}); + (std::set, std::shared_ptr>>){}, + (std::set>>){}); ASSERT_THROW(wrench::Workunit::addDependency(wu1, nullptr), std::invalid_argument); @@ -2917,12 +2917,12 @@ class NoTaskTestWMS : public wrench::WMS { wrench::StandardJob *job = job_manager->createStandardJob( {}, {}, - {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), this->test->storage_service1, - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - this->test->storage_service2)} + {std::tuple>(this->getWorkflow()->getFileByID("input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; diff --git a/test/compute_services/WorkunitExecutorTest.cpp b/test/compute_services/WorkunitExecutorTest.cpp index 110365239a..49fc008668 100644 --- a/test/compute_services/WorkunitExecutorTest.cpp +++ b/test/compute_services/WorkunitExecutorTest.cpp @@ -35,7 +35,6 @@ class WorkunitExecutorTest : public ::testing::Test { void do_WorkunitConstructor_test(); void do_WorkunitExecutorConstructor_test(); - void do_WorkunitExecutorBadScratchSpace_test(); protected: @@ -48,10 +47,46 @@ class WorkunitExecutorTest : public ::testing::Test { "" " " " " - " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -101,11 +136,11 @@ void WorkunitExecutorTest::do_WorkunitConstructor_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create another Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create workflow filess wrench::WorkflowFile *input_file = this->workflow->addFile("input_file", 10000000.0); @@ -115,149 +150,149 @@ void WorkunitExecutorTest::do_WorkunitConstructor_test() { auto task = this->workflow->addTask("task", 1.0, 1, 1, 1.0, 1.0); { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_NO_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions)); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(nullptr, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(nullptr, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, nullptr, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, nullptr, wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, nullptr)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), nullptr)); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); file_locations[input_file] = nullptr; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(nullptr, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(nullptr, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, nullptr, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, nullptr, wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, nullptr)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), nullptr)); + cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(nullptr, this->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(nullptr, wrench::FileLocation::LOCATION(this->storage_service2))); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, pre_file_copies, task, file_locations, post_file_copies, cleanup_file_deletions), std::invalid_argument); } { - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; - - pre_file_copies.insert(std::make_tuple(input_file, this->storage_service1, this->storage_service2)); - file_locations[input_file] = this->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->storage_service2, this->storage_service1)); + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; + + pre_file_copies.insert(std::make_tuple(input_file, wrench::FileLocation::LOCATION(this->storage_service1), wrench::FileLocation::LOCATION(this->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, wrench::FileLocation::LOCATION(this->storage_service2), wrench::FileLocation::LOCATION(this->storage_service1))); cleanup_file_deletions.insert(std::make_tuple(input_file, nullptr)); ASSERT_THROW(new wrench::Workunit((wrench::StandardJob *)666, @@ -310,15 +345,20 @@ class WorkunitExecutorConstructorTestWMS : public wrench::WMS { {}); - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; + std::set, std::shared_ptr>> pre_file_copies; + std::map> file_locations; + std::set, std::shared_ptr >> post_file_copies; + std::set >> cleanup_file_deletions; - pre_file_copies.insert(std::make_tuple(input_file, this->test->storage_service1, this->test->storage_service2)); - file_locations[input_file] = this->test->storage_service2; - post_file_copies.insert(std::make_tuple(output_file, this->test->storage_service2, this->test->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->test->storage_service2)); + pre_file_copies.insert(std::make_tuple(input_file, + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))); + file_locations[input_file] = wrench::FileLocation::LOCATION(this->test->storage_service2); + post_file_copies.insert(std::make_tuple(output_file, + wrench::FileLocation::LOCATION(this->test->storage_service2), + wrench::FileLocation::LOCATION(this->test->storage_service1))); + cleanup_file_deletions.insert(std::make_tuple(input_file, + wrench::FileLocation::LOCATION(this->test->storage_service2))); auto wu = std::shared_ptr(new wrench::Workunit( job, @@ -388,11 +428,11 @@ void WorkunitExecutorTest::do_WorkunitExecutorConstructor_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create another Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/large_disk"}))); // Create a WMS std::shared_ptr wms = nullptr; @@ -409,7 +449,7 @@ void WorkunitExecutorTest::do_WorkunitExecutorConstructor_test() { wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation // Note that in these tests the WMS creates workflow tasks, which a user would @@ -424,264 +464,6 @@ void WorkunitExecutorTest::do_WorkunitExecutorConstructor_test() { -/**********************************************************************/ -/** BAD SCRATCH TEST **/ -/**********************************************************************/ - -class WorkunitExecutorBadScratchSpaceTestWMS : public wrench::WMS { - -public: - WorkunitExecutorBadScratchSpaceTestWMS(WorkunitExecutorTest *test, - const std::set> &compute_services, - const std::set> &storage_services, - std::string hostname) : - wrench::WMS(nullptr, nullptr, compute_services, storage_services, {}, nullptr, hostname, "test") { - this->test = test; - } - - -private: - - WorkunitExecutorTest *test; - - int main() { - auto input_file = this->getWorkflow()->getFileByID("input_file"); - auto output_file = this->getWorkflow()->getFileByID("output_file"); - - // Create a job manager - auto job_manager = this->createJobManager(); - - // Create some standard job - auto task = this->getWorkflow()->addTask("task", 3600, 1, 1, 1.0, 0); - task->addInputFile(input_file); - task->addOutputFile(output_file); - auto job = job_manager->createStandardJob( - {task}, - {}, - {}, - {}, - {}); - - std::set, std::shared_ptr>> pre_file_copies; - std::map> file_locations; - std::set, std::shared_ptr >> post_file_copies; - std::set >> cleanup_file_deletions; - - /** BOGUS PRE **/ - { - pre_file_copies.insert( - std::make_tuple(input_file, this->test->storage_service1, wrench::ComputeService::SCRATCH)); - file_locations[input_file] = this->test->storage_service2; - file_locations[output_file] = this->test->storage_service2; - post_file_copies.insert( - std::make_tuple(output_file, this->test->storage_service2, this->test->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->test->storage_service2)); - - auto wu = std::shared_ptr(new wrench::Workunit( - job, - pre_file_copies, - task, - file_locations, - post_file_copies, - cleanup_file_deletions - )); - - auto wue = std::shared_ptr( - new wrench::WorkunitExecutor(this->hostname, 1, 1, this->mailbox_name, - wu, nullptr, job, 1, true)); - wue->simulation = this->simulation; - wue->start(wue, true, false); - - auto msg = wrench::S4U_Mailbox::getMessage(this->mailbox_name); - if (not std::dynamic_pointer_cast(msg)) { - throw std::runtime_error("Was expecting a WorkunitExecutorFailedMessage message!"); - } else { - auto real_msg = std::dynamic_pointer_cast(msg); - if (not std::dynamic_pointer_cast(real_msg->cause)) { - throw std::runtime_error( - "Got the expected WorkunitExecutorFailedMessage message but not the expected NoScratchSpace failure cause"); - } - } - } - - /** BOGUS MAP **/ - { - pre_file_copies.insert( - std::make_tuple(input_file, this->test->storage_service1, this->test->storage_service2)); - file_locations[input_file] = this->test->storage_service2; - file_locations[output_file] = wrench::ComputeService::SCRATCH; - post_file_copies.insert( - std::make_tuple(output_file, this->test->storage_service2, this->test->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->test->storage_service2)); - - auto wu = std::shared_ptr(new wrench::Workunit( - job, - pre_file_copies, - task, - file_locations, - post_file_copies, - cleanup_file_deletions - )); - - auto wue = std::shared_ptr( - new wrench::WorkunitExecutor(this->hostname, 1, 1, this->mailbox_name, - wu, nullptr, job, 1, true)); - wue->simulation = this->simulation; - wue->start(wue, true, false); - - auto msg = wrench::S4U_Mailbox::getMessage(this->mailbox_name); - if (not std::dynamic_pointer_cast(msg)) { - throw std::runtime_error("Was expecting a WorkunitExecutorFailedMessage message!"); - } else { - auto real_msg = std::dynamic_pointer_cast(msg); - if (not std::dynamic_pointer_cast(real_msg->cause)) { - throw std::runtime_error( - "Got the expected WorkunitExecutorFailedMessage message but not the expected NoScratchSpace failure cause"); - } - } - } - - /** BOGUS POST **/ - { - pre_file_copies.insert( - std::make_tuple(input_file, this->test->storage_service1, this->test->storage_service2)); - file_locations[input_file] = this->test->storage_service2; - file_locations[output_file] = this->test->storage_service2; - post_file_copies.insert( - std::make_tuple(output_file, wrench::ComputeService::SCRATCH, this->test->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, this->test->storage_service2)); - - auto wu = std::shared_ptr(new wrench::Workunit( - job, - pre_file_copies, - task, - file_locations, - post_file_copies, - cleanup_file_deletions - )); - - auto wue = std::shared_ptr( - new wrench::WorkunitExecutor(this->hostname, 1, 1, this->mailbox_name, - wu, nullptr, job, 1, true)); - wue->simulation = this->simulation; - wue->start(wue, true, false); - - auto msg = wrench::S4U_Mailbox::getMessage(this->mailbox_name); - if (not std::dynamic_pointer_cast(msg)) { - throw std::runtime_error("Was expecting a WorkunitExecutorFailedMessage message!"); - } else { - auto real_msg = std::dynamic_pointer_cast(msg); - if (not std::dynamic_pointer_cast(real_msg->cause)) { - throw std::runtime_error( - "Got the expected WorkunitExecutorFailedMessage message but not the expected NoScratchSpace failure cause"); - } - } - } - - /** BOGUS CLEANUP **/ - { - pre_file_copies.insert( - std::make_tuple(input_file, this->test->storage_service1, this->test->storage_service2)); - file_locations[input_file] = this->test->storage_service2; - file_locations[output_file] = this->test->storage_service2; - post_file_copies.insert( - std::make_tuple(output_file, this->test->storage_service2, this->test->storage_service1)); - cleanup_file_deletions.insert(std::make_tuple(input_file, wrench::ComputeService::SCRATCH)); - - auto wu = std::shared_ptr(new wrench::Workunit( - job, - pre_file_copies, - task, - file_locations, - post_file_copies, - cleanup_file_deletions - )); - - auto wue = std::shared_ptr( - new wrench::WorkunitExecutor(this->hostname, 1, 1, this->mailbox_name, - wu, nullptr, job, 1, true)); - wue->simulation = this->simulation; - wue->start(wue, true, false); - - auto msg = wrench::S4U_Mailbox::getMessage(this->mailbox_name); - if (not std::dynamic_pointer_cast(msg)) { - throw std::runtime_error("Was expecting a WorkunitExecutorFailedMessage message!"); - } else { - auto real_msg = std::dynamic_pointer_cast(msg); - if (not std::dynamic_pointer_cast(real_msg->cause)) { - throw std::runtime_error( - "Got the expected WorkunitExecutorFailedMessage message but not the expected NoScratchSpace failure cause"); - } - } - } - - - return 0; - } -}; - -TEST_F(WorkunitExecutorTest, BadScratchSpaceTest) { - DO_TEST_WITH_FORK(do_WorkunitExecutorBadScratchSpace_test); -} - -void WorkunitExecutorTest::do_WorkunitExecutorBadScratchSpace_test() { - - // Create and initialize a simulation - simulation = new wrench::Simulation(); - int argc = 1; - char **argv = (char **) calloc(1, sizeof(char *)); - argv[0] = strdup("unit_test"); - - simulation->init(&argc, argv); - - // Setting up the platform - ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); - - // Get a hostname - std::string hostname = simulation->getHostnameList()[0]; - - // Create a Compute Service - std::shared_ptr compute_service; - ASSERT_NO_THROW(compute_service = simulation->add( - new wrench::BareMetalComputeService(hostname, - {std::make_pair(hostname, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, - {}))); - - // Create a Storage Service - ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); - - // Create another Storage Service - ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); - - // Create a WMS - std::shared_ptr wms = nullptr; - ASSERT_NO_THROW(wms = simulation->add( - new WorkunitExecutorBadScratchSpaceTestWMS( - this, {compute_service}, {storage_service1, storage_service2}, hostname))); - - ASSERT_NO_THROW(wms->addWorkflow(workflow.get())); - - simulation->add(new wrench::FileRegistryService(hostname)); - - // Create two workflow files - wrench::WorkflowFile *input_file = this->workflow->addFile("input_file", 10000000.0); - wrench::WorkflowFile *output_file = this->workflow->addFile("output_file", 20000.0); - - // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(input_file, storage_service1)); - - // Running a "run a single task" simulation - // Note that in these tests the WMS creates workflow tasks, which a user would - // of course not be likely to do - ASSERT_NO_THROW(simulation->launch()); - - delete simulation; - - free(argv[0]); - free(argv); -} diff --git a/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp b/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp index 29b1cf9b01..8d3a6a8574 100644 --- a/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp +++ b/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp @@ -431,7 +431,7 @@ class SimpleStorageServiceBasicFunctionalityTestWMS : public wrench::WMS { // Try to do stuff with a shutdown service try { wrench::StorageService::lookupFile(this->test->file_1, - wrench::FileLocation::LOCATION(this->test->storage_service_100)); + wrench::FileLocation::LOCATION(this->test->storage_service_100)); throw std::runtime_error("Should not be able to lookup a file from a DOWN service"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -449,7 +449,7 @@ class SimpleStorageServiceBasicFunctionalityTestWMS : public wrench::WMS { try { wrench::StorageService::lookupFile(this->test->file_1, - wrench::FileLocation::LOCATION(this->test->storage_service_100, "/")); + wrench::FileLocation::LOCATION(this->test->storage_service_100, "/")); throw std::runtime_error("Should not be able to lookup a file from a DOWN service"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -468,7 +468,7 @@ class SimpleStorageServiceBasicFunctionalityTestWMS : public wrench::WMS { try { wrench::StorageService::readFile(this->test->file_1, - wrench::FileLocation::LOCATION(this->test->storage_service_100)); + wrench::FileLocation::LOCATION(this->test->storage_service_100)); throw std::runtime_error("Should not be able to read a file from a down service"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -486,7 +486,7 @@ class SimpleStorageServiceBasicFunctionalityTestWMS : public wrench::WMS { try { wrench::StorageService::writeFile(this->test->file_1, - wrench::FileLocation::LOCATION(this->test->storage_service_100)); + wrench::FileLocation::LOCATION(this->test->storage_service_100)); throw std::runtime_error("Should not be able to write a file from a DOWN service"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -639,8 +639,8 @@ class SimpleStorageServiceSynchronousFileCopyTestWMS : public wrench::WMS { // Do a bogus file copy (file = nullptr) try { - data_movement_manager->doSynchronousFileCopy(nullptr, this->test->storage_service_1000, - this->test->storage_service_510); + data_movement_manager->doSynchronousFileCopy(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service_1000), + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Shouldn't be able to do a synchronous file copy with a nullptr file"); } catch (std::invalid_argument &e) { } @@ -648,14 +648,14 @@ class SimpleStorageServiceSynchronousFileCopyTestWMS : public wrench::WMS { // Do a bogus file copy (src = nullptr) try { data_movement_manager->doSynchronousFileCopy(this->test->file_500, nullptr, - this->test->storage_service_510); + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Shouldn't be able to do a synchronous file copy with a nullptr src"); } catch (std::invalid_argument &e) { } // Do a bogus file copy (dst = nullptr) try { - data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, + data_movement_manager->doSynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), nullptr); throw std::runtime_error("Shouldn't be able to do a synchronous file copy with a nullptr src"); } catch (std::invalid_argument &e) { @@ -663,24 +663,24 @@ class SimpleStorageServiceSynchronousFileCopyTestWMS : public wrench::WMS { // Do the file copy try { - data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_510); + data_movement_manager->doSynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), + wrench::FileLocation::LOCATION(this->test->storage_service_510)); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an exception while doing a synchronous file copy: " + std::string(e.what())); } // Do the file copy again, which should fail try { - data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_510); + data_movement_manager->doSynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should not be able to write a file beyond the storage capacity"); } catch (wrench::WorkflowExecutionException &e) { } - // Do another file copy with empty src partition and empty dst partition + // Do another file copy with empty src dir and empty dst dir try { - data_movement_manager->doSynchronousFileCopy(this->test->file_1, this->test->storage_service_1000, "", - this->test->storage_service_510, ""); + data_movement_manager->doSynchronousFileCopy(this->test->file_1, wrench::FileLocation::LOCATION(this->test->storage_service_1000, ""), + wrench::FileLocation::LOCATION(this->test->storage_service_510, "")); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an exception while doing a synchronous file copy: " + std::string(e.what())); } @@ -717,10 +717,10 @@ void SimpleStorageServiceFunctionalTest::do_SynchronousFileCopy_test() { // Create 2 Storage Services ASSERT_NO_THROW(storage_service_1000 = simulation->add( - new wrench::SimpleStorageService(hostname, 1000.0))); + new wrench::SimpleStorageService(hostname, {"/disk1000"}))); ASSERT_NO_THROW(storage_service_510 = simulation->add( - new wrench::SimpleStorageService(hostname, 510.0))); + new wrench::SimpleStorageService(hostname, {"/disk_510"}))); // Create a WMS std::shared_ptr wms = nullptr; @@ -736,10 +736,10 @@ void SimpleStorageServiceFunctionalTest::do_SynchronousFileCopy_test() { simulation->add(new wrench::FileRegistryService(hostname)); // Staging file_500 on the 1000-byte storage service - ASSERT_NO_THROW(simulation->stageFiles({{file_1->getID(), file_1}}, storage_service_1000)); + ASSERT_NO_THROW(simulation->stageFile(file_1, wrench::FileLocation::LOCATION(storage_service_1000))); // Staging file_500 on the 1000-byte storage service - ASSERT_NO_THROW(simulation->stageFiles({{file_500->getID(), file_500}}, storage_service_1000)); + ASSERT_NO_THROW(simulation->stageFile(file_500, wrench::FileLocation::LOCATION(storage_service_1000))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -778,7 +778,7 @@ class SimpleStorageServiceAsynchronousFileCopyTestWMS : public wrench::WMS { // Initiate a file copy try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), this->test->storage_service_510); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an exception while trying to initiate a file copy: " + std::string(e.what())); @@ -786,7 +786,7 @@ class SimpleStorageServiceAsynchronousFileCopyTestWMS : public wrench::WMS { // Initiate it again which should fail try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), this->test->storage_service_510); throw std::runtime_error("A duplicate asynchronous file copy should fail!"); } catch (wrench::WorkflowExecutionException &e) { @@ -912,7 +912,7 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM // Do the file copy while space doesn't fit try { - data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, + data_movement_manager->doSynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000), this->test->storage_service_100); throw std::runtime_error("Should have gotten a 'not enough space' exception"); } catch (wrench::WorkflowExecutionException &e) { @@ -948,7 +948,7 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM this->test->storage_service_1000->deleteFile(this->test->file_500); try { - data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_510, + data_movement_manager->doSynchronousFileCopy(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_510), this->test->storage_service_1000); throw std::runtime_error("Should have gotten a 'file not found' exception"); } catch (wrench::WorkflowExecutionException &e) { @@ -963,7 +963,7 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM throw std::runtime_error( "Got the expected 'file not found' exception, but the failure cause does not point to the correct file"); } - if (cause->getStorageService() != this->test->storage_service_510) { + if (cause->getStorageService() != wrench::FileLocation::LOCATION(this->test->storage_service_510)) { throw std::runtime_error( "Got the expected 'file not found' exception, but the failure cause does not point to the correct storage service"); } @@ -974,7 +974,7 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM try { data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_510); + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should have gotten a 'service is down' exception"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -996,7 +996,7 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM try { data_movement_manager->doSynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_510); + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should have gotten a 'service is down' exception"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -1184,7 +1184,7 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W try { data_movement_manager->initiateAsynchronousFileCopy(this->test->file_100, this->test->storage_service_1000, - this->test->storage_service_510); + wrench::FileLocation::LOCATION(this->test->storage_service_510)); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1216,7 +1216,7 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W try { data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_510); + wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should have gotten a 'service is down' exception"); } catch (wrench::WorkflowExecutionException &e) { // Check Exception @@ -1329,7 +1329,7 @@ class PartitionsTestWMS : public wrench::WMS { // Copy storage_service_1000:/:file_10 to storage_service_510:foo:file_10 try { data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, this->test->storage_service_1000, "/", - this->test->storage_service_510, "foo"); + wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo"); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1369,7 +1369,7 @@ class PartitionsTestWMS : public wrench::WMS { // Remove the file at storage_service_510:/:file_10 try { - this->test->storage_service_510->deleteFile(this->test->file_10, ""); + wrench::FileLocation::LOCATION(this->test->storage_service_510)->deleteFile(this->test->file_10, ""); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Should be able to delete file storage_service_510:/:file_10"); } @@ -1378,7 +1378,7 @@ class PartitionsTestWMS : public wrench::WMS { // Copy storage_service_510:/:file_10 to storage_service_1000:foo:file_10: SHOULD NOT WORK try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, this->test->storage_service_510, "/", + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_510), "/", this->test->storage_service_1000, "foo"); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); @@ -1397,7 +1397,7 @@ class PartitionsTestWMS : public wrench::WMS { // Copy storage_service_510:foo:file_10 to storage_service_1000:foo try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, this->test->storage_service_510, "foo", + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo", this->test->storage_service_1000, "foo"); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); @@ -1417,8 +1417,8 @@ class PartitionsTestWMS : public wrench::WMS { // Copy storage_service_510:foo:file_10 to storage_service_510:bar try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, this->test->storage_service_510, "foo", - this->test->storage_service_510, "bar"); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo", + wrench::FileLocation::LOCATION(this->test->storage_service_510), "bar"); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1436,27 +1436,25 @@ class PartitionsTestWMS : public wrench::WMS { // Copy storage_service_510:foo:file_10 to storage_service_510:foo SHOULD NOT WORK try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, this->test->storage_service_510, "foo", - this->test->storage_service_510, "foo"); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, + wrench::FileLocation::LOCATION(this->test->storage_service_510, "/large_disk/foo")), + wrench::FileLocation::LOCATION(this->test->storage_service_510, "/large_disk/foo")); throw std::runtime_error("Should not be able to copy a file onto itself"); } catch (std::invalid_argument &e) { } // Check all lookups - if (not this->test->storage_service_1000->lookupFile(this->test->file_10)) { - throw std::runtime_error("File should be in storage_service_1000, partition '/'"); - } - if (not this->test->storage_service_1000->lookupFile(this->test->file_10, "/")) { - throw std::runtime_error("File should be in storage_service_1000, partition '/'"); + if (not wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_1000))) { + throw std::runtime_error("File should be in storage_service_1000 at the mount point root"); } - if (not this->test->storage_service_1000->lookupFile(this->test->file_10, "")) { - throw std::runtime_error("File should be in storage_service_1000, partition '/'"); + if (not wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/large_disk"))) { + throw std::runtime_error("File should be in storage_service_1000 at the mount point root"); } - if (not this->test->storage_service_510->lookupFile(this->test->file_10, "foo")) { - throw std::runtime_error("File should be in storage_service_510, partition '/'"); + if (not wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_510, "/large_disk/foo"))) { + throw std::runtime_error("File should be in storage_service_510 at path /large_disk/foo/"); } - if (not this->test->storage_service_1000->lookupFile(this->test->file_10, "foo")) { - throw std::runtime_error("File should be in storage_service_1000, partition '/'"); + if (not wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/large_disk/foo"))) { + throw std::runtime_error("File should be in storage_service_1000 at path /large_disk/foo"); } diff --git a/test/storage_services/SimpleStorageService/SimpleStorageServicePerformanceTest.cpp b/test/storage_services/SimpleStorageService/SimpleStorageServicePerformanceTest.cpp index 93a23a0b5d..897ca7fc72 100644 --- a/test/storage_services/SimpleStorageService/SimpleStorageServicePerformanceTest.cpp +++ b/test/storage_services/SimpleStorageService/SimpleStorageServicePerformanceTest.cpp @@ -268,7 +268,7 @@ class SimpleStorageServiceFileReadTestWMS : public wrench::WMS { double before_read = simulation->getCurrentSimulatedDate(); try { - this->test->storage_service_1->readFile(this->test->file_1); + wrench::StorageService::readFile(this->test->file_1, wrench::FileLocation::LOCATION(this->test->storage_service_1)); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error(e.what()); } diff --git a/test/wms/WMSTest.cpp b/test/wms/WMSTest.cpp index dce145a050..524a59fc63 100644 --- a/test/wms/WMSTest.cpp +++ b/test/wms/WMSTest.cpp @@ -34,8 +34,26 @@ class WMSTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -135,12 +153,16 @@ class TestDefaultHandlerWMS : public wrench::WMS { // Get a "FILE COPY COMPLETION" event (default handler) data_movement_manager->initiateAsynchronousFileCopy(this->test->small_file, - this->test->storage_service1, this->test->storage_service2, nullptr); + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2), + nullptr); this->waitForAndProcessNextEvent(); // Get a "FILE COPY FAILURE" event (default handler) data_movement_manager->initiateAsynchronousFileCopy(this->test->big_file, - this->test->storage_service1, this->test->storage_service2, nullptr); + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2), + nullptr); this->waitForAndProcessNextEvent(); // Set a timer @@ -179,23 +201,23 @@ void WMSTest::do_DefaultHandlerWMS_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname1, 100.0))); + new wrench::SimpleStorageService(hostname1, {"/"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname2, 100.0))); + new wrench::SimpleStorageService(hostname2, {"/"}))); // Create a Cloud Service std::vector cloud_hosts; cloud_hosts.push_back(hostname1); ASSERT_NO_THROW(cs_cloud = simulation->add( - new wrench::CloudComputeService(hostname1, cloud_hosts, 100.0, {}, {}))); + new wrench::CloudComputeService(hostname1, cloud_hosts, "/scratch", {}, {}))); // Create a Batch Service std::vector batch_hosts; batch_hosts.push_back(hostname2); ASSERT_NO_THROW(cs_batch = simulation->add( - new wrench::BatchComputeService(hostname2, batch_hosts, 100.0, + new wrench::BatchComputeService(hostname2, batch_hosts, "/scratch", {}, // {{wrench::BatchComputeServiceProperty::BATSCHED_LOGGING_MUTED, "false"}}, {}))); @@ -218,8 +240,8 @@ void WMSTest::do_DefaultHandlerWMS_test() { this->big_file = workflow->addFile("big", 1000); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({std::make_pair(this->small_file->getID(), this->small_file)}, - storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(this->small_file, + wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -302,7 +324,8 @@ class TestCustomHandlerWMS : public wrench::WMS { // Get a "FILE COPY COMPLETION" event (default handler) data_movement_manager->initiateAsynchronousFileCopy(this->test->small_file, - this->test->storage_service1, this->test->storage_service2, nullptr); + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2), nullptr); this->waitForAndProcessNextEvent(); if (this->counter != 5) { throw std::runtime_error("Did not get expected FileCoompletedEvent"); @@ -310,7 +333,8 @@ class TestCustomHandlerWMS : public wrench::WMS { // Get a "FILE COPY FAILURE" event (default handler) data_movement_manager->initiateAsynchronousFileCopy(this->test->big_file, - this->test->storage_service1, this->test->storage_service2, nullptr); + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2), nullptr); this->waitForAndProcessNextEvent(); if (this->counter != 6) { throw std::runtime_error("Did not get expected FileCopyFailureEvent"); @@ -386,17 +410,17 @@ void WMSTest::do_CustomHandlerWMS_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname1, 100.0))); + new wrench::SimpleStorageService(hostname1, {"/"}))); // Create a Storage Service ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname2, 100.0))); + new wrench::SimpleStorageService(hostname2, {"/"}))); // Create a Cloud Service std::vector cloud_hosts; cloud_hosts.push_back(hostname1); ASSERT_NO_THROW(cs_cloud = simulation->add( - new wrench::CloudComputeService(hostname1, cloud_hosts, 100.0, {}, {}))); + new wrench::CloudComputeService(hostname1, cloud_hosts, "/scratch", {}, {}))); // Create a Batch Service std::vector batch_hosts; @@ -422,8 +446,8 @@ void WMSTest::do_CustomHandlerWMS_test() { this->big_file = workflow->addFile("big", 1000); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({std::make_pair(this->small_file->getID(), this->small_file)}, - storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(this->small_file, + wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch());