Skip to content
Snippets Groups Projects
Commit 0cc7861e authored by Daniel Hornung's avatar Daniel Hornung
Browse files

Merge branch 'f-octave-logging' into 'dev'

F octave logging

See merge request !8
parents d378c486 470d8617
Branches
Tags
1 merge request!8F octave logging
Pipeline #27327 failed
......@@ -22,9 +22,8 @@
variables:
# this is the image where cpplib repo is present (artifact from pipeline in
# caosdb-cpplib)
CPPLIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv
CPPLIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:$CI_COMMIT_REF_NAME
OCTAVELIB_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/testenv:$CI_COMMIT_REF_NAME
CPPLIB_BRANCH: dev
OCTAVEINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/121/repository/branches
......@@ -47,11 +46,16 @@ build-testenv:
stage: setup
image: docker:20.10
script:
- if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
CPPLIB_BRANCH=main ;
fi
- DOCKER_BASE_IMAGE="${CPPLIB_REGISTRY_IMAGE}:${CPPLIB_BRANCH}"
- DOCKER_BASE_IMAGE="${CPPLIB_REGISTRY_IMAGE}"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- if docker pull "$DOCKER_BASE_IMAGE" ; then
echo "DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}" ;
else
DOCKER_BASE_IMAGE="$CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:dev" ;
echo "DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}" ;
docker pull "$DOCKER_BASE_IMAGE" ;
fi
- docker pull "$OCTAVELIB_REGISTRY_IMAGE" || true
- docker build
--build-arg DOCKER_BASE_IMAGE=$DOCKER_BASE_IMAGE
......
[requires]
caosdb/[>=0.1.0, include_prerelease=True]
caosdb/[>=0.2.0-dev, include_prerelease=True]
[build_requires]
boost/1.77.0
gtest/1.11.0
[generators]
......
......@@ -42,20 +42,6 @@ using std::string;
namespace ce = caosdb::entity;
namespace cu = caosdb::utility;
// Workaround for issue caosdb-cpplib#17
#undef CAOSDB_LOG_TRACE
#undef CAOSDB_LOG_DEBUG
#undef CAOSDB_LOG_INFO
// #define CAOSDB_LOG_TRACE(name) std::clog << std::endl << "[" << name << "] "
// #define CAOSDB_LOG_DEBUG(name) std::clog << std::endl << "[" << name << "] "
// #define CAOSDB_LOG_INFO(name) std::clog << std::endl << "[" << name << "] "
std::ostream nullout(nullptr); // NOLINT
#define CAOSDB_LOG_TRACE(name) nullout // NOLINT
#define CAOSDB_LOG_DEBUG(name) nullout // NOLINT
#define CAOSDB_LOG_INFO(name) nullout // NOLINT
const auto logger_name = string("maoxdb");
auto mxFromCaosDBParents(const ce::Parents &parents) -> mxArray *;
......
......@@ -7,8 +7,6 @@
#include "caosdb/transaction_status.h"
#include "caosdb/utility.h"
#include "mex.h"
#include <boost/algorithm/string.hpp>
#include <boost/iostreams/stream.hpp>
#include <stdexcept>
#include <string>
......
......@@ -34,6 +34,7 @@
using caosdb::connection::Connection;
using caosdb::connection::ConnectionManager;
using caosdb::entity::Entity;
using caosdb::transaction::StatusCode;
using std::string;
const auto logger_name = "maox_transaction";
......@@ -89,7 +90,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
"updates, deletes, file_ids, file_paths)";
try {
CAOSDB_LOG_DEBUG(logger_name) << "maox_transaction(): " << nlhs << " <- " << nrhs << "("
<< (nrhs == 8) << ")" << std::endl; // NOLINT
<< (nrhs == 8) << ")"; // NOLINT
CAOSDB_LOG_DEBUG(logger_name) << " ( " << mxGetNumberOfElements(prhs[0]) << ", "
<< mxGetNumberOfElements(prhs[1]) << ", "
<< mxGetNumberOfElements(prhs[2]) << ", "
......@@ -169,12 +170,14 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
[&](Entity &ent) { transaction->UpdateEntity(&ent); });
std::for_each(deletes.begin(), deletes.end(),
[&](const string &id) { transaction->DeleteById(id); });
#pragma unroll 5
for (size_t i = 0; i < file_ids.size(); ++i) {
transaction->RetrieveAndDownloadFileById(file_ids[i], file_download_paths[i]);
}
// Execute transaction, if there is anything queued.
if (transaction->IsStatus(caosdb::transaction::TransactionStatus::READY()) ||
transaction->IsStatus(caosdb::transaction::TransactionStatus::GO_ON())) {
if (transaction->GetStatus().GetCode() == StatusCode::READY ||
transaction->GetStatus().GetCode() == StatusCode::GO_ON) {
const auto exec_stat = transaction->ExecuteAsynchronously(); // NOLINT
if (exec_stat != caosdb::StatusCode::EXECUTING) {
mexErrMsgIdAndTxt("maox:Execution", (string("Executing the transaction failed (") +
......@@ -190,6 +193,8 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
const auto &results = transaction->GetResultSet();
CAOSDB_LOG_TRACE(logger_name) << "ResultSet contents: ";
CAOSDB_LOG_TRACE(logger_name) << "size: " << results.size();
#pragma unroll 5
for (const auto &result : results) {
CAOSDB_LOG_TRACE(logger_name) << "errors = " << result.HasErrors();
CAOSDB_LOG_TRACE(logger_name) << result.ToString();
......@@ -201,6 +206,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
plhs[0] = maoxdb::mxDuplicateArrayAlsoSparse(mxResults);
plhs[1] = mxCountResults;
CAOSDB_LOG_TRACE(logger_name) << "\n---" << std::endl;
CAOSDB_LOG_TRACE(logger_name) << "\n---";
caosdb::utility::reset_arena();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment