Skip to content

Commit

Permalink
tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 8, 2024
1 parent cf7290b commit 9a3f519
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 42 deletions.
4 changes: 0 additions & 4 deletions src/wrench/action/FileReadAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ namespace wrench {
// Thread overhead
Simulation::sleep(action_executor->getThreadCreationOverhead());

std::cerr << "######################### STARTING A FILE READ ACTION\n";

// Fix locations that are scratch
for (unsigned long i = 0; i < this->file_locations.size(); i++) {
if (this->file_locations[i]->isScratch()) {
Expand All @@ -98,8 +96,6 @@ namespace wrench {
}
}
}
std::cerr << "######################### DONE WITH FILE READ ACTION\n";

}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/wrench/action/FileWriteAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,13 @@ namespace wrench {
// Thread overhead
Simulation::sleep(action_executor->getThreadCreationOverhead());

std::cerr << "######################### STARTING A FILE WRITE ACTION\n";


// Fix location if scratch
if (this->file_location->isScratch()) {
auto cs = std::dynamic_pointer_cast<ComputeService>(action_executor->getActionExecutionService()->getParentService());
this->file_location = FileLocation::LOCATION(cs->getScratch(), cs->getScratch()->getBaseRootPath() + this->getJob()->getName(), this->file_location->getFile());
}
// File write
StorageService::writeFileAtLocation(this->file_location);
std::cerr << "######################### DONE WITH FILE WRITE ACTION\n";
}

/**
Expand Down
5 changes: 0 additions & 5 deletions src/wrench/job/StandardJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,7 @@ namespace wrench {
*latest_end_date = -1.0;
*earliest_failure_date = -1.0;

std::cerr << "ANALyZING ACTIONS...\n";

for (const auto &action: actions) {
std::cerr << " ANALYSING ACTION " << action->getName() << " END DATE " << action->getEndDate() << "\n";

// Set the dates
if ((*earliest_start_date == -1.0) or ((action->getStartDate() < *earliest_start_date) and (action->getStartDate() != -1.0))) {
*earliest_start_date = action->getStartDate();
Expand Down Expand Up @@ -645,7 +641,6 @@ namespace wrench {

t->updateStartDate(earliest_start_date);// could be -1.0 if there were no input, but will be updated below
t->setReadInputStartDate(earliest_start_date);
std::cerr << "***** SETTING READ INPUT END ATE TO : " << latest_end_date << "\n";
t->setReadInputEndDate(latest_end_date);

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

// Send back the corresponding ack
try {
answer_commport->dputMessage(
answer_commport->putMessage(
new StorageServiceFileReadAnswerMessage(
location,
success,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ namespace wrench {
if (!ss or !file) {
throw std::invalid_argument("FileLocation::LOCATION(): invalid nullptr arguments");
}
std::cerr << "IN FileLocation::LOCATION(): Calling getMountPoint()" << "\n";
return LOCATION(ss, ss->getMountPoint(), file);
}

Expand Down
2 changes: 1 addition & 1 deletion src/wrench/services/storage/xrootd/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ namespace wrench {
}
}
} else {// you asked a leaf directly and it didn't have the file
msg->answer_commport->dputMessage(new StorageServiceFileReadAnswerMessage(
msg->answer_commport->putMessage(new StorageServiceFileReadAnswerMessage(
FileLocation::LOCATION(internalStorage, file),
false,
std::shared_ptr<FailureCause>(
Expand Down
46 changes: 23 additions & 23 deletions src/wrench/simgrid_S4U_util/S4U_CommPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace wrench {


/**
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* @brief Helper method that avoids calling WRENCH_INFO from a .h file and do the logging for the templated getMessage() method.
* It also has the added bonus of checking for inheritance
*
* @param type: a pointer to the message so we have its type
Expand All @@ -93,11 +93,11 @@ namespace wrench {
*/
void S4U_CommPort::templateWaitingLog(const std::string &type, unsigned long long id) {

WRENCH_DEBUG("Waiting for message of type <%s> from commport '%s'. Request ID: %llu", type.c_str(), this->get_cname(), id);
WRENCH_INFO("Waiting for message of type <%s> from commport '%s'. Request ID: %llu", type.c_str(), this->get_cname(), id);
}

/**
* @brief Helper method that avoids calling WRENCH_DEBUG from a .h file and do the logging for the templated getMessage() method.
* @brief Helper method that avoids calling WRENCH_INFO from a .h file and do the logging for the templated getMessage() method.
* It also has the added bonus of checking for inheritance.
*
* @param type: a pointer to the message so we have its type
Expand All @@ -106,7 +106,7 @@ namespace wrench {
*/
void S4U_CommPort::templateWaitingLogUpdate(const std::string &type, unsigned long long id) {

WRENCH_DEBUG("Received a message of type <%s> from commport '%s'. Request ID: %llu", type.c_str(), this->get_cname(), id);
WRENCH_INFO("Received a message of type <%s> from commport '%s'. Request ID: %llu", type.c_str(), this->get_cname(), id);
}

