From d032a575f5734d28af6fe90150a5cca558497bda Mon Sep 17 00:00:00 2001 From: henricasanova Date: Wed, 25 Sep 2019 21:35:43 -1000 Subject: [PATCH] tmp commit (#2) --- .../BareMetalComputeServiceOneTaskTest.cpp | 98 +-- ...areMetalComputeServiceTestStandardJobs.cpp | 17 +- .../BatchService/BatchServiceTest.cpp | 166 +++-- .../StandardJobExecutorTest.cpp | 86 ++- ...ServiceResourceAllocationAlgorithmTest.cpp | 35 +- .../VirtualizedClusterServiceTest.cpp | 66 +- .../FileRegistryTest.cpp | 622 +++++++++--------- .../NetworkProximityTest.cpp | 61 +- .../simulation/DynamicServiceCreationTest.cpp | 40 +- test/simulation/SimpleSimulationTest.cpp | 41 +- .../SimulationTimestampFileCopyTest.cpp | 108 ++- .../SimulationTimestampTaskTest.cpp | 69 +- .../SimpleStorageServiceFunctionalTest.cpp | 82 ++- test/wms/JobManagerTest.cpp | 39 +- 14 files changed, 910 insertions(+), 620 deletions(-) diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp index d830273458..5b442aa68a 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceOneTaskTest.cpp @@ -612,12 +612,13 @@ void BareMetalComputeServiceOneTaskTest::do_StandardJobConstructor_test() { // Create a Compute Service compute_service = simulation->add( new wrench::BareMetalComputeService(hostname1, - {std::make_pair(hostname1, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair(hostname1, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + "scratch", {})); // Create a Storage Service storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname1, 10000000000000.0)); + new wrench::SimpleStorageService(hostname1, {"/"})); // Start a file registry service simulation->add(new wrench::FileRegistryService(hostname1)); @@ -630,7 +631,7 @@ void BareMetalComputeServiceOneTaskTest::do_StandardJobConstructor_test() { wms->addWorkflow(workflow); // Staging the input_file on the storage service - simulation->stageFiles({{input_file->getID(), input_file}}, storage_service1); + simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1)); // Running a "do nothing" simulation ASSERT_NO_THROW(simulation->launch()); @@ -718,12 +719,12 @@ void BareMetalComputeServiceOneTaskTest::do_HostMemory_test() { // Create a Compute Service compute_service = simulation->add( new wrench::BareMetalComputeService(hostname1, - {std::make_pair(hostname1, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair(hostname1, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},"/scratch'", {})); // Create a Storage Service storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname1, 10000000000000.0)); + new wrench::SimpleStorageService(hostname1, {"/"})); // Start a file registry service simulation->add(new wrench::FileRegistryService(hostname1)); @@ -736,7 +737,7 @@ void BareMetalComputeServiceOneTaskTest::do_HostMemory_test() { wms->addWorkflow(workflow); // Staging the input_file on the storage service - simulation->stageFiles({{input_file->getID(), input_file}}, storage_service1); + simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1)); // Running a "do nothing" simulation ASSERT_NO_THROW(simulation->launch()); @@ -847,11 +848,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithLocationMap_test() { 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))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a File Registry Service ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); @@ -869,7 +870,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithLocationMap_test() { ASSERT_NO_THROW(wms->addWorkflow(workflow)); // 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 "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -935,7 +936,9 @@ class ExecutionWithDefaultStorageServiceTestWMS : public wrench::WMS { throw std::runtime_error("Unexpected workflow execution event!"); } - if (!this->test->storage_service1->lookupFile(this->test->output_file, job)) { + if (!this->test->storage_service1->lookupFile( + this->test->output_file, + wrench::FileLocation::LOCATION(this->test->storage_service1, "/scratch/" + job->getName()))) { throw std::runtime_error("Output file not written to storage service"); } @@ -969,7 +972,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithDefaultStorageService_t // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a Compute Service ASSERT_NO_THROW(compute_service = simulation->add( @@ -990,7 +993,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithDefaultStorageService_t ASSERT_NO_THROW(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_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -1064,16 +1067,22 @@ class ExecutionWithPrePostCopiesAndCleanupTestWMS : public wrench::WMS { } // Test file locations - if (!this->test->storage_service1->lookupFile(this->test->input_file, nullptr)) { + if (!this->test->storage_service1->lookupFile( + this->test->input_file, nullptr)) { throw std::runtime_error("Input file should be on Storage Service #1"); } - if (!this->test->storage_service1->lookupFile(this->test->output_file, nullptr)) { + if (!this->test->storage_service1->lookupFile( + this->test->output_file, nullptr)) { throw std::runtime_error("Output file should be on Storage Service #1"); } - if (this->test->storage_service2->lookupFile(this->test->input_file,job)) { + if (this->test->storage_service2->lookupFile( + this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service2, "/" + job->getName()))) { throw std::runtime_error("Input file should not be on Storage Service #2"); } - if (this->test->storage_service2->lookupFile(this->test->input_file,job)) { + if (this->test->storage_service2->lookupFile( + this->test->output_file, + wrench::FileLocation::LOCATION(this->test->storage_service2, "/" + job->getName()))) { throw std::runtime_error("Output file should not be on Storage Service #2"); } @@ -1107,11 +1116,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesTaskCleanu // 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 a Compute Service with default Storage Service #2 @@ -1134,7 +1143,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesTaskCleanu ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1189,8 +1198,12 @@ 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, 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)}, + {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), + wrench::FileLocation::LOCATION(test->storage_service3))}, {}); // Submit the job job_manager->submitJob(job, test->compute_service); @@ -1244,15 +1257,15 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesNoTaskNoCl // 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 another Storage Service ASSERT_NO_THROW(storage_service3 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a Compute Service with default Storage Service #2 @@ -1275,7 +1288,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesNoTaskNoCl ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1367,11 +1380,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPreNoPostCopiesNoTaskCl // 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 a Compute Service with default Storage Service #2 @@ -1394,7 +1407,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPreNoPostCopiesNoTaskCl ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1431,7 +1444,8 @@ class ExecutionWithMissingFileTestWMS : public wrench::WMS { auto job_manager = this->createJobManager(); // Remove the staged file! - this->wrench::FileLocation::LOCATION(test->storage_service1)->deleteFile(test->input_file); + wrench::StorageService::deleteFile(test->input_file, + wrench::FileLocation::LOCATION(test->storage_service1)); // Create a job wrench::StandardJob *job = job_manager->createStandardJob({test->task}, @@ -1491,11 +1505,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithMissingFile_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 a Compute Service with no default Storage Service @@ -1517,7 +1531,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithMissingFile_test() { ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1614,11 +1628,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithNotEnoughCores_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 a Compute Service with no default Storage Service @@ -1640,7 +1654,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithNotEnoughCores_test() { ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1735,11 +1749,11 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithNotEnoughRAM_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 a Compute Service with no default Storage Service @@ -1761,7 +1775,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithNotEnoughRAM_test() { ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on storage service #1 - 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 ASSERT_NO_THROW(simulation->launch()); @@ -1858,7 +1872,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithDownService_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a File Registry Service ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); @@ -1876,7 +1890,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithDownService_test() { ASSERT_NO_THROW(wms->addWorkflow(workflow)); // 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 "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -1983,7 +1997,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithSuspendedService_test() // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a File Registry Service ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); @@ -2001,7 +2015,7 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithSuspendedService_test() ASSERT_NO_THROW(wms->addWorkflow(workflow)); // 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 "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); diff --git a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp index 1293507dd7..36a2643d7a 100644 --- a/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp +++ b/test/compute_services/BareMetalComputeService/BareMetalComputeServiceTestStandardJobs.cpp @@ -1014,7 +1014,9 @@ class BareMetalComputeServiceJobTerminationTestWMS : public wrench::WMS { // 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, wrench::FileLocation::LOCATION(this->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 @@ -1252,7 +1254,9 @@ class BareMetalComputeServiceCompletedJobTerminationTestWMS : public wrench::WMS // 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, wrench::FileLocation::LOCATION(this->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 @@ -1307,7 +1311,8 @@ void BareMetalComputeServiceTestStandardJobs::do_CompletedJobTermination_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))}, + {std::make_pair(hostname, + std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, "/scratch", {}))); // Create a WMS @@ -1564,13 +1569,13 @@ void BareMetalComputeServiceTestStandardJobs::do_ShutdownStorageServiceBeforeJob // Create A Storage Services ASSERT_NO_THROW(storage_service = simulation->add( - new wrench::SimpleStorageService(hostname, 100.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // 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))}, - 0, {}))); + "", {}))); // Create a WMS std::shared_ptr wms = nullptr;; @@ -1585,7 +1590,7 @@ void BareMetalComputeServiceTestStandardJobs::do_ShutdownStorageServiceBeforeJob // Staging the input file on the storage service - ASSERT_NO_THROW(simulation->stageFile(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()); diff --git a/test/compute_services/BatchService/BatchServiceTest.cpp b/test/compute_services/BatchService/BatchServiceTest.cpp index 65c0294f0f..d527a1d95d 100644 --- a/test/compute_services/BatchService/BatchServiceTest.cpp +++ b/test/compute_services/BatchService/BatchServiceTest.cpp @@ -994,15 +994,17 @@ class StandardPlusPilotJobSubmissionTestWMS : 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"), wrench::FileLocation::LOCATION(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"] = "1"; @@ -1121,7 +1123,7 @@ void BatchServiceTest::do_StandardPlusPilotJobTaskTest_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 @@ -1173,12 +1175,14 @@ class InsufficientCoresJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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"] = "1"; @@ -1252,7 +1256,7 @@ void BatchServiceTest::do_InsufficientCoresTaskTest_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 @@ -1269,7 +1273,7 @@ void BatchServiceTest::do_InsufficientCoresTaskTest_test() { /**********************************************************************/ -/** NO ARGUMENTS JOB SUBMISSION TASK SIMULATION TEST ON ONE-ONE HOST **/ +/** NO ARGUMENTS JOB SUBMISSION TASK SIMULATION TEST ON ONE-ONE HOST **/ /**********************************************************************/ class NoArgumentsJobSubmissionTestWMS : public wrench::WMS { @@ -1305,12 +1309,14 @@ class NoArgumentsJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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; try { @@ -1376,7 +1382,7 @@ void BatchServiceTest::do_noArgumentsJobSubmissionTest_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 @@ -1430,12 +1436,14 @@ class StandardJobTimeoutSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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"] = "1"; @@ -1527,7 +1535,7 @@ void BatchServiceTest::do_StandardJobTimeOutTaskTest_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 @@ -1658,7 +1666,7 @@ void BatchServiceTest::do_PilotJobTimeOutTaskTest_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 @@ -1719,12 +1727,14 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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"] = "1"; @@ -1744,12 +1754,14 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(this->test->storage_service1), - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file_1"), + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file_1"), - this->test->storage_service2)}); + {std::tuple>( + this->getWorkflow()->getFileByID("input_file_1"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map task1_batch_job_args; task1_batch_job_args["-N"] = "1"; @@ -1769,12 +1781,14 @@ class BestFitStandardJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(this->test->storage_service1), - this->test->storage_service2)}, + {std::tuple, std::shared_ptr>( + this->getWorkflow()->getFileByID("input_file_2"), + wrench::FileLocation::LOCATION(this->test->storage_service1), + wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, - {std::tuple>(this->getWorkflow()->getFileByID("input_file_2"), - this->test->storage_service2)}); + {std::tuple>( + this->getWorkflow()->getFileByID("input_file_2"), + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::map task2_batch_job_args; task2_batch_job_args["-N"] = "1"; @@ -1878,9 +1892,9 @@ void BatchServiceTest::do_BestFitTaskTest_test() { wrench::WorkflowFile *output_file_2 = this->workflow->addFile("output_file_2", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}, - {input_file_1->getID(), input_file_1}, - {input_file_2->getID(), input_file_2}}, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_1, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_2, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -1896,7 +1910,7 @@ void BatchServiceTest::do_BestFitTaskTest_test() { /**********************************************************************/ -/** FIRST FIT STANDARD JOB SUBMISSION TASK SIMULATION TEST ON ONE-ONE HOST **/ +/** FIRST FIT STANDARD JOB SUBMISSION TASK SIMULATION TEST ON ONE-ONE HOST **/ /**********************************************************************/ class FirstFitStandardJobSubmissionTestWMS : public wrench::WMS { @@ -2042,9 +2056,9 @@ void BatchServiceTest::do_FirstFitTaskTest_test() { wrench::WorkflowFile *output_file_2 = this->workflow->addFile("output_file_2", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}, - {input_file_1->getID(), input_file_1}, - {input_file_2->getID(), input_file_2}}, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_1, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_2, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -2314,9 +2328,9 @@ void BatchServiceTest::do_RoundRobinTask_test() { wrench::WorkflowFile *output_file_2 = this->workflow->addFile("output_file_2", 20000.0); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({{input_file->getID(), input_file}, - {input_file_1->getID(), input_file_1}, - {input_file_2->getID(), input_file_2}}, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_1, wrench::FileLocation::LOCATION(storage_service1))); + ASSERT_NO_THROW(simulation->stageFile(input_file_2, wrench::FileLocation::LOCATION(storage_service1))); // Running a "run a single task" simulation @@ -2492,7 +2506,7 @@ void BatchServiceTest::do_StandardJobInsidePilotJobTimeOutTaskTest_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 @@ -2571,12 +2585,14 @@ class StandardJobInsidePilotJobSucessSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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))}); try { job_manager->submitJob(job, pilot_job->getComputeService(), {}); @@ -2654,7 +2670,7 @@ void BatchServiceTest::do_StandardJobInsidePilotJobSucessTaskTest_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 @@ -2735,12 +2751,14 @@ class InsufficientCoresInsidePilotJobSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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))}); try { job_manager->submitJob(job, pilot_job->getComputeService(), {{task->getID(), "5"}}); @@ -2806,7 +2824,7 @@ void BatchServiceTest::do_InsufficientCoresInsidePilotJobTaskTest_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 @@ -2948,7 +2966,7 @@ void BatchServiceTest::do_MultipleStandardTaskTest_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 @@ -3001,12 +3019,14 @@ class DifferentBatchAlgorithmsSubmissionTestWMS : public wrench::WMS { {*(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"), wrench::FileLocation::LOCATION(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"] = "1"; @@ -3097,7 +3117,7 @@ void BatchServiceTest::do_DifferentBatchAlgorithmsSubmissionTest_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 diff --git a/test/compute_services/StandardJobExecutorTest.cpp b/test/compute_services/StandardJobExecutorTest.cpp index c02140ac91..0ee8ceab73 100644 --- a/test/compute_services/StandardJobExecutorTest.cpp +++ b/test/compute_services/StandardJobExecutorTest.cpp @@ -181,7 +181,7 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { 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))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -342,7 +342,7 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { 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))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -386,7 +386,7 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { 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))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -428,7 +428,7 @@ class StandardJobExecutorConstructorTestWMS : public wrench::WMS { 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))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); try { executor = std::shared_ptr( @@ -579,7 +579,7 @@ class OneSingleCoreTaskTestWMS : public wrench::WMS { 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))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -777,7 +777,7 @@ class OneSingleCoreTaskBogusPreFileCopyTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service1))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); std::string my_mailbox = "test_callback_mailbox"; @@ -891,7 +891,7 @@ void StandardJobExecutorTest::do_OneSingleCoreTaskBogusPreFileCopyTest_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 @@ -956,7 +956,7 @@ class OneSingleCoreTaskMissingFileTestWMS : public wrench::WMS { {}, {}, {std::tuple>(this->getWorkflow()->getFileByID("output_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))}); + wrench::FileLocation::LOCATION(this->test->storage_service2))}); job->getFileLocations(); // coverage job->getPriority(); // coverage @@ -1011,7 +1011,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() != wrench::FileLocation::LOCATION(this->test->storage_service2)) { + if (cause->getLocation()->getStorageService() != 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"); } @@ -1073,7 +1073,7 @@ void StandardJobExecutorTest::do_OneSingleCoreTaskMissingFileTest_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 @@ -1365,7 +1365,8 @@ class OneMultiCoreTaskTestWMSCase1 : public wrench::WMS { std::to_string(observed_duration) + ")"); } - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); return 0; } @@ -1416,7 +1417,7 @@ void StandardJobExecutorTest::do_OneMultiCoreTaskTestCase1_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 @@ -1520,7 +1521,8 @@ class OneMultiCoreTaskTestWMSCase2 : public wrench::WMS { } - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); return 0; } @@ -1571,7 +1573,8 @@ void StandardJobExecutorTest::do_OneMultiCoreTaskTestCase2_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 @@ -1676,7 +1679,9 @@ class OneMultiCoreTaskTestWMSCase3 : public wrench::WMS { std::to_string(observed_duration) + ")"); } - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile( + this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); return 0; } @@ -1727,7 +1732,7 @@ void StandardJobExecutorTest::do_OneMultiCoreTaskTestCase3_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 @@ -1790,7 +1795,7 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -1853,7 +1858,8 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { this->getWorkflow()->removeTask(task1); this->getWorkflow()->removeTask(task2); - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile(this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); } @@ -1877,7 +1883,7 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -1938,7 +1944,9 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { this->getWorkflow()->removeTask(task1); this->getWorkflow()->removeTask(task2); - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile( + this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); } @@ -1961,11 +1969,13 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { {this->getWorkflow()->getFileByID("output_file"), wrench::FileLocation::LOCATION(this->test->storage_service1)} }, {std::tuple, std::shared_ptr>( - this->getWorkflow()->getFileByID("input_file"), wrench::FileLocation::LOCATION(this->test->storage_service1), + 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"), - wrench::FileLocation::LOCATION(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"; @@ -2032,7 +2042,9 @@ class TwoMultiCoreTasksTestWMS : public wrench::WMS { this->getWorkflow()->removeTask(task1); this->getWorkflow()->removeTask(task2); this->getWorkflow()->removeTask(task3); - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile( + this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); } @@ -2089,7 +2101,7 @@ void StandardJobExecutorTest::do_TwoMultiCoreTasksTest_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 @@ -2154,7 +2166,7 @@ class MultiHostTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2216,7 +2228,9 @@ class MultiHostTestWMS : public wrench::WMS { this->getWorkflow()->removeTask(task1); this->getWorkflow()->removeTask(task2); - this->test->storage_service1->deleteFile(this->getWorkflow()->getFileByID("output_file")); + wrench::StorageService::deleteFile( + this->getWorkflow()->getFileByID("output_file"), + wrench::FileLocation::LOCATION(this->test->storage_service1)); } @@ -2242,7 +2256,7 @@ class MultiHostTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2366,7 +2380,7 @@ void StandardJobExecutorTest::do_MultiHostTest_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 @@ -2434,7 +2448,7 @@ class JobTerminationTestDuringAComputationWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2523,7 +2537,7 @@ void StandardJobExecutorTest::do_JobTerminationTestDuringAComputation_test() { wrench::WorkflowFile *output_file2 = this->workflow->addFile("output_file2", 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 @@ -2589,7 +2603,7 @@ class JobTerminationTestDuringATransferWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -2677,7 +2691,7 @@ void StandardJobExecutorTest::do_JobTerminationTestDuringATransfer_test() { wrench::WorkflowFile *output_file2 = this->workflow->addFile("output_file2", 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 @@ -2852,7 +2866,7 @@ void StandardJobExecutorTest::do_JobTerminationTestAtRandomTimes_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 @@ -2957,7 +2971,7 @@ class NoTaskTestWMS : public wrench::WMS { wrench::FileLocation::LOCATION(this->test->storage_service2))}, {}, {std::tuple>(this->getWorkflow()->getFileByID("input_file"), - wrench::FileLocation::LOCATION(this->test->storage_service2))} + wrench::FileLocation::LOCATION(this->test->storage_service2))} ); std::string my_mailbox = "test_callback_mailbox"; @@ -3048,7 +3062,7 @@ void StandardJobExecutorTest::do_NoTaskTest_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 diff --git a/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceResourceAllocationAlgorithmTest.cpp b/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceResourceAllocationAlgorithmTest.cpp index 9be7d9405a..5116b42ea0 100644 --- a/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceResourceAllocationAlgorithmTest.cpp +++ b/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceResourceAllocationAlgorithmTest.cpp @@ -42,11 +42,38 @@ class VirtualizedClusterServiceResourceAllocationTest : public ::testing::Test { "" " " " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -184,19 +211,19 @@ void VirtualizedClusterServiceResourceAllocationTest::do_VMResourceAllocationAlg cloud_service_first_fit = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + {"/scratch"}, {{wrench::CloudComputeServiceProperty::VM_RESOURCE_ALLOCATION_ALGORITHM, "first-fit"}})); cloud_service_best_fit_ram_first = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + {"/scratch"}, {{wrench::CloudComputeServiceProperty::VM_RESOURCE_ALLOCATION_ALGORITHM, "best-fit-ram-first"}})); cloud_service_best_fit_cores_first = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + {"/scratch"}, {{wrench::CloudComputeServiceProperty::VM_RESOURCE_ALLOCATION_ALGORITHM, "best-fit-cores-first"}})); // Create a WMS diff --git a/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceTest.cpp b/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceTest.cpp index 1857fd4b1f..3302ca0c35 100644 --- a/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceTest.cpp +++ b/test/compute_services/VirtualizedClusterService/VirtualizedClusterServiceTest.cpp @@ -1320,7 +1320,7 @@ void VirtualizedClusterServiceTest::do_ShutdownVMAndThenShutdownServiceTest_test new wrench::FileRegistryService(hostname))); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(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()); @@ -1363,11 +1363,7 @@ class SubmitToVMTestWMS : public wrench::WMS { // Create a job manager auto job_manager = this->createJobManager(); - wrench::StandardJob *job2 = job_manager->createStandardJob({this->test->task2}, {}, - {std::make_tuple(this->test->input_file, - this->test->storage_service, - wrench::ComputeService::SCRATCH)}, - {}, {}); + std::vector>> vm_list; auto cs = *(this->getAvailableComputeServices().begin()); @@ -1463,12 +1459,12 @@ void VirtualizedClusterServiceTest::do_SubmitToVMTest_test() { // Create a Storage Service ASSERT_NO_THROW(storage_service = simulation->add( - new wrench::SimpleStorageService(hostname, 100.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a Cloud Service std::vector execution_hosts = {simulation->getHostnameList()[1]}; ASSERT_NO_THROW(compute_service = simulation->add( - new wrench::VirtualizedClusterComputeService(hostname, execution_hosts, 1000))); + new wrench::VirtualizedClusterComputeService(hostname, execution_hosts, "/scratch"))); // Create a WMS std::shared_ptr wms = nullptr;; @@ -1481,7 +1477,7 @@ void VirtualizedClusterServiceTest::do_SubmitToVMTest_test() { ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(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()); @@ -1570,11 +1566,11 @@ void VirtualizedClusterServiceTest::do_VMStartShutdownStartShutdown_test() { compute_service = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + "/scratch", {})); // Create a Storage Service - storage_service = simulation->add(new wrench::SimpleStorageService(hostname, 10000000000000.0)); + storage_service = simulation->add(new wrench::SimpleStorageService(hostname, {"/"})); // Create a WMS std::shared_ptr wms = nullptr;; @@ -1585,7 +1581,7 @@ void VirtualizedClusterServiceTest::do_VMStartShutdownStartShutdown_test() { // Staging the input_file on the storage service // Create a File Registry Service simulation->add(new wrench::FileRegistryService(hostname)); - simulation->stageFiles({{input_file->getID(), input_file}}, storage_service); + simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service)); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -1619,12 +1615,6 @@ class CloudServiceVMShutdownWhileJobIsRunningTestWMS : public wrench::WMS { // Create a job manager auto job_manager = this->createJobManager(); - // Create a job - wrench::StandardJob *job = job_manager->createStandardJob({this->test->task1}, {}, - {std::make_tuple(this->test->input_file, - this->test->storage_service, - wrench::ComputeService::SCRATCH)}, - {}, {}); // Create a VM on the Cloud Service auto vm_name = cloud_service->createVM(2, 1024); @@ -1633,7 +1623,17 @@ class CloudServiceVMShutdownWhileJobIsRunningTestWMS : public wrench::WMS { wrench::Simulation::sleep(10); auto vm_cs = cloud_service->startVM(vm_name); - // Submit the job to it + // Create a job + wrench::StandardJob *job = job_manager->createStandardJob( + {this->test->task1}, {}, + {std::make_tuple( + this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(vm_cs->getScratch()))}, + {}, {}); + + + // Submit the job to the vm job_manager->submitJob(job, vm_cs); wrench::Simulation::sleep(10); @@ -1698,11 +1698,11 @@ void VirtualizedClusterServiceTest::do_VMShutdownWhileJobIsRunning_test() { compute_service = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + "/scratch", {})); // Create a Storage Service - storage_service = simulation->add(new wrench::SimpleStorageService(hostname, 10000000000000.0)); + storage_service = simulation->add(new wrench::SimpleStorageService(hostname, {"/"})); // Create a WMS std::shared_ptr wms = nullptr;; @@ -1713,7 +1713,7 @@ void VirtualizedClusterServiceTest::do_VMShutdownWhileJobIsRunning_test() { // Staging the input_file on the storage service // Create a File Registry Service simulation->add(new wrench::FileRegistryService(hostname)); - simulation->stageFiles({{input_file->getID(), input_file}}, storage_service); + simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service)); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -1749,12 +1749,6 @@ class CloudServiceVMComputeServiceStopWhileJobIsRunningTestWMS : public wrench:: // Create a job manager auto job_manager = this->createJobManager(); - // Create a job - wrench::StandardJob *job = job_manager->createStandardJob({this->test->task1}, {}, - {std::make_tuple(this->test->input_file, - this->test->storage_service, - wrench::ComputeService::SCRATCH)}, - {}, {}); // Create a VM on the Cloud Service auto vm_name = cloud_service->createVM(2, 1024); @@ -1763,7 +1757,15 @@ class CloudServiceVMComputeServiceStopWhileJobIsRunningTestWMS : public wrench:: wrench::Simulation::sleep(10); auto vm_cs = cloud_service->startVM(vm_name); - // Submit the job to it + // Create a job + wrench::StandardJob *job = job_manager->createStandardJob( + {this->test->task1}, {}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(vm_cs->getScratch()))}, + {}, {}); + + // Submit the job to the VM job_manager->submitJob(job, vm_cs); wrench::Simulation::sleep(10); @@ -1831,11 +1833,11 @@ void VirtualizedClusterServiceTest::do_VMComputeServiceStopWhileJobIsRunning_tes compute_service = simulation->add( new wrench::CloudComputeService(hostname, compute_hosts, - 100.0, + "/scratch", {})); // Create a Storage Service - storage_service = simulation->add(new wrench::SimpleStorageService(hostname, 10000000000000.0)); + storage_service = simulation->add(new wrench::SimpleStorageService(hostname, {"/"})); // Create a WMS std::shared_ptr wms = nullptr;; @@ -1846,7 +1848,7 @@ void VirtualizedClusterServiceTest::do_VMComputeServiceStopWhileJobIsRunning_tes // Staging the input_file on the storage service // Create a File Registry Service simulation->add(new wrench::FileRegistryService(hostname)); - simulation->stageFiles({{input_file->getID(), input_file}}, storage_service); + simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service)); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); diff --git a/test/file_registry_services/FileRegistryTest.cpp b/test/file_registry_services/FileRegistryTest.cpp index 6204cb8ae0..47947c1ff1 100644 --- a/test/file_registry_services/FileRegistryTest.cpp +++ b/test/file_registry_services/FileRegistryTest.cpp @@ -29,42 +29,78 @@ class FileRegistryTest : public ::testing::Test { protected: FileRegistryTest() { - // Create the simplest workflow - workflow = new wrench::Workflow(); - - // Create a one-host platform file - std::string xml = "" - "" - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - ""; - - FILE *platform_file = fopen(platform_file_path.c_str(), "w"); - fprintf(platform_file, "%s", xml.c_str()); - fclose(platform_file); + // Create the simplest workflow + workflow = new wrench::Workflow(); + + // Create a one-host platform file + std::string xml = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; + + FILE *platform_file = fopen(platform_file_path.c_str(), "w"); + fprintf(platform_file, "%s", xml.c_str()); + fclose(platform_file); } @@ -86,7 +122,7 @@ class FileRegistryTestWMS : public wrench::WMS { std::shared_ptr file_registry_service, std::string hostname) : wrench::WMS(nullptr, nullptr, compute_services, storage_services, {}, file_registry_service, hostname, "test") { - this->test = test; + this->test = test; } private: @@ -96,172 +132,172 @@ class FileRegistryTestWMS : public wrench::WMS { int main() { - auto file1 = this->getWorkflow()->addFile("file1", 100.0); - auto file2 = this->getWorkflow()->addFile("file2", 100.0); - auto frs = this->getAvailableFileRegistryService(); + auto file1 = this->getWorkflow()->addFile("file1", 100.0); + auto file2 = this->getWorkflow()->addFile("file2", 100.0); + auto frs = this->getAvailableFileRegistryService(); - std::set> locations; + std::set> locations; - try { - frs->addEntry(nullptr, this->test->storage_service1); - throw std::runtime_error("Should not be able to add an entry with a nullptr file"); - } catch (std::invalid_argument &e) { - } + try { + frs->addEntry(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service1)); + throw std::runtime_error("Should not be able to add an entry with a nullptr file"); + } catch (std::invalid_argument &e) { + } + + try { + frs->addEntry(file1, nullptr); + throw std::runtime_error("Should not be able to add an entry with a nullptr storage service"); + } catch (std::invalid_argument &e) { + } - try { - frs->addEntry(file1, nullptr); - throw std::runtime_error("Should not be able to add an entry with a nullptr storage service"); - } catch (std::invalid_argument &e) { - } + try { + frs->lookupEntry(nullptr); + throw std::runtime_error("Should not be able to lookup an entry with a nullptr file"); + } catch (std::invalid_argument &e) { + } - try { - frs->lookupEntry(nullptr); - throw std::runtime_error("Should not be able to lookup an entry with a nullptr file"); - } catch (std::invalid_argument &e) { - } + // Adding twice file1 + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); - // Adding twice file1 - frs->addEntry(file1, this->test->storage_service1); - frs->addEntry(file1, this->test->storage_service1); + // Getting file1 + try { + locations = frs->lookupEntry(file1); + } catch (std::exception &e) { + throw std::runtime_error("Should not have gotten an exception when looking up entry"); + } - // Getting file1 - try { + if (locations.size() != 1) { + throw std::runtime_error("Got a wrong number of locations for file1"); + } + if ((*locations.begin())->getStorageService() != this->test->storage_service1) { + throw std::runtime_error("Got the wrong location for file 1"); + } + + // Adding another location for file1 + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service2)); + + // Getting file1 locations = frs->lookupEntry(file1); - } catch (std::exception &e) { - throw std::runtime_error("Should not have gotten an exception when looking up entry"); - } - - if (locations.size() != 1) { - throw std::runtime_error("Got a wrong number of locations for file1"); - } - if ((*locations.begin()) != this->test->storage_service1) { - throw std::runtime_error("Got the wrong location for file 1"); - } - - // Adding another location for file1 - frs->addEntry(file1, this->test->storage_service2); - - // Getting file1 - locations = frs->lookupEntry(file1); - - if (locations.size() != 2) { - throw std::runtime_error("Got a wrong number of locations for file1"); - } - if ((locations.find(this->test->storage_service1) == locations.end()) || - (locations.find(this->test->storage_service2) == locations.end())) { - throw std::runtime_error("Got the wrong locations for file 1"); - } - - try { - frs->removeEntry(nullptr, this->test->storage_service1); - throw std::runtime_error("Should not be able to remove an entry with a nullptr file"); - } catch (std::invalid_argument &e) { - } - - try { - frs->removeEntry(file1, nullptr); - throw std::runtime_error("Should not be able to remove an entry with a nullptr storage service"); - } catch (std::invalid_argument &e) { - } - - frs->removeEntry(file1, this->test->storage_service1); - - // Doing it again, which does nothing (coverage) - frs->removeEntry(file1, this->test->storage_service1); - - // Getting file1 - locations = frs->lookupEntry(file1); - - if (locations.size() != 1) { - throw std::runtime_error("Got a wrong number of locations for file1"); - } - if (locations.find(this->test->storage_service2) == locations.end()) { - throw std::runtime_error("Got the wrong locations for file 1"); - } - - // Remove an already removed entry - frs->removeEntry(file1, this->test->storage_service1); - - // Shutting down the service - frs->stop(); - - // Trying a removeEntry - try { - frs->removeEntry(file1, this->test->storage_service1); - throw std::runtime_error("Should not be able to remove an entry from a service that is down"); - } catch (wrench::WorkflowExecutionException &e) { - // Check Exception - auto cause = std::dynamic_pointer_cast(e.getCause()); - if (not cause) { - throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + - e.getCause()->toString() + " (expected: ServiceIsDown)"); + + if (locations.size() != 2) { + throw std::runtime_error("Got a wrong number of locations for file1"); + } + if ((locations.find(wrench::FileLocation::LOCATION(this->test->storage_service1)) == locations.end()) || + (locations.find(wrench::FileLocation::LOCATION(this->test->storage_service2)) == locations.end())) { + throw std::runtime_error("Got the wrong locations for file 1"); + } + + try { + frs->removeEntry(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service1)); + throw std::runtime_error("Should not be able to remove an entry with a nullptr file"); + } catch (std::invalid_argument &e) { + } + + try { + frs->removeEntry(file1, nullptr); + throw std::runtime_error("Should not be able to remove an entry with a nullptr storage service"); + } catch (std::invalid_argument &e) { + } + + frs->removeEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + + // Doing it again, which does nothing (coverage) + frs->removeEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + + // Getting file1 + locations = frs->lookupEntry(file1); + + if (locations.size() != 1) { + throw std::runtime_error("Got a wrong number of locations for file1"); } - // Check Exception details - if (cause->getService() != frs) { - throw std::runtime_error( - "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + if (locations.find(wrench::FileLocation::LOCATION(this->test->storage_service2)) == locations.end()) { + throw std::runtime_error("Got the wrong locations for file 1"); } - } - return 0; + // Remove an already removed entry + frs->removeEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + + // Shutting down the service + frs->stop(); + + // Trying a removeEntry + try { + frs->removeEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + throw std::runtime_error("Should not be able to remove an entry from a service that is down"); + } catch (wrench::WorkflowExecutionException &e) { + // Check Exception + auto cause = std::dynamic_pointer_cast(e.getCause()); + if (not cause) { + throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + + e.getCause()->toString() + " (expected: ServiceIsDown)"); + } + // Check Exception details + if (cause->getService() != frs) { + throw std::runtime_error( + "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + } + } + + return 0; } }; TEST_F(FileRegistryTest, SimpleFunctionality) { - DO_TEST_WITH_FORK(do_FileRegistry_Test); + DO_TEST_WITH_FORK(do_FileRegistry_Test); } void FileRegistryTest::do_FileRegistry_Test() { - // Create and initialize a simulation - auto simulation = new wrench::Simulation(); - int argc = 1; - char **argv = (char **) calloc(1, sizeof(char *)); - argv[0] = strdup("file_registry_test"); + // Create and initialize a simulation + auto simulation = new wrench::Simulation(); + int argc = 1; + char **argv = (char **) calloc(1, sizeof(char *)); + argv[0] = strdup("file_registry_test"); - simulation->init(&argc, argv); + simulation->init(&argc, argv); - // Setting up the platform - ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); + // Setting up the platform + ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); - // Get a hostname - std::string hostname = simulation->getHostnameList()[0]; + // Get a hostname + std::string hostname = simulation->getHostnameList()[0]; - // 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))}, - {}))); - // Create a Storage Service - ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + // 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))}, + {}))); + // Create a Storage Service + ASSERT_NO_THROW(storage_service1 = simulation->add( + new wrench::SimpleStorageService(hostname, {"/"}))); - // Create a Storage Service - ASSERT_NO_THROW(storage_service2 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + // Create a Storage Service + ASSERT_NO_THROW(storage_service2 = simulation->add( + new wrench::SimpleStorageService(hostname, {"/"}))); - // Create a file registry service - std::shared_ptr file_registry_service = nullptr; - ASSERT_NO_THROW(file_registry_service = simulation->add(new wrench::FileRegistryService(hostname))); + // Create a file registry service + std::shared_ptr file_registry_service = nullptr; + ASSERT_NO_THROW(file_registry_service = simulation->add(new wrench::FileRegistryService(hostname))); - // Create a WMS - std::shared_ptr wms = nullptr;; - ASSERT_NO_THROW(wms = simulation->add( - new FileRegistryTestWMS( - this, - {compute_service}, {storage_service1, storage_service2}, file_registry_service, hostname))); + // Create a WMS + std::shared_ptr wms = nullptr;; + ASSERT_NO_THROW(wms = simulation->add( + new FileRegistryTestWMS( + this, + {compute_service}, {storage_service1, storage_service2}, file_registry_service, hostname))); - ASSERT_NO_THROW(wms->addWorkflow(workflow)); + ASSERT_NO_THROW(wms->addWorkflow(workflow)); - // Running a "run a single task" simulation - ASSERT_NO_THROW(simulation->launch()); + // Running a "run a single task" simulation + ASSERT_NO_THROW(simulation->launch()); - delete simulation; + delete simulation; - free(argv[0]); - free(argv); + free(argv[0]); + free(argv); } /**********************************************************************/ /** LOOKUP ENTRY BY PROXIMITY TEST **/ @@ -277,7 +313,7 @@ class FileRegistryLookupEntryTestWMS : public wrench::WMS { std::shared_ptr file_registry_service, std::string hostname) : wrench::WMS(nullptr, nullptr, compute_services, storage_services, network_proximity_services, file_registry_service, hostname, "test") { - this->test = test; + this->test = test; } private: @@ -286,151 +322,151 @@ class FileRegistryLookupEntryTestWMS : public wrench::WMS { int main() { - wrench::WorkflowFile *file1 = this->getWorkflow()->addFile("file1", 100.0); - wrench::WorkflowFile * nullptr_file = nullptr; - auto frs = this->getAvailableFileRegistryService(); - auto nps = *(this->getAvailableNetworkProximityServices().begin()); - - frs->addEntry(file1, this->test->storage_service1); - frs->addEntry(file1, this->test->storage_service2); - frs->addEntry(file1, this->test->storage_service3); - - wrench::S4U_Simulation::sleep(600.0); - - - std::vector file1_expected_locations = {"Host4", "Host1", "Host2"}; - std::vector file1_locations(3); - std::map> file1_locations_by_proximity; - - try { - frs->lookupEntry(nullptr_file, "Host3", nps); - throw std::runtime_error("Should not be able to lookup a nullptr file"); - } catch (std::invalid_argument &e) { - } - - try { - file1_locations_by_proximity = frs->lookupEntry(file1, "Host3", nps); - } catch (std::exception &e) { - throw std::runtime_error("Should be able to lookup a file"); - } - - int count=0; - for (auto &storage_service : file1_locations_by_proximity) { - file1_locations[count++] = storage_service.second->getHostname(); - } - - bool is_equal = std::equal(file1_expected_locations.begin(), file1_expected_locations.end(), - file1_locations.begin()); - - if (!is_equal) { - throw std::runtime_error("lookupEntry using NetworkProximityService did not return Storage Services in ascending order of Network Proximity"); - } - - auto last_location = file1_locations_by_proximity.rbegin(); - if (last_location->second->getHostname() != "Host2") { - throw std::runtime_error( - "lookupEntry using NetworkProximityService did not return the correct unmonitored Storage Service"); - } else if (last_location->first != DBL_MAX) { - throw std::runtime_error( - "lookupEntry using NetworkProximityService did not include the unmonitored Storage Service"); - } - - - // Use a bogus host - try { - frs->lookupEntry(file1, "BogusHost", nps); - throw std::runtime_error("Should not be able to lookup a file by proximity with a bogus reference host"); - } catch (std::invalid_argument &e) { - } - - // shutdown service - frs->stop(); - - try { - frs->lookupEntry(file1); - throw std::runtime_error("Should not be able to lookup a file when the service is down"); - } catch (wrench::WorkflowExecutionException &e) { - // Check Exception - auto cause = std::dynamic_pointer_cast(e.getCause()); - if (not cause) { - throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + - e.getCause()->toString() + " (expected: ServiceIsDown)"); + wrench::WorkflowFile *file1 = this->getWorkflow()->addFile("file1", 100.0); + wrench::WorkflowFile * nullptr_file = nullptr; + auto frs = this->getAvailableFileRegistryService(); + auto nps = *(this->getAvailableNetworkProximityServices().begin()); + + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service1)); + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service2)); + frs->addEntry(file1, wrench::FileLocation::LOCATION(this->test->storage_service3)); + + wrench::S4U_Simulation::sleep(600.0); + + + std::vector file1_expected_locations = {"Host4", "Host1", "Host2"}; + std::vector file1_locations(3); + std::map> file1_locations_by_proximity; + + try { + frs->lookupEntry(nullptr_file, "Host3", nps); + throw std::runtime_error("Should not be able to lookup a nullptr file"); + } catch (std::invalid_argument &e) { + } + + try { + file1_locations_by_proximity = frs->lookupEntry(file1, "Host3", nps); + } catch (std::exception &e) { + throw std::runtime_error("Should be able to lookup a file"); + } + + int count=0; + for (auto &storage_service : file1_locations_by_proximity) { + file1_locations[count++] = storage_service.second->getStorageService()->getHostname(); + } + + bool is_equal = std::equal(file1_expected_locations.begin(), file1_expected_locations.end(), + file1_locations.begin()); + + if (!is_equal) { + throw std::runtime_error("lookupEntry using NetworkProximityService did not return Storage Services in ascending order of Network Proximity"); + } + + auto last_location = file1_locations_by_proximity.rbegin(); + if (last_location->second->getStorageService()->getHostname() != "Host2") { + throw std::runtime_error( + "lookupEntry using NetworkProximityService did not return the correct unmonitored Storage Service"); + } else if (last_location->first != DBL_MAX) { + throw std::runtime_error( + "lookupEntry using NetworkProximityService did not include the unmonitored Storage Service"); } - // Check Exception details - if (cause->getService() != frs) { - throw std::runtime_error( - "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + + + // Use a bogus host + try { + frs->lookupEntry(file1, "BogusHost", nps); + throw std::runtime_error("Should not be able to lookup a file by proximity with a bogus reference host"); + } catch (std::invalid_argument &e) { } - } - - try { - file1_locations_by_proximity = frs->lookupEntry(file1, "Host3", nps); - throw std::runtime_error("Should not be able to lookup a file when the service is down"); - } catch (wrench::WorkflowExecutionException &e) { - // Check Exception - auto cause = std::dynamic_pointer_cast(e.getCause()); - if (not cause) { - throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + - e.getCause()->toString() + " (expected: ServiceIsDown)"); + + // shutdown service + frs->stop(); + + try { + frs->lookupEntry(file1); + throw std::runtime_error("Should not be able to lookup a file when the service is down"); + } catch (wrench::WorkflowExecutionException &e) { + // Check Exception + auto cause = std::dynamic_pointer_cast(e.getCause()); + if (not cause) { + throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + + e.getCause()->toString() + " (expected: ServiceIsDown)"); + } + // Check Exception details + if (cause->getService() != frs) { + throw std::runtime_error( + "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + } } - // Check Exception details - if (cause->getService() != frs) { - throw std::runtime_error( - "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + + try { + file1_locations_by_proximity = frs->lookupEntry(file1, "Host3", nps); + throw std::runtime_error("Should not be able to lookup a file when the service is down"); + } catch (wrench::WorkflowExecutionException &e) { + // Check Exception + auto cause = std::dynamic_pointer_cast(e.getCause()); + if (not cause) { + throw std::runtime_error("Got an exception, as expected, but of the unexpected failure cause: " + + e.getCause()->toString() + " (expected: ServiceIsDown)"); + } + // Check Exception details + if (cause->getService() != frs) { + throw std::runtime_error( + "Got the expected 'service is down' exception, but the failure cause does not point to the correct service"); + } } - } - return 0; + return 0; } }; TEST_F(FileRegistryTest, LookupEntry) { - DO_TEST_WITH_FORK(do_lookupEntry_Test); + DO_TEST_WITH_FORK(do_lookupEntry_Test); } void FileRegistryTest::do_lookupEntry_Test() { - // Create and initialize a simulation - wrench::Simulation *simulation = new wrench::Simulation(); - int argc = 1; - char **argv = (char **) calloc(1, sizeof(char *)); - argv[0] = strdup("file_registry_lookup_entry_test"); + // Create and initialize a simulation + wrench::Simulation *simulation = new wrench::Simulation(); + int argc = 1; + char **argv = (char **) calloc(1, sizeof(char *)); + argv[0] = strdup("file_registry_lookup_entry_test"); - simulation->init(&argc, argv); + simulation->init(&argc, argv); - simulation->instantiatePlatform(platform_file_path); + simulation->instantiatePlatform(platform_file_path); - std::string host1 = simulation->getHostnameList()[0]; - std::string host2 = simulation->getHostnameList()[1]; - std::string host3 = simulation->getHostnameList()[2]; - std::string host4 = simulation->getHostnameList()[3]; + std::string host1 = simulation->getHostnameList()[0]; + std::string host2 = simulation->getHostnameList()[1]; + std::string host3 = simulation->getHostnameList()[2]; + std::string host4 = simulation->getHostnameList()[3]; - auto network_proximity_service = simulation->add(new wrench::NetworkProximityService(host1, {host1, host3, host4})); + auto network_proximity_service = simulation->add(new wrench::NetworkProximityService(host1, {host1, host3, host4})); - storage_service1 = simulation->add( - new wrench::SimpleStorageService(host1, 10000000000000.0)); + storage_service1 = simulation->add( + new wrench::SimpleStorageService(host1, {"/"})); - storage_service2 = simulation->add( - new wrench::SimpleStorageService(host2, 10000000000000.0)); + storage_service2 = simulation->add( + new wrench::SimpleStorageService(host2, {"/"})); - storage_service3 = simulation->add( - new wrench::SimpleStorageService(host4, 10000000000000.0)); + storage_service3 = simulation->add( + new wrench::SimpleStorageService(host4, {"/"})); - auto file_registry_service = simulation->add(new wrench::FileRegistryService(host1)); + auto file_registry_service = simulation->add(new wrench::FileRegistryService(host1)); - std::shared_ptr wms = nullptr;; - wms = simulation->add( - new FileRegistryLookupEntryTestWMS( - this, - {}, {storage_service1, storage_service2, storage_service3}, {network_proximity_service}, file_registry_service, host1)); + std::shared_ptr wms = nullptr;; + wms = simulation->add( + new FileRegistryLookupEntryTestWMS( + this, + {}, {storage_service1, storage_service2, storage_service3}, {network_proximity_service}, file_registry_service, host1)); - wms->addWorkflow(workflow); + wms->addWorkflow(workflow); - ASSERT_NO_THROW(simulation->launch()); + ASSERT_NO_THROW(simulation->launch()); - delete simulation; + delete simulation; - free(argv[0]); - free(argv); + free(argv[0]); + free(argv); } diff --git a/test/network_proximity_services/NetworkProximityTest.cpp b/test/network_proximity_services/NetworkProximityTest.cpp index 0926dd2157..fc9c9dae6f 100644 --- a/test/network_proximity_services/NetworkProximityTest.cpp +++ b/test/network_proximity_services/NetworkProximityTest.cpp @@ -55,10 +55,46 @@ class NetworkProximityTest : public ::testing::Test { "" " " " " - " " - " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -187,14 +223,14 @@ void NetworkProximityTest::do_NetworkProximity_Test() { {}))); // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a file registry service auto file_registry_service = simulation->add( new wrench::FileRegistryService(hostname)); // 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))); // Get a host for network proximity host std::string network_proximity_db_hostname = simulation->getHostnameList()[1]; @@ -391,14 +427,15 @@ void NetworkProximityTest::do_CompareNetworkProximity_Test() { // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); simulation->add(new wrench::FileRegistryService(hostname)); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFiles({std::make_pair(input_file->getID(), input_file)}, storage_service1)); + ASSERT_NO_THROW(simulation->stageFile(input_file, + wrench::FileLocation::LOCATION(storage_service1))); // Get a host for network proximity host std::string network_proximity_db_hostname = simulation->getHostnameList()[1]; @@ -563,7 +600,7 @@ void NetworkProximityTest::do_VivaldiConverge_Test() { {}))); // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); @@ -571,7 +608,7 @@ void NetworkProximityTest::do_VivaldiConverge_Test() { simulation->add(new wrench::FileRegistryService(hostname)); // 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))); // Get a host for network proximity host std::string network_proximity_db_hostname = simulation->getHostnameList()[1]; @@ -668,13 +705,13 @@ void NetworkProximityTest::do_ValidateProperties_Test() { {}))); // Create a Storage Service ASSERT_NO_THROW(storage_service1 = simulation->add( - new wrench::SimpleStorageService(hostname, 10000000000000.0))); + new wrench::SimpleStorageService(hostname, {"/"}))); // Create a file registry service simulation->add(new wrench::FileRegistryService(hostname)); // 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))); // Get a host for network proximity host std::string network_proximity_db_hostname = simulation->getHostnameList()[1]; diff --git a/test/simulation/DynamicServiceCreationTest.cpp b/test/simulation/DynamicServiceCreationTest.cpp index ace53d41d2..acd528fdf3 100644 --- a/test/simulation/DynamicServiceCreationTest.cpp +++ b/test/simulation/DynamicServiceCreationTest.cpp @@ -86,8 +86,26 @@ class DynamicServiceCreationTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -136,7 +154,7 @@ class DynamicServiceCreationReadyTasksTestWMS : public wrench::WMS { // Dynamically create a Storage Service on this host auto dynamically_created_storage_service = simulation->startNewService( - new wrench::SimpleStorageService(hostname, 100.0, + new wrench::SimpleStorageService(hostname, {"/"}, {}, {{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, 123}})); @@ -144,7 +162,7 @@ class DynamicServiceCreationReadyTasksTestWMS : public wrench::WMS { // Dynamically create a Cloud Service std::vector execution_hosts = {"QuadCoreHost"}; auto dynamically_created_compute_service = std::dynamic_pointer_cast(simulation->startNewService( - new wrench::CloudComputeService(hostname, execution_hosts, 100.0, + new wrench::CloudComputeService(hostname, execution_hosts, "/scratch", { {wrench::BareMetalComputeServiceProperty::SUPPORTS_PILOT_JOBS, "false"}}))); std::vector tasks = this->test->workflow->getReadyTasks(); @@ -157,8 +175,14 @@ class DynamicServiceCreationReadyTasksTestWMS : public wrench::WMS { int job_index = 0; for (auto task : tasks) { try { - one_task_jobs[job_index] = job_manager->createStandardJob({task}, {{this->test->input_file, this->test->storage_service}}, - {}, {std::make_tuple(this->test->input_file, this->test->storage_service, dynamically_created_storage_service)}, {}); + one_task_jobs[job_index] = job_manager->createStandardJob( + {task}, + {{this->test->input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}}, + {}, + {std::make_tuple(this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service), + wrench::FileLocation::LOCATION(dynamically_created_storage_service))}, + {}); if (one_task_jobs[job_index]->getNumTasks() != 1) { throw std::runtime_error("A one-task job should say it has one task"); @@ -239,7 +263,7 @@ void DynamicServiceCreationTest::do_getReadyTasksTest_test() { // Create a Storage Service storage_service = simulation->add( - new wrench::SimpleStorageService(hostname, 100.0, + new wrench::SimpleStorageService(hostname, {"/"}, {}, {{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, 123}})); @@ -263,7 +287,7 @@ void DynamicServiceCreationTest::do_getReadyTasksTest_test() { ASSERT_NO_THROW(simulation->add(new wrench::FileRegistryService(hostname))); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(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()); diff --git a/test/simulation/SimpleSimulationTest.cpp b/test/simulation/SimpleSimulationTest.cpp index 4694b276f3..481555685a 100644 --- a/test/simulation/SimpleSimulationTest.cpp +++ b/test/simulation/SimpleSimulationTest.cpp @@ -87,8 +87,26 @@ class SimpleSimulationTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -192,7 +210,8 @@ class SimpleSimulationReadyTasksTestWMS : public wrench::WMS { int job_index = 0; for (auto task : tasks) { try { - one_task_jobs[job_index] = job_manager->createStandardJob({task}, {{this->test->input_file, this->test->storage_service}}, + one_task_jobs[job_index] = job_manager->createStandardJob({task}, {{this->test->input_file, + wrench::FileLocation::LOCATION(this->test->storage_service)}}, {}, {}, {}); if (one_task_jobs[job_index]->getNumTasks() != 1) { @@ -319,9 +338,9 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() { // Adding services to an uninitialized simulation std::vector hosts = {"DualCoreHost", "QuadCoreHost"}; ASSERT_THROW(simulation->add( - new wrench::CloudComputeService("DualCoreHost", hosts, 100.0)), std::runtime_error); + new wrench::CloudComputeService("DualCoreHost", hosts, "/scratch")), std::runtime_error); ASSERT_THROW(simulation->add( - new wrench::SimpleStorageService("DualCoreHost", 100.0)), std::runtime_error); + new wrench::SimpleStorageService("DualCoreHost", {"/"})), std::runtime_error); ASSERT_THROW(simulation->add( new wrench::NetworkProximityService("DualCoreHost", hosts)), std::runtime_error); ASSERT_THROW(simulation->add( @@ -337,10 +356,10 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() { // Create a Storage Service ASSERT_THROW(storage_service = simulation->add( - new wrench::SimpleStorageService(hostname, 100.0, {}, + new wrench::SimpleStorageService(hostname, {"/"}, {}, {{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, -1}})), std::invalid_argument); storage_service = simulation->add( - new wrench::SimpleStorageService(hostname, 100.0, {}, + new wrench::SimpleStorageService(hostname, {"/"}, {}, {{wrench::SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD, 123}})); @@ -357,7 +376,7 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() { // Create a Cloud Service std::vector execution_hosts = {"QuadCoreHost"}; ASSERT_NO_THROW(compute_service = simulation->add( - new wrench::CloudComputeService(hostname, execution_hosts, 100.0, + new wrench::CloudComputeService(hostname, execution_hosts, "/scratch", { {wrench::BareMetalComputeServiceProperty::SUPPORTS_PILOT_JOBS, "false"}, {wrench::BareMetalComputeServiceProperty::THREAD_STARTUP_OVERHEAD, "0"} }))); @@ -393,7 +412,7 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() { // Try to stage a file without a file registry - ASSERT_THROW(simulation->stageFile(input_file, storage_service), std::runtime_error); + ASSERT_THROW(simulation->stageFile(input_file, wrench::FileLocation::LOCATION(storage_service)), std::runtime_error); // Create a file registry std::shared_ptr file_registry_service; @@ -404,10 +423,10 @@ void SimpleSimulationTest::do_getReadyTasksTest_test() { file_registry_service->getNetworkTimeoutValue(); // Staging an invalid file on the storage service - ASSERT_THROW(simulation->stageFile(output_file1, storage_service), std::runtime_error); + ASSERT_THROW(simulation->stageFile(output_file1, wrench::FileLocation::LOCATION(storage_service)), std::runtime_error); // Staging the input_file on the storage service - ASSERT_NO_THROW(simulation->stageFile(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()); diff --git a/test/simulation/simulation_output/SimulationTimestampFileCopyTest.cpp b/test/simulation/simulation_output/SimulationTimestampFileCopyTest.cpp index 5681b262fe..0787379473 100644 --- a/test/simulation/simulation_output/SimulationTimestampFileCopyTest.cpp +++ b/test/simulation/simulation_output/SimulationTimestampFileCopyTest.cpp @@ -30,8 +30,26 @@ class SimulationTimestampFileCopyTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -75,19 +93,30 @@ class SimulationTimestampFileCopyBasicTestWMS : public wrench::WMS { auto dmm = this->createDataMovementManager(); // regular copy with successful completion - this->test->destination_storage_service->copyFile(this->test->file_1, this->test->source_storage_service); + dmm->doSynchronousFileCopy(this->test->file_1, + wrench::FileLocation::LOCATION(this->test->source_storage_service), + wrench::FileLocation::LOCATION(this->test->destination_storage_service)); - dmm->initiateAsynchronousFileCopy(this->test->xl_file, this->test->source_storage_service, this->test->destination_storage_service); - dmm->doSynchronousFileCopy(this->test->file_2, this->test->source_storage_service, this->test->destination_storage_service); + dmm->initiateAsynchronousFileCopy(this->test->xl_file, + wrench::FileLocation::LOCATION(this->test->source_storage_service), + wrench::FileLocation::LOCATION(this->test->destination_storage_service)); - this->test->destination_storage_service->copyFile(this->test->file_3, this->test->source_storage_service); - this->test->destination_storage_service->copyFile(this->test->file_3, this->test->source_storage_service); + dmm->doSynchronousFileCopy(this->test->file_2, + wrench::FileLocation::LOCATION(this->test->source_storage_service), + wrench::FileLocation::LOCATION(this->test->destination_storage_service)); + + dmm->doSynchronousFileCopy(this->test->file_3, + wrench::FileLocation::LOCATION(this->test->source_storage_service), + wrench::FileLocation::LOCATION(this->test->destination_storage_service)); bool failed = false; // this should fail and a SimulationTimestampFileCopyFailure should be created try { - this->test->destination_storage_service->copyFile(this->test->too_large_file, this->test->source_storage_service); + dmm->doSynchronousFileCopy(this->test->too_large_file, + wrench::FileLocation::LOCATION(this->test->source_storage_service), + wrench::FileLocation::LOCATION(this->test->destination_storage_service)); + } catch(wrench::WorkflowExecutionException &e) { failed = true; } @@ -132,8 +161,8 @@ void SimulationTimestampFileCopyTest::do_SimulationTimestampFileCopyBasic_test() ASSERT_NO_THROW(simulation->instantiatePlatform(platform_file_path)); - std::string host1 = simulation->getHostnameList()[0]; - std::string host2 = simulation->getHostnameList()[1]; + std::string host1 = "Host1"; + std::string host2 = "Host2"; ASSERT_NO_THROW(compute_service = simulation->add(new wrench::BareMetalComputeService(host1, {std::make_pair( @@ -142,8 +171,8 @@ void SimulationTimestampFileCopyTest::do_SimulationTimestampFileCopyBasic_test() wrench::ComputeService::ALL_RAM))}, {}))); - ASSERT_NO_THROW(source_storage_service = simulation->add(new wrench::SimpleStorageService(host1, 100000000000000000000.0))); - ASSERT_NO_THROW(destination_storage_service = simulation->add(new wrench::SimpleStorageService(host2, 10000000000))); + ASSERT_NO_THROW(source_storage_service = simulation->add(new wrench::SimpleStorageService(host1, {"/"}))); + ASSERT_NO_THROW(destination_storage_service = simulation->add(new wrench::SimpleStorageService(host2, {"/"}))); std::shared_ptr file_registry_service = nullptr; ASSERT_NO_THROW(file_registry_service = simulation->add(new wrench::FileRegistryService(host1))); @@ -156,13 +185,11 @@ void SimulationTimestampFileCopyTest::do_SimulationTimestampFileCopyBasic_test() ASSERT_NO_THROW(wms->addWorkflow(workflow.get())); //stage files - std::map files_to_stage = {std::make_pair(file_1->getID(), file_1), - std::make_pair(file_2->getID(), file_2), - std::make_pair(file_3->getID(), file_3), - std::make_pair(xl_file->getID(), xl_file), - std::make_pair(too_large_file->getID(), too_large_file)}; + std::set files_to_stage = {file_1, file_2, file_3, xl_file, too_large_file}; - ASSERT_NO_THROW(simulation->stageFiles(files_to_stage, source_storage_service)); + for (auto const &f : files_to_stage) { + ASSERT_NO_THROW(simulation->stageFile(f, wrench::FileLocation::LOCATION(source_storage_service))); + } ASSERT_NO_THROW(simulation->launch()); @@ -217,26 +244,45 @@ void SimulationTimestampFileCopyTest::do_SimulationTimestampFileCopyBasic_test() ASSERT_GT(fc.second->getDate(), fc.first->getDate()); // source and destinations should be set - ASSERT_EQ(this->source_storage_service, fc.first->getSource().storage_service); - ASSERT_EQ("/", fc.first->getSource().partition); - ASSERT_EQ(this->destination_storage_service, fc.first->getDestination().storage_service); - ASSERT_EQ("/", fc.first->getDestination().partition); + ASSERT_EQ(this->source_storage_service, fc.first->getSource()->getStorageService()); + ASSERT_EQ("/", fc.first->getSource()->getAbsolutePathAtMountPoint()); + ASSERT_EQ(this->destination_storage_service, fc.first->getDestination()->getStorageService()); + ASSERT_EQ("/", fc.first->getDestination()->getAbsolutePathAtMountPoint()); - ASSERT_EQ(this->source_storage_service, fc.second->getSource().storage_service); - ASSERT_EQ("/", fc.second->getSource().partition); - ASSERT_EQ(this->destination_storage_service, fc.second->getDestination().storage_service); - ASSERT_EQ("/", fc.second->getDestination().partition); + ASSERT_EQ(this->source_storage_service, fc.second->getSource()->getStorageService()); + ASSERT_EQ("/", fc.second->getSource()->getAbsolutePathAtMountPoint()); + ASSERT_EQ(this->destination_storage_service, fc.second->getDestination()->getStorageService()); + ASSERT_EQ("/", fc.second->getDestination()->getAbsolutePathAtMountPoint()); // file should be set ASSERT_EQ(fc.first->getFile(), fc.second->getFile()); } // test constructors for invalid arguments - ASSERT_THROW(wrench::SimulationTimestampFileCopyStart(nullptr, this->source_storage_service, "/", this->destination_storage_service, "/"), std::invalid_argument); - ASSERT_THROW(wrench::SimulationTimestampFileCopyStart(this->file_1, nullptr, "/", this->destination_storage_service, "/"), std::invalid_argument); - ASSERT_THROW(wrench::SimulationTimestampFileCopyStart(this->file_1, this->source_storage_service, "", this->destination_storage_service, "/"), std::invalid_argument); - ASSERT_THROW(wrench::SimulationTimestampFileCopyStart(this->file_1, this->source_storage_service, "", nullptr, "/"), std::invalid_argument); - ASSERT_THROW(wrench::SimulationTimestampFileCopyStart(this->file_1, this->source_storage_service, "", this->destination_storage_service, ""), std::invalid_argument); + ASSERT_THROW(wrench::SimulationTimestampFileCopyStart( + nullptr, + wrench::FileLocation::LOCATION(this->source_storage_service), + wrench::FileLocation::LOCATION(this->destination_storage_service)), std::invalid_argument); + + ASSERT_THROW(wrench::SimulationTimestampFileCopyStart( + this->file_1, + nullptr, + wrench::FileLocation::LOCATION(this->destination_storage_service, "/")), std::invalid_argument); + + ASSERT_THROW(wrench::SimulationTimestampFileCopyStart( + this->file_1, + wrench::FileLocation::LOCATION(this->source_storage_service), + wrench::FileLocation::LOCATION(this->destination_storage_service, "/")), std::invalid_argument); + + ASSERT_THROW(wrench::SimulationTimestampFileCopyStart( + this->file_1, + wrench::FileLocation::LOCATION(this->source_storage_service), + nullptr), std::invalid_argument); + + ASSERT_THROW(wrench::SimulationTimestampFileCopyStart( + this->file_1, + wrench::FileLocation::LOCATION(this->source_storage_service), + wrench::FileLocation::LOCATION(this->destination_storage_service)), std::invalid_argument); ASSERT_THROW(wrench::SimulationTimestampFileCopyFailure(nullptr), std::invalid_argument); ASSERT_THROW(wrench::SimulationTimestampFileCopyCompletion(nullptr), std::invalid_argument); diff --git a/test/simulation/simulation_output/SimulationTimestampTaskTest.cpp b/test/simulation/simulation_output/SimulationTimestampTaskTest.cpp index 2e5f4bcef5..7e63e5f4c9 100644 --- a/test/simulation/simulation_output/SimulationTimestampTaskTest.cpp +++ b/test/simulation/simulation_output/SimulationTimestampTaskTest.cpp @@ -36,8 +36,26 @@ class SimulationTimestampTaskTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -95,10 +113,15 @@ class SimulationTimestampTaskBasicTestWMS : public wrench::WMS { this->test->failed_task->addInputFile(this->test->large_input_file); this->test->failed_task->addInputFile(this->test->small_input_file); - wrench::StandardJob *failed_job = job_manager->createStandardJob(this->test->failed_task, {{this->test->small_input_file, this->test->storage_service}, - {this->test->large_input_file, this->test->storage_service}}); + wrench::StandardJob *failed_job = job_manager->createStandardJob( + this->test->failed_task, + {{this->test->small_input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}, + {this->test->large_input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}}); job_manager->submitJob(failed_job, this->test->compute_service); - this->test->storage_service->deleteFile(this->getWorkflow()->getFileByID("small_input_file"), this->test->file_registry_service); + + wrench::StorageService::deleteFile(this->getWorkflow()->getFileByID("small_input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service), + this->test->file_registry_service); std::shared_ptr workflow_execution_event; try { @@ -139,7 +162,7 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskBasic_test(){ wrench::ComputeService::ALL_RAM))}, {}))); - ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, 100000000000000.0))); + ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"}))); std::shared_ptr wms = nullptr;; ASSERT_NO_THROW(wms = simulation->add(new SimulationTimestampTaskBasicTestWMS( @@ -153,9 +176,8 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskBasic_test(){ small_input_file = this->workflow->addFile("small_input_file", 10); large_input_file = this->workflow->addFile("large_input_file", 1000000); - ASSERT_NO_THROW(simulation->stageFiles({{large_input_file->getID(), large_input_file}, - {small_input_file->getID(), small_input_file}}, - storage_service)); + ASSERT_NO_THROW(simulation->stageFile(large_input_file, wrench::FileLocation::LOCATION(storage_service))); + ASSERT_NO_THROW(simulation->stageFile(small_input_file, wrench::FileLocation::LOCATION(storage_service))); ASSERT_NO_THROW(simulation->launch()); @@ -277,15 +299,20 @@ class SimulationTimestampTaskMultipleTestWMS : public wrench::WMS { this->test->failed_task->addInputFile(this->test->large_input_file); this->test->failed_task->addInputFile(this->test->small_input_file); - wrench::StandardJob *failed_job = job_manager->createStandardJob(this->test->failed_task, {{this->test->small_input_file, this->test->storage_service}, - {this->test->large_input_file, this->test->storage_service}}); + wrench::StandardJob *failed_job = job_manager->createStandardJob( + this->test->failed_task, + {{this->test->small_input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}, + {this->test->large_input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}}); job_manager->submitJob(failed_job, this->test->compute_service); - this->test->storage_service->deleteFile(this->getWorkflow()->getFileByID("small_input_file"), this->test->file_registry_service); + wrench::StorageService::deleteFile(this->getWorkflow()->getFileByID("small_input_file"), + wrench::FileLocation::LOCATION(this->test->storage_service)); this->waitForAndProcessNextEvent(); - wrench::StandardJob *passing_job = job_manager->createStandardJob(this->test->failed_task, {{this->test->small_input_file, this->test->backup_storage_service}, - {this->test->large_input_file, this->test->storage_service}}); + wrench::StandardJob *passing_job = job_manager->createStandardJob( + this->test->failed_task, + {{this->test->small_input_file, wrench::FileLocation::LOCATION(this->test->backup_storage_service)}, + {this->test->large_input_file, wrench::FileLocation::LOCATION(this->test->storage_service)}}); job_manager->submitJob(passing_job, this->test->compute_service); this->waitForAndProcessNextEvent(); @@ -318,8 +345,8 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() { wrench::ComputeService::ALL_RAM))}, {}))); - ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, 100000000000000.0))); - ASSERT_NO_THROW(backup_storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, 100000000000000.0))); + ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"}))); + ASSERT_NO_THROW(backup_storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"}))); std::shared_ptr wms = nullptr;; @@ -334,11 +361,9 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() { small_input_file = this->workflow->addFile("small_input_file", 10); large_input_file = this->workflow->addFile("large_input_file", 1000000); - ASSERT_NO_THROW(simulation->stageFiles({{large_input_file->getID(), large_input_file}, - {small_input_file->getID(), small_input_file}}, - storage_service)); - - ASSERT_NO_THROW(simulation->stageFiles({{small_input_file->getID(), small_input_file}}, backup_storage_service)); + ASSERT_NO_THROW(simulation->stageFile(large_input_file, wrench::FileLocation::LOCATION(storage_service))); + ASSERT_NO_THROW(simulation->stageFile(small_input_file, wrench::FileLocation::LOCATION(storage_service))); + ASSERT_NO_THROW(simulation->stageFile(small_input_file, wrench::FileLocation::LOCATION(backup_storage_service))); ASSERT_NO_THROW(simulation->launch()); @@ -511,7 +536,7 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskTerminateAndFail_tes wrench::ComputeService::ALL_RAM))}, {}))); - ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, 100000000000000.0))); + ASSERT_NO_THROW(storage_service = simulation->add(new wrench::SimpleStorageService(wms_host, {"/"}))); std::shared_ptr wms = nullptr;; ASSERT_NO_THROW(wms = simulation->add(new SimulationTimestampTaskTerminateAndFailTestWMS( diff --git a/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp b/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp index 414f7af06c..a9865098ca 100644 --- a/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp +++ b/test/storage_services/SimpleStorageService/SimpleStorageServiceFunctionalTest.cpp @@ -949,11 +949,11 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM // Do the file copy for a file that's not there // First delete the file (we used to have an "already there" error) - wrench::StorageService::deleteFile(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000); + wrench::StorageService::deleteFile(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_1000)); try { data_movement_manager->doSynchronousFileCopy(this->test->file_500, - wrench::FileLocation::LOCATION(this->test->storage_service_510), + wrench::FileLocation::LOCATION(this->test->storage_service_510), wrench::FileLocation::LOCATION(this->test->storage_service_1000)); throw std::runtime_error("Should have gotten a 'file not found' exception"); } catch (wrench::WorkflowExecutionException &e) { @@ -1001,7 +1001,8 @@ class SimpleStorageServiceSynchronousFileCopyFailuresTestWMS : public wrench::WM this->test->storage_service_510->stop(); 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), wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should have gotten a 'service is down' exception"); } catch (wrench::WorkflowExecutionException &e) { @@ -1076,7 +1077,7 @@ void SimpleStorageServiceFunctionalTest::do_SynchronousFileCopyFailures_test() { simulation->add(new wrench::FileRegistryService(hostname)); // Staging file_500 on the 1000-byte storage service - ASSERT_NO_THROW(simulation->stageFile(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()); @@ -1116,8 +1117,9 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W // Do the file copy while space doesn't fit try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, this->test->storage_service_1000, - this->test->storage_service_100); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_500, + wrench::FileLocation::LOCATION(this->test->storage_service_1000), + wrench::FileLocation::LOCATION(this->test->storage_service_100)); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1153,8 +1155,9 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W // Do the file copy for a file that's not there try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_100, this->test->storage_service_1000, - this->test->storage_service_100); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_100, + wrench::FileLocation::LOCATION(this->test->storage_service_1000), + wrench::FileLocation::LOCATION(this->test->storage_service_100)); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1177,7 +1180,7 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W throw std::runtime_error( "Got the expected exception and failure type, but the failure cause doesn't point to the right file"); } - if (cause->getStorageService() != this->test->storage_service_1000) { + if (cause->getLocation()->getStorageService() != this->test->storage_service_1000) { throw std::runtime_error( "Got the expected exception and failure type, but the failure cause doesn't point to the right storage service"); } @@ -1189,7 +1192,8 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W this->test->storage_service_1000->stop(); try { - data_movement_manager->initiateAsynchronousFileCopy(this->test->file_100, this->test->storage_service_1000, + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_100, + 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 unexpected exception"); @@ -1221,7 +1225,8 @@ class SimpleStorageServiceAsynchronousFileCopyFailuresTestWMS : public wrench::W this->test->storage_service_510->stop(); 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), wrench::FileLocation::LOCATION(this->test->storage_service_510)); throw std::runtime_error("Should have gotten a 'service is down' exception"); } catch (wrench::WorkflowExecutionException &e) { @@ -1334,8 +1339,9 @@ 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, "/", - wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo"); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, + wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/dist1000"), + wrench::FileLocation::LOCATION(this->test->storage_service_510, "foo")); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1405,8 +1411,9 @@ 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, wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo", - this->test->storage_service_1000, "foo"); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, + wrench::FileLocation::LOCATION(this->test->storage_service_510, "/disk510/foo"), + wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/disk1000/foo")); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1425,8 +1432,9 @@ 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, wrench::FileLocation::LOCATION(this->test->storage_service_510), "foo", - wrench::FileLocation::LOCATION(this->test->storage_service_510), "bar"); + data_movement_manager->initiateAsynchronousFileCopy(this->test->file_10, + wrench::FileLocation::LOCATION(this->test->storage_service_510, "/disk510/foo"), + wrench::FileLocation::LOCATION(this->test->storage_service_510, "/disk510/bar")); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1444,8 +1452,9 @@ 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, - wrench::FileLocation::LOCATION(this->test->storage_service_510, "/large_disk/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) { @@ -1458,7 +1467,7 @@ class PartitionsTestWMS : public wrench::WMS { 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 wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(wrench::FileLocation::LOCATION(this->test->storage_service_510), "/large_disk/foo"))) { + 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 wrench::StorageService::lookupFile(this->test->file_10, wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/large_disk/foo"))) { @@ -1468,21 +1477,22 @@ class PartitionsTestWMS : public wrench::WMS { // Bogus lookup try { - this->test->storage_service_1000->lookupFile(nullptr); + wrench::StorageService::lookupFile(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service_1000)); throw std::runtime_error("Should not be able to lookup a nullptr file"); } catch (std::invalid_argument &e) { } try { - this->test->storage_service_1000->lookupFile(nullptr, "/"); + wrench::StorageService::lookupFile(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service_1000, "/")); throw std::runtime_error("Should not be able to lookup a nullptr file"); } catch (std::invalid_argument &e) { } // File copy from oneself to oneself! try { - 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, "/faa"); + 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, "/faa")); } catch (wrench::WorkflowExecutionException &e) { throw std::runtime_error("Got an unexpected exception"); } @@ -1543,7 +1553,7 @@ void SimpleStorageServiceFunctionalTest::do_Partitions_test() { simulation->add(new wrench::FileRegistryService(hostname)); // Staging file_500 on the 1000-byte storage service - ASSERT_NO_THROW(simulation->stageFiles({{file_10->getID(), file_10}}, storage_service_1000)); + ASSERT_NO_THROW(simulation->stageFile(file_10, wrench::FileLocation::LOCATION(storage_service_1000))); // Running a "run a single task" simulation ASSERT_NO_THROW(simulation->launch()); @@ -1585,13 +1595,13 @@ class FileWriteTestWMS : public wrench::WMS { auto file_registry_service = this->getAvailableFileRegistryService(); try { - this->test->storage_service_100->writeFile(nullptr, "/"); + wrench::StorageService::writeFile(nullptr, wrench::FileLocation::LOCATION(this->test->storage_service_100, "/")); throw std::runtime_error("Should not be able to write a nullptr file to a service"); } catch (std::invalid_argument &e) { } try { - this->test->storage_service_100->writeFile(this->test->file_500); + wrench::StorageService::writeFile(this->test->file_500, wrench::FileLocation::LOCATION(this->test->storage_service_100, "/")); throw std::runtime_error("Should not be able to write to a storage service with not enough space"); } catch (wrench::WorkflowExecutionException &e) { auto cause = std::dynamic_pointer_cast(e.getCause()); @@ -1609,24 +1619,6 @@ class FileWriteTestWMS : public wrench::WMS { } } - try { - this->test->storage_service_100->writeFile(this->test->file_500, ""); - throw std::runtime_error("Should not be able to write to a storage service with not enough space"); - } catch (wrench::WorkflowExecutionException &e) { - auto cause = std::dynamic_pointer_cast(e.getCause()); - if (not cause) { - throw std::runtime_error("Got an expected exception but unexpected cause type: " + - e.getCause()->toString() + " (expected: StorageServiceNotEnoughSpace"); - } - if (cause->getStorageService() != this->test->storage_service_100) { - throw std::runtime_error( - "Got the expected 'not enough space' exception, but the failure cause does not point to the correct storage service"); - } - if (cause->getFile() != this->test->file_500) { - throw std::runtime_error( - "Got the expected 'not enough space' exception, but the failure cause does not point to the correct file"); - } - } return 0; } diff --git a/test/wms/JobManagerTest.cpp b/test/wms/JobManagerTest.cpp index 08d3bcca06..b7c06b863e 100644 --- a/test/wms/JobManagerTest.cpp +++ b/test/wms/JobManagerTest.cpp @@ -50,9 +50,35 @@ class JobManagerTest : public ::testing::Test { "" " " " " - " " - " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -470,13 +496,15 @@ void JobManagerTest::do_JobManagerResubmitJobTest_test() { ASSERT_NO_THROW(cs1 = simulation->add( new wrench::BareMetalComputeService("Host2", - {std::make_pair("Host2", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair("Host2", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + "/scratch", {{wrench::ComputeServiceProperty::SUPPORTS_STANDARD_JOBS, "false"}}))); // Create a ComputeService that does support standard jobs ASSERT_NO_THROW(cs2 = simulation->add( new wrench::BareMetalComputeService("Host3", - {std::make_pair("Host3", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair("Host3", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + "/scratch", {{wrench::ComputeServiceProperty::SUPPORTS_STANDARD_JOBS, "true"}}))); // Create a WMS @@ -619,7 +647,8 @@ void JobManagerTest::do_JobManagerTerminateJobTest_test() { std::shared_ptr cs = nullptr; ASSERT_NO_THROW(cs = simulation->add( new wrench::BareMetalComputeService("Host3", - {std::make_pair("Host3", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))},100.0, + {std::make_pair("Host3", std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, + "/scratch", {{wrench::ComputeServiceProperty::SUPPORTS_STANDARD_JOBS, "true"}}))); // Create a WMS