Skip to content

Commit

Permalink
tmp commit (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Sep 28, 2019
1 parent 4c85413 commit ac478dd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
9 changes: 9 additions & 0 deletions src/wrench/services/storage/simple/SimpleStorageService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,19 @@ namespace wrench {

// File System at the destination
auto fs = this->file_systems[dst_location->getAbsolutePathAtMountPoint()].get();
WRENCH_INFO("HERE: %s", dst_location->getAbsolutePathAtMountPoint().c_str());


fs->doesDirectoryExist(dst_location->getAbsolutePathAtMountPoint());
WRENCH_INFO("ASD):");
fs->isFileInDirectory(file, dst_location->getAbsolutePathAtMountPoint());
WRENCH_INFO("ASD):");


if ((not fs->doesDirectoryExist(dst_location->getAbsolutePathAtMountPoint())) or
(not fs->isFileInDirectory(file, dst_location->getAbsolutePathAtMountPoint()))) {

WRENCH_INFO("123");
if (not fs->hasEnoughFreeSpace(file->getSize())) {

this->simulation->getOutput().addTimestamp<SimulationTimestampFileCopyFailure>(
Expand All @@ -416,6 +424,7 @@ namespace wrench {
return true;
}
}
WRENCH_INFO("123XZXZXX");

fs->decreaseFreeSpace(file->getSize());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace wrench {

absolute_path.replace(0, mount_point.length(), "/");

return std::shared_ptr<FileLocation>(new FileLocation(ss, mount_point, absolute_path));
return std::shared_ptr<FileLocation>(new FileLocation(ss, mount_point, sanitizePath(absolute_path)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ namespace wrench {
LogicalFileSystem::mount_points.insert(hostname+":"+mount_point);

this->mount_point = mount_point;
this->content["/"] = {};
this->content.insert(std::make_pair("/", (std::set<WorkflowFile*>){}));
WRENCH_INFO("INCONSTRU: %lu", this->content.size());
// this->content["/"] = {};
this->total_capacity = S4U_Simulation::getDiskCapacity(hostname, mount_point);
this->occupied_space = 0;
}
Expand All @@ -83,6 +85,9 @@ namespace wrench {
* @return true if the directory exists
*/
bool LogicalFileSystem::doesDirectoryExist(std::string absolute_path) {
WRENCH_INFO("WTF %s", absolute_path.c_str());
WRENCH_INFO("WTF %lu", this->content.size());
WRENCH_INFO("ASDADADASDASD");
return (this->content.find(absolute_path) != this->content.end());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ class BareMetalComputeServiceOneTaskTest : public ::testing::Test {
"<platform version=\"4.1\"> "
" <zone id=\"AS0\" routing=\"Full\"> "
" <host id=\"SingleHost\" speed=\"1f\" core=\"2\"> "
" <disk id=\"large_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <disk id=\"large_disk1\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"30000B\"/>"
" <prop id=\"mount\" value=\"/\"/>"
" <prop id=\"mount\" value=\"/disk1\"/>"
" </disk>"
" <disk id=\"large_disk2\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"30000B\"/>"
" <prop id=\"mount\" value=\"/disk2\"/>"
" </disk>"
" <disk id=\"scratch_disk\" read_bw=\"100MBps\" write_bw=\"40MBps\">"
" <prop id=\"size\" value=\"100B\"/>"
Expand Down Expand Up @@ -724,7 +728,7 @@ 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))},"/scratch'",
{std::make_pair(hostname1, std::make_tuple(wrench::ComputeService::ALL_CORES, wrench::ComputeService::ALL_RAM))}, "/scratch",
{}));

// Create a Storage Service
Expand Down Expand Up @@ -1132,15 +1136,15 @@ void BareMetalComputeServiceOneTaskTest::do_ExecutionWithPrePostCopiesTaskCleanu
ASSERT_THROW(simulation->instantiatePlatform(platform_file_path), std::runtime_error);

// Get a hostname
std::string hostname = simulation->getHostnameList()[0];
std::string hostname ="SingleHost";

// Create a Storage Service
ASSERT_NO_THROW(storage_service1 = simulation->add(
new wrench::SimpleStorageService(hostname, {"/"})));
new wrench::SimpleStorageService(hostname, {"/disk1"})));

// Create another Storage Service
ASSERT_NO_THROW(storage_service2 = simulation->add(
new wrench::SimpleStorageService(hostname, {"/"})));
new wrench::SimpleStorageService(hostname, {"/disk2"})));


// Create a Compute Service with default Storage Service #2
Expand Down
2 changes: 1 addition & 1 deletion test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
int main(int argc, char **argv) {

// disable log
xbt_log_control_set("root.thresh:critical");
// xbt_log_control_set("root.thresh:critical");

// Example selective log enabling
// xbt_log_control_set("simulation_timestamps.thresh:debug");
Expand Down
6 changes: 0 additions & 6 deletions test/workflow/WorkflowTaskTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,31 +292,25 @@ class WorkflowTaskExecutionHistoryTestWMS : public wrench::WMS {
throw std::runtime_error("Job should have failed!");
}

std::cerr << "JERE\n";
wrench::StandardJob *job_that_will_complete = job_manager->createStandardJob(this->test->t4,
{{this->test->small_input_file,
wrench::FileLocation::LOCATION(this->test->storage_service)},
{this->test->large_input_file,
wrench::FileLocation::LOCATION(this->test->storage_service)},
{this->test->t4_output_file,
wrench::FileLocation::LOCATION(this->test->storage_service)}});
std::cerr << "JERE1\n";
job_manager->submitJob(job_that_will_complete, this->test->compute_service);
std::cerr << "JERE\n";
this->waitForAndProcessNextEvent();
std::cerr << "JERE2\n";


wrench::StandardJob *job_that_will_be_terminated = job_manager->createStandardJob(this->test->t5, {});
job_manager->submitJob(job_that_will_be_terminated, this->test->compute_service);
wrench::S4U_Simulation::sleep(10.0);
job_manager->terminateJob(job_that_will_be_terminated);
std::cerr << "JERE3\n";

wrench::StandardJob *job_that_will_fail_2 = job_manager->createStandardJob(this->test->t6, {});
job_manager->submitJob(job_that_will_fail_2, this->test->compute_service);
wrench::S4U_Simulation::sleep(10.0);
std::cerr << "JERE4\n";
this->test->compute_service->stop();

return 0;
Expand Down

0 comments on commit ac478dd

Please sign in to comment.