/**
Expand Down Expand Up @@ -137,30 +137,30 @@ namespace wrench {
throw std::invalid_argument("S4U_CommPort::getMessage(): Cannot be called with NULL_COMMPORT");
}

// if (log) WRENCH_DEBUG("Getting a message from commport '%s' with timeout %lf sec", this->get_cname(), timeout);
WRENCH_DEBUG("Getting a message from commport '%s' with timeout %lf sec", this->get_cname(), timeout);
// if (log) WRENCH_INFO("Getting a message from commport '%s' with timeout %lf sec", this->get_cname(), timeout);
WRENCH_INFO("Getting a message from commport '%s' with timeout %lf sec", this->get_cname(), timeout);


simgrid::s4u::ActivitySet pending_receives;
if (not this->mb_comm_posted) {
WRENCH_DEBUG("POSTING GET ASYNC ON MB for %s: %p", this->get_cname(), (this->mb_comm.get()));
WRENCH_INFO("POSTING GET ASYNC ON MB for %s: %p", this->get_cname(), (this->mb_comm.get()));
this->mb_comm = this->s4u_mb->get_async<SimulationMessage>(&this->msg_mb);
this->mb_comm_posted = true;
} else {
WRENCH_DEBUG("GET ASYNC ON MB ALREADY POSTED FROM BEFORE FOR %s: %p", this->get_cname(), this->mb_comm.get());
WRENCH_INFO("GET ASYNC ON MB ALREADY POSTED FROM BEFORE FOR %s: %p", this->get_cname(), this->mb_comm.get());
}
if (not this->mq_comm_posted) {
WRENCH_DEBUG("POSTING GET ASYNC ON MQ for %s: %p", this->get_cname(), (this->mq_comm.get()));
WRENCH_INFO("POSTING GET ASYNC ON MQ for %s: %p", this->get_cname(), (this->mq_comm.get()));
this->mq_comm = this->s4u_mq->get_async<SimulationMessage>(&this->msg_mq);
this->mq_comm_posted = true;
} else {
WRENCH_DEBUG("GET ASYNC ON MQ ALREADY POSTED FROM BEFORE FOR %s: %p", this->get_cname(), this->mq_comm.get());
WRENCH_INFO("GET ASYNC ON MQ ALREADY POSTED FROM BEFORE FOR %s: %p", this->get_cname(), this->mq_comm.get());
}

pending_receives.push(this->mb_comm);
pending_receives.push(this->mq_comm);

// WRENCH_DEBUG("IN GET MESSAGE: %p(%s) %p(%s)",
// WRENCH_INFO("IN GET MESSAGE: %p(%s) %p(%s)",
// this->mb_comm.get(), this->mb_comm->get_mailbox()->get_cname(),
// this->mq_comm.get(), this->mq_comm->get_queue()->get_cname());

Expand All @@ -169,7 +169,7 @@ namespace wrench {
// Wait for one activity to complete
finished_recv = pending_receives.wait_any_for(timeout);
} catch (simgrid::TimeoutException &e) {
// WRENCH_DEBUG("Got A TimeoutException");
// WRENCH_INFO("Got A TimeoutException");
pending_receives.erase(this->mq_comm);
pending_receives.erase(this->mb_comm);
this->mq_comm->cancel();
Expand All @@ -180,7 +180,7 @@ namespace wrench {
this->mb_comm_posted = false;
throw ExecutionException(std::make_shared<NetworkError>(NetworkError::RECEIVING, NetworkError::TIMEOUT, this->name, ""));
} catch (simgrid::Exception &e) {
// WRENCH_DEBUG("Got A simgrid::Exception");
// WRENCH_INFO("Got A simgrid::Exception");
auto failed_recv = pending_receives.get_failed_activity();
if (failed_recv == this->mb_comm) {
pending_receives.erase(this->mb_comm);
Expand All @@ -202,14 +202,14 @@ namespace wrench {
SimulationMessage *msg = nullptr;

if (finished_recv == this->mb_comm) {
// WRENCH_DEBUG("SOME COMM FINISHED ON MB");
// WRENCH_INFO("SOME COMM FINISHED ON MB");
pending_receives.erase(this->mq_comm);
pending_receives.erase(this->mb_comm);
msg = this->msg_mb;
this->mb_comm_posted = false;
this->mb_comm = nullptr;
} else if (finished_recv == this->mq_comm) {
// WRENCH_DEBUG("SOME COMM FINISHED ON MQ");
// WRENCH_INFO("SOME COMM FINISHED ON MQ");
pending_receives.erase(this->mb_comm);
pending_receives.erase(this->mq_comm);
msg = this->msg_mq;
Expand All @@ -224,7 +224,7 @@ namespace wrench {
MessageManager::removeReceivedMessage(this, msg);
#endif

WRENCH_DEBUG("Received a '%s' message from commport '%s' (%lf, %p bytes)",
WRENCH_INFO("Received a '%s' message from commport '%s' (%lf, %p bytes)",
msg->getName().c_str(), this->get_cname(),
msg->payload, msg);

Expand All @@ -243,7 +243,7 @@ namespace wrench {
if (this == S4U_CommPort::NULL_COMMPORT) {
return;
}
WRENCH_DEBUG("Putting a %s message (%.2lf bytes, %p) to commport '%s'",
WRENCH_INFO("Putting a %s message (%.2lf bytes, %p) to commport '%s'",
msg->getName().c_str(), msg->payload, msg,
this->get_cname());

Expand Down Expand Up @@ -287,7 +287,7 @@ namespace wrench {
return;
}

WRENCH_DEBUG("Dputting a %s message (%.2lf bytes, %p) to commport '%s'",
WRENCH_INFO("Dputting a %s message (%.2lf bytes, %p) to commport '%s'",
msg->getName().c_str(), msg->payload, msg,
this->get_cname());

Expand Down Expand Up @@ -317,7 +317,7 @@ namespace wrench {
return nullptr;
}

WRENCH_DEBUG("Iputting a %s message (%.2lf bytes) to commport '%s'",
WRENCH_INFO("Iputting a %s message (%.2lf bytes) to commport '%s'",
msg->getName().c_str(), msg->payload,
this->get_cname());

Expand Down Expand Up @@ -368,7 +368,7 @@ namespace wrench {
throw std::invalid_argument("S4U_CommPort::igetMessage(): Cannot be called with NULL_COMMPORT");
}

WRENCH_DEBUG("Igetting a message from commport '%s'", this->get_cname());
WRENCH_INFO("Igetting a message from commport '%s'", this->get_cname());

std::shared_ptr<S4U_PendingCommunication> pending_communication = std::make_shared<S4U_PendingCommunication>(
this, S4U_PendingCommunication::OperationType::RECEIVING);
Expand Down Expand Up @@ -432,7 +432,7 @@ namespace wrench {

S4U_CommPort::used_commports.insert(commport);
commport->reset();// Just in case
WRENCH_DEBUG("Gotten temporary commport %s (%p %p)", commport->name.c_str(), commport->mq_comm.get(), commport->mb_comm.get());
WRENCH_INFO("Gotten temporary commport %s (%p %p)", commport->name.c_str(), commport->mq_comm.get(), commport->mb_comm.get());
return commport;
}

Expand All @@ -443,7 +443,7 @@ namespace wrench {
* @param commport: the commport to retire
*/
void S4U_CommPort::retireTemporaryCommPort(S4U_CommPort *commport) {
// WRENCH_DEBUG("Calling reset() on commport %s", commport->get_cname());
// WRENCH_INFO("Calling reset() on commport %s", commport->get_cname());
if (commport->mb_comm) {
commport->mb_comm->cancel();
}
Expand All @@ -454,7 +454,7 @@ namespace wrench {
if (S4U_CommPort::used_commports.find(commport) == S4U_CommPort::used_commports.end()) {
return;
}
WRENCH_DEBUG("Retiring commport %s", commport->name.c_str());
WRENCH_INFO("Retiring commport %s", commport->name.c_str());
S4U_CommPort::used_commports.erase(commport);
S4U_CommPort::free_commports.push_front(commport);//
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ TEST_F(SimulationTimestampTaskTest, SimulationTimestampTaskMultipleTest) {
void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() {
// Create and initialize a simulation
auto simulation = wrench::Simulation::createSimulation();
int argc = 2;
int argc = 3;
auto argv = (char **) calloc(argc, sizeof(char *));
argv[0] = strdup("unit_test");
argv[1] = strdup("--wrench-default-control-message-size=1024");
// argv[2] = strdup("--wrench-full-log");
argv[2] = strdup("--wrench-full-log");


ASSERT_NO_THROW(simulation->init(&argc, argv));
Expand All @@ -392,7 +392,7 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() {
ASSERT_NO_THROW(backup_storage_service = simulation->add(wrench::SimpleStorageService::createSimpleStorageService(wms_host, {"/backup"})));


std::shared_ptr<wrench::ExecutionController> wms = nullptr;
std::shared_ptr<wrench::ExecutionController> wms;

ASSERT_NO_THROW(wms = simulation->add(new SimulationTimestampTaskMultipleTestWMS(
this, wms_host)));
Expand Down Expand Up @@ -422,6 +422,7 @@ void SimulationTimestampTaskTest::do_SimulationTimestampTaskMultiple_test() {
* - 3 completed: task1 x 2, failed_task x 1
* - 1 failed : failed_task x 1
*/
std::cerr << "############### SIMULATION DONE\n";
ASSERT_EQ(starts_trace.size(), 4);
ASSERT_EQ(completions_trace.size(), 3);
ASSERT_EQ(failures_trace.size(), 1);
Expand Down

0 comments on commit 9a3f519

Please sign in to comment.