Skip to content

Commit

Permalink
Merge pull request #883 from ORNL/JoshuaSBrown-fix-doc-build
Browse files Browse the repository at this point in the history
Joshua s brown fix doc build
  • Loading branch information
JoshuaSBrown authored Sep 18, 2023
2 parents 39cc4f9 + 4bee841 commit c8a4f66
Show file tree
Hide file tree
Showing 19 changed files with 245 additions and 132 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Simple workflow for deploying documentation to GitHub Pages
name: Build and deploy documentation

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-=python@v2
with:
python-version: 3.9
- name: Install documentation build dependencies
run: |
./scripts/install_docs_dependencies.sh
- name: Build documentation
run: |
cmake -S. -B build -DBUILD_AUTHZ=OFF -DBUILD_CORE_SERVER=OFF -DBUILD_COMMON=OFF -DBUILD_DOCS=ON -DBUILD_FOXX=OFF -DBUILD_REPO_SERVER=OFF -DBUILD_PYTHON_CLIENT=OFF -DBUILD_TESTS=OFF -DBUILD_WEB_SERVER=OFF -DENABLE_UNIT_TESTS=OFF
- name: Build cmake doc target
run: |
cmake --build build --target docs
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

6 changes: 4 additions & 2 deletions common/source/SocketOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ AddressSplitter::AddressSplitter(const std::string &address) {
// Add 1 so as to ignore the ':' when copying the port number
if (pos_colon + 1 < copy.size()) {
port = copy.substr(pos_colon + 1);
} else {// Else no port was provided
} else { // Else no port was provided
// This is an error we will throw we should not provide : at the end of
// an address without specifying a port number
EXCEPT_PARAM(1, "Error unable to deconstruct port, it does not appear to "
"be provided in the address even though ':' has been specified after the host. (" << address << ") ");
"be provided in the address even though ':' has been "
"specified after the host. ("
<< address << ") ");
}
std::string host;
if (pos_colon > 0) {
Expand Down
24 changes: 16 additions & 8 deletions common/source/communicators/ZeroMQCommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ void sendFinalDelimiter(void *outgoing_zmq_socket) {
// 0 - number of routes
// null
// Frame - function will not read
void receiveRoute(IMessage &msg, void *incoming_zmq_socket, LogContext log_context) {
void receiveRoute(IMessage &msg, void *incoming_zmq_socket,
LogContext log_context) {
// If the first frame is not empty assume it is a route that was provided by
// the internals of zmq
std::string previous_route = "";
Expand Down Expand Up @@ -291,7 +292,8 @@ void sendRoute(IMessage &msg, void *outgoing_zmq_socket,
/**
* Will load the frame of the message.
**/
void receiveFrame(IMessage &msg, void *incoming_zmq_socket, LogContext log_context) {
void receiveFrame(IMessage &msg, void *incoming_zmq_socket,
LogContext log_context) {
int number_of_bytes = 0;
while (number_of_bytes == 0) {
zmq_msg_t zmq_msg;
Expand Down Expand Up @@ -387,7 +389,8 @@ void receiveBody(IMessage &msg, Buffer &buffer, ProtoBufFactory &factory,
uint16_t msg_type = std::get<uint16_t>(msg.get(MSG_TYPE));

ProtoBufMap proto_map;
DL_TRACE(log_context, "Receiving message body of type: " + proto_map.toString(msg_type));
DL_TRACE(log_context, "Receiving message body of type: " +
proto_map.toString(msg_type));
if (proto_map.exists(msg_type)) {
std::unique_ptr<proto::Message> payload = factory.create(msg_type);
msg.setPayload(std::move(payload));
Expand Down Expand Up @@ -450,7 +453,8 @@ void sendBody(IMessage &msg, Buffer &buffer, void *outgoing_zmq_socket) {
}
}

void receiveCorrelationID(IMessage &msg, void *incoming_zmq_socket, LogContext log_context) {
void receiveCorrelationID(IMessage &msg, void *incoming_zmq_socket,
LogContext log_context) {
// If the UID metadata is set, use is; otherwise get the UID from the message
zmq_msg_t zmq_msg;
zmq_msg_init(&zmq_msg);
Expand All @@ -476,7 +480,8 @@ void receiveCorrelationID(IMessage &msg, void *incoming_zmq_socket, LogContext l
zmq_msg_close(&zmq_msg);
}

void receiveKey(IMessage &msg, void *incoming_zmq_socket, LogContext log_context) {
void receiveKey(IMessage &msg, void *incoming_zmq_socket,
LogContext log_context) {
// If the UID metadata is set, use is; otherwise get the UID from the message
zmq_msg_t zmq_msg;
zmq_msg_init(&zmq_msg);
Expand Down Expand Up @@ -547,7 +552,8 @@ void sendKey(IMessage &msg, void *outgoing_zmq_socket) {
zmq_msg_close(&zmq_msg);
}

void receiveID(IMessage &msg, void *incoming_zmq_socket, LogContext log_context) {
void receiveID(IMessage &msg, void *incoming_zmq_socket,
LogContext log_context) {
// If the UID metadata is set, use is; otherwise get the UID from the message
zmq_msg_t zmq_msg;
zmq_msg_init(&zmq_msg);
Expand Down Expand Up @@ -739,7 +745,8 @@ ZeroMQCommunicator::poll(const MessageType message_type) {
receiveID(*response.message, m_zmq_socket, log_context);
receiveFrame(*response.message, m_zmq_socket, log_context);

receiveBody(*response.message, m_buffer, m_protocol_factory, m_zmq_socket, log_context);
receiveBody(*response.message, m_buffer, m_protocol_factory, m_zmq_socket,
log_context);

uint16_t msg_type = std::get<uint16_t>(
response.message->get(constants::message::google::MSG_TYPE));
Expand Down Expand Up @@ -803,7 +810,8 @@ ZeroMQCommunicator::receive(const MessageType message_type) {
receiveKey(*response.message, m_zmq_socket, log_context);
receiveID(*response.message, m_zmq_socket, log_context);
receiveFrame(*response.message, m_zmq_socket, log_context);
receiveBody(*response.message, m_buffer, m_protocol_factory, m_zmq_socket, log_context);
receiveBody(*response.message, m_buffer, m_protocol_factory, m_zmq_socket,
log_context);

uint16_t msg_type = std::get<uint16_t>(
response.message->get(constants::message::google::MSG_TYPE));
Expand Down
26 changes: 15 additions & 11 deletions core/server/ClientWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,10 @@ void ClientWorker::workerThread(LogContext log_context) {
IMessage &message = *response.message;
uint16_t msg_type = std::get<uint16_t>(
message.get(constants::message::google::MSG_TYPE));
message_log_context.correlation_id = std::get<std::string>(message.get(MessageAttribute::CORRELATION_ID));
message_log_context.correlation_id = std::get<std::string>(
message.get(MessageAttribute::CORRELATION_ID));
DL_DEBUG(message_log_context, "W" << m_tid << " received message: "
<< proto_map.toString(msg_type));
<< proto_map.toString(msg_type));

const std::string uid =
std::get<std::string>(message.get(MessageAttribute::ID));
Expand All @@ -375,16 +376,17 @@ void ClientWorker::workerThread(LogContext log_context) {
response_msg->setPayload(std::move(nack));
client->send(*response_msg);
} else {
DL_DEBUG(message_log_context, "W" << m_tid
<< " getting handler from map: msg_type = "
<< proto_map.toString(msg_type));
DL_DEBUG(message_log_context,
"W" << m_tid << " getting handler from map: msg_type = "
<< proto_map.toString(msg_type));
if (m_msg_handlers.count(msg_type)) {

auto handler = m_msg_handlers.find(msg_type);

DL_TRACE(message_log_context, "W" << m_tid
<< " calling handler/attempting to call "
"function of worker");
DL_TRACE(message_log_context,
"W" << m_tid
<< " calling handler/attempting to call "
"function of worker");

// Have to move the actual unique_ptr, change ownership not simply
// passing a reference
Expand All @@ -395,8 +397,9 @@ void ClientWorker::workerThread(LogContext log_context) {
if (msg_type != task_list_msg_type)
m_core.metricsUpdateMsgCount(uid, msg_type);

DL_DEBUG(message_log_context, "W" << m_tid << " sending msg of type "
<< proto_map.toString(msg_type));
DL_DEBUG(message_log_context,
"W" << m_tid << " sending msg of type "
<< proto_map.toString(msg_type));
client->send(*response_msg);
DL_TRACE(message_log_context, "Message sent ");
}
Expand Down Expand Up @@ -1379,7 +1382,8 @@ void ClientWorker::handleTaskResponse(libjson::Value &a_result,
libjson::Value::Object &task_obj = obj.asObject();

if (task_obj.getNumber("status") != TS_BLOCKED) {
DL_DEBUG(log_context, "handleTaskResponse status is: " << task_obj.getNumber("status"));
DL_DEBUG(log_context, "handleTaskResponse status is: "
<< task_obj.getNumber("status"));
TaskMgr::getInstance().newTask(task_obj.getString("_id"), log_context);
}
}
Expand Down
4 changes: 3 additions & 1 deletion core/server/CoreServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,9 @@ void Server::repoCacheThread(LogContext log_context, int thread_count) {

while (1) {
try {
DL_DEBUG(log_context, "Checking if Repo Cache needs Updating, then sleeping for " << std::to_string(repo_cache_poll.count()) << " seconds.");
DL_DEBUG(log_context,
"Checking if Repo Cache needs Updating, then sleeping for "
<< std::to_string(repo_cache_poll.count()) << " seconds.");
m_config.loadRepositoryConfig(m_auth_manager, log_context);
} catch (const std::exception &e) {
DL_ERROR(log_context, "Repo Cache Updating... " << e.what());
Expand Down
25 changes: 14 additions & 11 deletions core/server/TaskMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using namespace std;
namespace SDMS {
namespace Core {

TaskMgr * TaskMgr::global_task_mgr;
TaskMgr *TaskMgr::global_task_mgr;
std::mutex TaskMgr::singleton_instance_mutex;

void TaskMgr::initialize(LogContext log_context) {
Expand Down Expand Up @@ -100,21 +100,23 @@ TaskMgr::TaskMgr()
TaskMgr::~TaskMgr() {}

TaskMgr &TaskMgr::getInstance() {
if( global_task_mgr == nullptr ) {
EXCEPT(1, "Something is really wrong, the getInstance() should only be called after the getInstance(log_context, thread_id) command has been called");
if (global_task_mgr == nullptr) {
EXCEPT(1, "Something is really wrong, the getInstance() should only be "
"called after the getInstance(log_context, thread_id) command "
"has been called");
}

return *global_task_mgr;
}

TaskMgr &TaskMgr::getInstance(LogContext log_context, int thread_id) {
if( global_task_mgr == nullptr ) {
std::lock_guard<std::mutex> lock(singleton_instance_mutex);
if(global_task_mgr == nullptr ) {
log_context.thread_name += "-TaskMgr";
log_context.thread_id = thread_id;
global_task_mgr = new TaskMgr(log_context);
}
if (global_task_mgr == nullptr) {
std::lock_guard<std::mutex> lock(singleton_instance_mutex);
if (global_task_mgr == nullptr) {
log_context.thread_name += "-TaskMgr";
log_context.thread_id = thread_id;
global_task_mgr = new TaskMgr(log_context);
}
}

return *global_task_mgr;
Expand Down Expand Up @@ -375,7 +377,8 @@ std::unique_ptr<TaskMgr::Task> TaskMgr::getNextTask(ITaskWorker *a_worker) {
}

// Pop next task from ready queue and place in running map
DL_DEBUG(log_context, "There are " << m_tasks_ready.size() << " grabbing one.");
DL_DEBUG(log_context,
"There are " << m_tasks_ready.size() << " grabbing one.");
auto task = std::move(m_tasks_ready.front());
m_tasks_ready.pop_front();
DL_DEBUG(log_context, "Now there are " << m_tasks_ready.size() << " left.");
Expand Down
3 changes: 1 addition & 2 deletions core/server/TaskMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ class TaskMgr : public ITaskMgr {
LogContext m_log_context;
int m_thread_count = 0;

static TaskMgr * global_task_mgr;
static TaskMgr *global_task_mgr;
static std::mutex singleton_instance_mutex;

};

} // namespace Core
Expand Down
32 changes: 18 additions & 14 deletions core/server/TaskWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void TaskWorker::workerThread(LogContext log_context) {
bool first;

while (m_running) {
DL_DEBUG(log_context,"Grabbing next task");
DL_DEBUG(log_context, "Grabbing next task");
std::unique_ptr<ITaskMgr::Task> m_task = m_mgr.getNextTask(this);

err_msg.clear();
Expand Down Expand Up @@ -105,8 +105,8 @@ void TaskWorker::workerThread(LogContext log_context) {
response = m_execute[cmd](*this, params, log_context);

} else if (cmd == TC_STOP) {
DL_DEBUG(log_context,
"TASK_ID: " << m_task->task_id << ", STOP at step: " << step);
DL_DEBUG(log_context, "TASK_ID: " << m_task->task_id
<< ", STOP at step: " << step);
m_mgr.newTasks(params, log_context);
break;
} else {
Expand All @@ -115,9 +115,11 @@ void TaskWorker::workerThread(LogContext log_context) {
}

if (response.error or response.time_out) {
err_msg = response.error_msg;
DL_DEBUG(log_context, "error dectected: " << response.error << " time_out detected: " << response.time_out << " cmd: " << cmd);
DL_DEBUG(log_context, "err_msg: " << err_msg );
err_msg = response.error_msg;
DL_DEBUG(log_context, "error dectected: "
<< response.error << " time_out detected: "
<< response.time_out << " cmd: " << cmd);
DL_DEBUG(log_context, "err_msg: " << err_msg);
if (m_mgr.retryTask(std::move(m_task), log_context)) {
DL_DEBUG(log_context, "retry period exceeded");
err_msg = "Maximum task retry period exceeded.";
Expand All @@ -136,7 +138,7 @@ void TaskWorker::workerThread(LogContext log_context) {
DL_ERROR(log_context, "Task worker "
<< id() << " exception: " << err_msg
<< " task_id is " << m_task->task_id
<< " cmd is " << cmd);
<< " cmd is " << cmd);
if (err_msg.find("Task " + m_task->task_id + " does not exist") !=
std::string::npos) {
DL_ERROR(log_context, "Task is not found in the database something "
Expand Down Expand Up @@ -340,20 +342,22 @@ TaskWorker::cmdRawDataUpdateSize(TaskWorker &me, const Value &a_task_params,
auto proto_msg =
std::get<google::protobuf::Message *>(response.message->getPayload());
auto size_reply = dynamic_cast<Auth::RepoDataSizeReply *>(proto_msg);
if (size_reply != 0 ) {
if (size_reply != 0) {
if (size_reply->size_size() != (int)ids.size()) {
DL_ERROR(log_context, "Mismatched result size with RepoDataSizeReply from repo: "
<< repo_id);
DL_ERROR(log_context,
"Mismatched result size with RepoDataSizeReply from repo: "
<< repo_id);
EXCEPT_PARAM(1,
"Mismatched result size with RepoDataSizeReply from repo: "
<< repo_id);
"Mismatched result size with RepoDataSizeReply from repo: "
<< repo_id);
}

me.m_db.recordUpdateSize(*size_reply, log_context);
} else {
DL_ERROR(log_context, "Unexpected reply to RepoDataSizeReply from repo: " << repo_id);
DL_ERROR(log_context,
"Unexpected reply to RepoDataSizeReply from repo: " << repo_id);
EXCEPT_PARAM(
1, "Unexpected reply to RepoDataSizeReply from repo: " << repo_id);
1, "Unexpected reply to RepoDataSizeReply from repo: " << repo_id);
}
}

Expand Down
Loading

0 comments on commit c8a4f66

Please sign in to comment.