Skip to content

Commit

Permalink
CodeFactor blank line removals
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Nov 5, 2024
1 parent 4eb3f33 commit 8d66fe4
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 82 deletions.
13 changes: 0 additions & 13 deletions include/wrench/execution_events/CompoundJobCompletedEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,10 @@

namespace wrench {

class WorkflowTask;

class DataFile;

class CompoundJob;

class PilotJob;

class ComputeService;

class StorageService;

class FileRegistryService;

class FileRegistryService;


/**
* @brief A "compound job has completed" ExecutionEvent
*/
Expand Down
6 changes: 0 additions & 6 deletions include/wrench/execution_events/CompoundJobFailedEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@

namespace wrench {

class WorkflowTask;
class DataFile;
class CompoundJob;
class PilotJob;
class ComputeService;
class StorageService;
class FileRegistryService;
class FileRegistryService;

/**
* @brief A "standard job has failed" ExecutionEvent
Expand Down
13 changes: 0 additions & 13 deletions include/wrench/execution_events/PilotJobExpiredEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,10 @@

namespace wrench {

class WorkflowTask;

class DataFile;

class StandardJob;

class PilotJob;

class ComputeService;

class StorageService;

class FileRegistryService;

class FileRegistryService;


/**
* @brief A "pilot job has expired" ExecutionEvent
*/
Expand Down
2 changes: 1 addition & 1 deletion src/wrench/action/ComputeAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace wrench {
unsigned long max_num_cores,
std::shared_ptr<ParallelModel> parallel_model) : Action(name, "compute_") {

if ((flops < 0) || (ram < 0) || (min_num_cores < 1) || (max_num_cores < min_num_cores)) {
if ((flops < 0) || (min_num_cores < 1) || (max_num_cores < min_num_cores)) {
throw std::invalid_argument("ComputeAction::ComputeAction(): invalid arguments");
}
this->flops = flops;
Expand Down
56 changes: 28 additions & 28 deletions src/wrench/execution_events/ExecutionEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,61 +48,61 @@ namespace wrench {
}
}

if (auto m = std::dynamic_pointer_cast<JobManagerCompoundJobCompletedMessage>(message)) {
if (auto jmcjcm = std::dynamic_pointer_cast<JobManagerCompoundJobCompletedMessage>(message)) {
return std::shared_ptr<CompoundJobCompletedEvent>(
new CompoundJobCompletedEvent(m->job, m->compute_service));
new CompoundJobCompletedEvent(jmcjcm->job, jmcjcm->compute_service));

} else if (auto m = std::dynamic_pointer_cast<JobManagerCompoundJobFailedMessage>(message)) {
} else if (auto jmcjfm = std::dynamic_pointer_cast<JobManagerCompoundJobFailedMessage>(message)) {
return std::shared_ptr<CompoundJobFailedEvent>(
new CompoundJobFailedEvent(m->job, m->compute_service, m->cause));
new CompoundJobFailedEvent(jmcjfm->job, jmcjfm->compute_service, jmcjfm->cause));

} else if (auto m = std::dynamic_pointer_cast<JobManagerStandardJobCompletedMessage>(message)) {
} else if (auto jmsjcm = std::dynamic_pointer_cast<JobManagerStandardJobCompletedMessage>(message)) {
std::set<std::shared_ptr<WorkflowTask>> failure_count_increments;
m->job->applyTaskUpdates(m->necessary_state_changes, failure_count_increments);
jmsjcm->job->applyTaskUpdates(jmsjcm->necessary_state_changes, failure_count_increments);
return std::shared_ptr<StandardJobCompletedEvent>(
new StandardJobCompletedEvent(m->job, m->compute_service));
new StandardJobCompletedEvent(jmsjcm->job, jmsjcm->compute_service));

} else if (auto m = std::dynamic_pointer_cast<JobManagerStandardJobFailedMessage>(message)) {
m->job->applyTaskUpdates(m->necessary_state_changes, m->necessary_failure_count_increments);
} else if (auto jmsjfm = std::dynamic_pointer_cast<JobManagerStandardJobFailedMessage>(message)) {
jmsjfm->job->applyTaskUpdates(jmsjfm->necessary_state_changes, jmsjfm->necessary_failure_count_increments);
return std::shared_ptr<StandardJobFailedEvent>(
new StandardJobFailedEvent(m->job, m->compute_service, m->cause));
new StandardJobFailedEvent(jmsjfm->job, jmsjfm->compute_service, jmsjfm->cause));

} else if (auto m = std::dynamic_pointer_cast<ComputeServicePilotJobStartedMessage>(message)) {
return std::shared_ptr<PilotJobStartedEvent>(new PilotJobStartedEvent(m->job, m->compute_service));
} else if (auto cspjsm = std::dynamic_pointer_cast<ComputeServicePilotJobStartedMessage>(message)) {
return std::shared_ptr<PilotJobStartedEvent>(new PilotJobStartedEvent(cspjsm->job, cspjsm->compute_service));

} else if (auto m = std::dynamic_pointer_cast<ComputeServicePilotJobExpiredMessage>(message)) {
return std::shared_ptr<PilotJobExpiredEvent>(new PilotJobExpiredEvent(m->job, m->compute_service));
} else if (auto cspjem = std::dynamic_pointer_cast<ComputeServicePilotJobExpiredMessage>(message)) {
return std::shared_ptr<PilotJobExpiredEvent>(new PilotJobExpiredEvent(cspjem->job, cspjem->compute_service));

} else if (auto m = std::dynamic_pointer_cast<DataManagerFileCopyAnswerMessage>(message)) {
if (m->success) {
} else if (auto dmfcam = std::dynamic_pointer_cast<DataManagerFileCopyAnswerMessage>(message)) {
if (dmfcam->success) {
return std::shared_ptr<FileCopyCompletedEvent>(new FileCopyCompletedEvent(
m->src_location, m->dst_location));
dmfcam->src_location, dmfcam->dst_location));

} else {
return std::shared_ptr<FileCopyFailedEvent>(
new FileCopyFailedEvent(m->src_location, m->dst_location, m->failure_cause));
new FileCopyFailedEvent(dmfcam->src_location, dmfcam->dst_location, dmfcam->failure_cause));
}
} else if (auto m = std::dynamic_pointer_cast<DataManagerFileReadAnswerMessage>(message)) {
if (m->success) {
} else if (auto dmfram = std::dynamic_pointer_cast<DataManagerFileReadAnswerMessage>(message)) {
if (dmfram->success) {
return std::shared_ptr<FileReadCompletedEvent>(new FileReadCompletedEvent(
m->location, m->num_bytes));
dmfram->location, dmfram->num_bytes));

} else {
return std::shared_ptr<FileReadFailedEvent>(
new FileReadFailedEvent(m->location, m->num_bytes, m->failure_cause));
new FileReadFailedEvent(dmfram->location, dmfram->num_bytes, dmfram->failure_cause));
}
} else if (auto m = std::dynamic_pointer_cast<DataManagerFileWriteAnswerMessage>(message)) {
if (m->success) {
} else if (auto dmfwam = std::dynamic_pointer_cast<DataManagerFileWriteAnswerMessage>(message)) {
if (dmfwam->success) {
return std::shared_ptr<FileWriteCompletedEvent>(new FileWriteCompletedEvent(
m->location));
dmfwam->location));

} else {
return std::shared_ptr<FileWriteFailedEvent>(
new FileWriteFailedEvent(m->location, m->failure_cause));
new FileWriteFailedEvent(dmfwam->location, dmfwam->failure_cause));
}

} else if (auto m = std::dynamic_pointer_cast<ExecutionControllerAlarmTimerMessage>(message)) {
return std::shared_ptr<TimerEvent>(new TimerEvent(m->message));
} else if (auto ecatm = std::dynamic_pointer_cast<ExecutionControllerAlarmTimerMessage>(message)) {
return std::shared_ptr<TimerEvent>(new TimerEvent(ecatm->message));
} else {
throw std::runtime_error(
"ExecutionEvent::waitForNextExecutionEvent(): Non-handled message type when generating execution event (" +
Expand Down
15 changes: 0 additions & 15 deletions src/wrench/services/storage/compound/CompoundStorageService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ namespace wrench {
StorageSelectionStrategyCallback &allocate,
WRENCH_PROPERTY_COLLECTION_TYPE property_list,
const WRENCH_MESSAGE_PAYLOAD_COLLECTION_TYPE& messagepayload_list) : StorageService(hostname, "compound_storage_" + std::to_string(getNewUniqueNumber())), allocate(allocate) {

this->setProperties(this->default_property_values, std::move(property_list));
this->setMessagePayloads(this->default_messagepayload_values, std::move(messagepayload_list));

Expand Down Expand Up @@ -168,12 +167,10 @@ namespace wrench {
}

bool CompoundStorageService::processStorageSelectionMessage(const CompoundStorageAllocationRequestMessage *msg) {

auto file = msg->file;
WRENCH_INFO("CSS::processStorageSelectionMessage(): For file %s", file->getID().c_str());

if (this->file_location_mapping.find(file) != this->file_location_mapping.end()) {

WRENCH_INFO("CSS::processStorageSelectionMessage: File %s already known by CSS", file->getID().c_str());

msg->answer_commport->dputMessage(
Expand Down Expand Up @@ -252,7 +249,6 @@ namespace wrench {
}

bool CompoundStorageService::processStorageLookupMessage(const CompoundStorageLookupRequestMessage *msg) {

auto file = msg->file;
WRENCH_INFO("CSS::processStorageLookupMessage(): For file %s", file->getID().c_str());

Expand Down Expand Up @@ -362,7 +358,6 @@ namespace wrench {
* or nullptr if it's not.
*/
std::vector<std::shared_ptr<FileLocation>> CompoundStorageService::lookupOrDesignateStorageService(const std::shared_ptr<FileLocation>& location) {

auto temp_commport = S4U_CommPort::getTemporaryCommPort();

auto locations = this->lookupOrDesignateStorageService(location->getFile(), 0, temp_commport);
Expand All @@ -384,7 +379,6 @@ namespace wrench {
* or nullptr if it's not.
*/
std::vector<std::shared_ptr<FileLocation>> CompoundStorageService::lookupOrDesignateStorageService(const std::shared_ptr<FileLocation>& location, unsigned int stripe_count) {

auto temp_commport = S4U_CommPort::getTemporaryCommPort();

auto locations = this->lookupOrDesignateStorageService(location->getFile(), stripe_count, temp_commport);
Expand Down Expand Up @@ -422,7 +416,6 @@ namespace wrench {

// Send a message to the storage service's daemon
for (const auto &loc: designated_locations) {

WRENCH_DEBUG("CSS:deleteFile Issuing delete message to SSS %s", loc->getStorageService()->getName().c_str());

// assertServiceIsUp(loc->getStorageService());
Expand All @@ -433,7 +426,6 @@ namespace wrench {
this->getMessagePayloadValue(StorageServiceMessagePayload::FILE_DELETE_REQUEST_MESSAGE_PAYLOAD)));

if (wait_for_answer) {

std::unique_ptr<SimulationMessage> message = nullptr;

auto msg = answer_commport->getMessage<StorageServiceFileDeleteAnswerMessage>(this->network_timeout, "StorageService::deleteFile():");
Expand Down Expand Up @@ -487,7 +479,6 @@ namespace wrench {

// Send a message to the storage service's daemon
for (const auto &loc: file_parts) {

assertServiceIsUp(loc->getStorageService());

loc->getStorageService()->commport->putMessage(new StorageServiceFileLookupRequestMessage(
Expand Down Expand Up @@ -818,7 +809,6 @@ namespace wrench {
const std::shared_ptr<FileLocation> &location,
sg_size_t num_bytes_to_write,
bool wait_for_answer) {

WRENCH_INFO("CSS::writeFile(): Writing %llu to file %s - starting at %f", num_bytes_to_write, location->getFile()->getID().c_str(), S4U_Simulation::getClock());

if (location == nullptr) {
Expand Down Expand Up @@ -924,7 +914,6 @@ namespace wrench {
auto buffer_size = msg->buffer_size;

if (buffer_size >= 1) {

auto file = location->getFile();
for (auto const &dwmb: msg->data_write_commport_and_bytes) {
// Bufferized
Expand Down Expand Up @@ -1058,7 +1047,6 @@ namespace wrench {
WRENCH_DEBUG("CSS::readFile(): %u FileReadRequests sent and validated", request_count);

for (const auto &msg: messages) {

if (msg->buffer_size < 1) {
// Non-Bufferized ; just wait for an ack for this message (note this may not be THE ack to this precise message, but it doesn't matter)
recv_commport->getMessage<StorageServiceAckMessage>("CSS::readFile(): ");
Expand Down Expand Up @@ -1256,7 +1244,6 @@ namespace wrench {
trace.parts_count = size(locations);

if (locations.empty()) {

trace.file_name = "nofile";

for (const auto &storage: this->storage_services) {
Expand All @@ -1270,13 +1257,11 @@ namespace wrench {
}

} else {

trace.file_name = locations.begin()->get()->getFile()->getID();

std::set<std::string> known_services;

for (const auto &location: locations) {

auto storage_service = location->getStorageService();
if (known_services.find(storage_service->getName()) == known_services.end()) {
DiskUsage disk_usage;
Expand Down
6 changes: 0 additions & 6 deletions tools/wrench/wrench-daemon/src/SimulationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ namespace wrench {

// Main control loop
while (keep_going) {

// Starting compute and storage services that should be started, if any
while (true) {
std::function<void()> thing_to_do;
Expand Down Expand Up @@ -375,7 +374,6 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::createVM(json data) {

std::string cs_name = data["service_name"];
unsigned long num_cores = data["num_cores"];
sg_size_t ram_memory = data["ram_memory"];
Expand Down Expand Up @@ -831,7 +829,6 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::createStandardJob(json data) {

std::vector<std::shared_ptr<WorkflowTask>> tasks;
std::string workflow_name = data["workflow_name"];
std::shared_ptr<Workflow> workflow;
Expand Down Expand Up @@ -1377,7 +1374,6 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::createTask(json data) {

std::string workflow_name = data["workflow_name"];
std::shared_ptr<Workflow> workflow;
if (not this->workflow_registry.lookup(workflow_name, workflow)) {
Expand Down Expand Up @@ -1594,7 +1590,6 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::getTaskOutputFiles(json data) {

std::string workflow_name = data["workflow_name"];
std::shared_ptr<Workflow> workflow;
if (not this->workflow_registry.lookup(workflow_name, workflow)) {
Expand Down Expand Up @@ -2011,7 +2006,6 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::createWorkflow(const json &data) {

auto wf = wrench::Workflow::createWorkflow();
json answer;
answer["workflow_name"] = wf->getName();
Expand Down

0 comments on commit 8d66fe4

Please sign in to comment.