diff --git a/include/wrench/services/storage/StorageService.h b/include/wrench/services/storage/StorageService.h index 96979c1edc..411f4d2873 100755 --- a/include/wrench/services/storage/StorageService.h +++ b/include/wrench/services/storage/StorageService.h @@ -62,7 +62,7 @@ namespace wrench { * @return true if the file is present, or false */ bool lookupFile(const std::shared_ptr &file) { - return this->lookupFile(file, "/"); + return this->lookupFile(wrench::FileLocation::LOCATION(this->getSharedPtr(), file)); } /** * @brief Lookup whether a file exists on the storage service (incurs simulated overheads) @@ -100,7 +100,7 @@ namespace wrench { * @param file a file */ void deleteFile(const std::shared_ptr &file) { - this->deleteFile(file, "/"); + this->deleteFile(wrench::FileLocation::LOCATION(this->getSharedPtr(), file)); } /** * @brief Delete a file at the storage service (incurs simulated overheads) @@ -243,7 +243,7 @@ namespace wrench { * @return true if the file is present, false otherwise */ bool hasFile(const std::shared_ptr &file) { - return this->hasFile(file, "/"); + return this->hasFile(wrench::FileLocation::LOCATION(this->getSharedPtr(), file)); } /** * @brief Determines whether a file is present at the storage service (in zero simulated time) @@ -329,7 +329,7 @@ namespace wrench { * @param file: a file */ void removeFile(const std::shared_ptr &file) { - this->removeFile(file, "/"); + this->removeFile(wrench::FileLocation::LOCATION(this->getSharedPtr(), file)); } /** * @brief Remove a file at the storage service (in zero simulated time) @@ -370,7 +370,7 @@ namespace wrench { * @return a date in seconds */ double getFileLastWriteDate(const std::shared_ptr &file) { - return this->getFileLastWriteDate(file, "/"); + return this->getFileLastWriteDate(wrench::FileLocation::LOCATION(this->getSharedPtr(), file)); } /** * @brief Get a file's last write date at the storage service (in zero simulated time) @@ -442,7 +442,7 @@ namespace wrench { * @return a path */ virtual std::string getBaseRootPath() { - return "/"; + throw std::runtime_error("StorageService::traceTotalFiles: should have been overridden by derived class"); } /** diff --git a/src/wrench/services/storage/simple/SimpleStorageService.cpp b/src/wrench/services/storage/simple/SimpleStorageService.cpp index 0a6ac1203b..ab231d13b8 100644 --- a/src/wrench/services/storage/simple/SimpleStorageService.cpp +++ b/src/wrench/services/storage/simple/SimpleStorageService.cpp @@ -190,6 +190,7 @@ namespace wrench { const std::shared_ptr &location, S4U_CommPort *answer_commport) { + std::cerr << "LOOKING FOR FILE: " << location->getFilePath() << "\n"; bool file_found = this->file_system->file_exists(location->getFilePath()); answer_commport->dputMessage( @@ -457,7 +458,6 @@ namespace wrench { void SimpleStorageService::createFile(const std::shared_ptr &location) { std::string full_path = location->getFilePath(); - std::cerr << "IN CREATE FILE SIMPLeSTORAGESERVOCE: " << full_path << "\n"; try { this->file_system->create_file(full_path, location->getFile()->getSize()); } catch (sgfs::FileAlreadyExistsException &e) { @@ -543,8 +543,6 @@ namespace wrench { return std::shared_ptr(new InvalidDirectoryPath(location)); } - std::cerr << "IN VALIDATE FILE WRITE 1: " << partition->get_free_space() << "\n"; - bool file_already_there = this->file_system->file_exists(location->getFilePath()); try { if (not file_already_there) { // Open dot file @@ -571,8 +569,6 @@ namespace wrench { new StorageServiceNotEnoughSpace( file, this->getSharedPtr())); - } catch (simgrid::Exception &e) { - std::cerr << "WRTF!@#!" << e.what() << "\n"; } // std::cerr << "IN VALIDATE FILE WRITE 2: " << partition->get_free_space() << "\n"; return nullptr; @@ -618,12 +614,12 @@ namespace wrench { if (not dst_file_already_there) { // Open dot file // std::cerr << "FILE NOT ALREADY THERE, OPENING A DOT FILE \n"; std::string dot_file_path = dst_location->getADotFilePath(); - this->file_system->create_file(dot_file_path, dst_location->getFile()->getSize()); - dst_opened_file = this->file_system->open(dot_file_path, "r+"); + dst_file_system->create_file(dot_file_path, dst_location->getFile()->getSize()); + dst_opened_file = dst_file_system->open(dot_file_path, "r+"); dst_opened_file->seek(0, SEEK_SET); } else { // Open the file // std::cerr << "FILE ALREADY THERE, JUST OPENING IT\n"; - dst_opened_file = this->file_system->open(dst_location->getFilePath(), "r+"); + dst_opened_file = dst_file_system->open(dst_location->getFilePath(), "r+"); dst_opened_file->seek(0, SEEK_SET); } } catch (simgrid::fsmod::NotEnoughSpaceException &e) { @@ -632,7 +628,7 @@ namespace wrench { } // Open source file - src_opened_file = this->file_system->open(src_location->getFilePath(), "r"); + src_opened_file = src_file_system->open(src_location->getFilePath(), "r"); return nullptr; } diff --git a/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp b/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp index 611e63d279..cc388a6a33 100644 --- a/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp +++ b/src/wrench/services/storage/simple/SimpleStorageServiceBufferized.cpp @@ -194,9 +194,7 @@ namespace wrench { std::shared_ptr opened_file; - std::cerr << "BEFORE VALIDATION\n"; auto failure_cause = validateFileWriteRequest(location, num_bytes_to_write, opened_file); - std::cerr << "AFTER VALIDATION: " << this->file_system->get_partitions().at(0)->get_free_space() << "\n"; if (failure_cause) { @@ -337,6 +335,8 @@ namespace wrench { std::shared_ptr &dst_location, S4U_CommPort *answer_commport) { + std::cerr << "IN BUFFERED PROCESS FILE COPY REQUEST\n"; + std::shared_ptr src_opened_file; std::shared_ptr dst_opened_file; auto failure_cause = validateFileCopyRequest(src_location, dst_location, src_opened_file, dst_opened_file); @@ -455,7 +455,6 @@ namespace wrench { } // Deal with possibly opened destination file if (ftt->dst_opened_file) { - std::cerr << "THERE WAS AN OPENED DST FILE, JUST CLOSE IT!\n"; auto dst_file_system = ftt->dst_opened_file->get_file_system(); auto dst_file_path = ftt->dst_opened_file->get_path(); ftt->dst_opened_file->close(); @@ -548,6 +547,8 @@ namespace wrench { SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD))); } + std::cerr << "DONE WITH FILE TRANSFER THREAD\n"; + return true; } diff --git a/src/wrench/services/storage/simple/SimpleStorageServiceNonBufferized.cpp b/src/wrench/services/storage/simple/SimpleStorageServiceNonBufferized.cpp index 1bfb95617b..a2256d2a42 100644 --- a/src/wrench/services/storage/simple/SimpleStorageServiceNonBufferized.cpp +++ b/src/wrench/services/storage/simple/SimpleStorageServiceNonBufferized.cpp @@ -63,8 +63,6 @@ namespace wrench { */ void SimpleStorageServiceNonBufferized::processTransactionCompletion(const std::shared_ptr &transaction) { - std::cerr << "IN TRANSACTION COMPLETION\n"; - // Deal with possibly open source file if (transaction->src_opened_file) { std::cerr << "THERE WAS AN OPENED SOURCE FILE, WHICH I AM CLOSING\n"; @@ -82,6 +80,7 @@ namespace wrench { if (not dst_file_system->file_exists(transaction->dst_location->getFilePath())) { std::cerr << transaction->dst_location->getStorageService()->getName() << ": MOVING " << dst_file_path << " TO " << transaction->dst_location->getFilePath() << "\n"; dst_file_system->move_file(dst_file_path, transaction->dst_location->getFilePath()); + std::cerr << "DONE THE MOVE\n"; } } @@ -130,6 +129,7 @@ namespace wrench { this->getMessagePayloadValue( SimpleStorageServiceMessagePayload::FILE_COPY_ANSWER_MESSAGE_PAYLOAD))); } + std::cerr << "DONE WITH TRANSACTION!\n"; } /** diff --git a/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp b/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp index 8f450b8465..56718bf517 100644 --- a/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp +++ b/src/wrench/services/storage/storage_helper_classes/FileTransferThread.cpp @@ -329,9 +329,7 @@ namespace wrench { if (!dst_ss) { throw std::runtime_error("FileTransferThread::receiveFileFromNetwork(): Storage Service should be a SimpleStorageService for disk write"); } - std::cerr << "WRITING A CHUNK TO THE DISK!\n"; this->dst_opened_file->write(msg->payload); - std::cerr << "DONE WRITING TO THE DISK!\n"; // simulation->writeToDisk(msg->payload, location->getStorageService()->hostname, // dst_location->getDiskOrNull()); #ifdef PAGE_CACHE_SIMULATION @@ -368,7 +366,6 @@ namespace wrench { throw std::runtime_error("FileTransferThread::receiveFileFromNetwork(): Writing to disk can only be to a SimpleStorageService"); } // simulation->writeToDisk(msg->payload, ss->hostname, location->getDiskOrNull()); - std::cerr << "WRITING LAST CHNUNK TO THE DISK\n"; this->dst_opened_file->write(msg->payload); #ifdef PAGE_CACHE_SIMULATION diff --git a/test/services/storage_services/SimpleStorageService/SimpleStorageServiceCachingTest.cpp b/test/services/storage_services/SimpleStorageService/SimpleStorageServiceCachingTest.cpp index e19b6d9b36..b91a1da00f 100644 --- a/test/services/storage_services/SimpleStorageService/SimpleStorageServiceCachingTest.cpp +++ b/test/services/storage_services/SimpleStorageService/SimpleStorageServiceCachingTest.cpp @@ -227,17 +227,23 @@ class SimpleStorageServiceLRUCachingCopyTestWMS : public wrench::ExecutionContro auto file_60 = wrench::Simulation::addFile("file_60", 60); auto file_70 = wrench::Simulation::addFile("file_70", 70); + std::cerr << "WRITING FILE 10\n"; ss1->writeFile(file_10); + std::cerr << "WRITING FILE 20\n"; ss1->writeFile(file_20); + std::cerr << "WRITING FILE 50\n"; ss1->writeFile(file_50); + std::cerr << "WRITING FILE 30\n"; ss2->writeFile(file_30); + std::cerr << "WRITING FILE 40\n"; ss2->writeFile(file_40); // The LRU list: SS1: file_10, file_20, file_50 // SS2: file_30, file_40 // Copy file_50 SS1 -> SS2 + std::cerr << "************************ DOING THE FILE COPY ******************* \n"; wrench::StorageService::copyFile(wrench::FileLocation::LOCATION(ss1, file_50), wrench::FileLocation::LOCATION(ss2, file_50)); // The LRU list: SS1: file_10, file_20, file_50 @@ -286,6 +292,11 @@ void SimpleStorageServiceCachingTest::do_SimpleLRUCachingCopy_test(double buffer // Create and initialize a simulation auto simulation = wrench::Simulation::createSimulation(); + std::cerr << "************************************************\n"; + std::cerr << "************ BUFFER SIZE: " << buffer_size << " *****************\n"; + std::cerr << "************************************************\n"; + + int argc = 1; char **argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test");