Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrameDimension #807

Merged
merged 21 commits into from
Apr 4, 2020
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
00f7556
[Dimension] define DataFrameDimension
jgrewe Oct 16, 2019
0d65567
[DataArray] support appending DataFrameDimensions
jgrewe Mar 25, 2020
9ff0ef0
[testDataFrameDim] tests from DataFrameDimension
jgrewe Mar 26, 2020
727fae6
[DataFrameDim] fixes and more error handling in the front end ...
jgrewe Mar 27, 2020
54e6fc6
[DataFrameDim] fixes and new function to get the dim size
jgrewe Mar 28, 2020
76cec02
[travis] Install lcov: coverage on build success
achilleas-k Apr 1, 2020
26bfbdb
[travis] Copy coverage.info from container to host
achilleas-k Apr 1, 2020
6e4d6e4
[validator] add check and validation step for DFDim
jgrewe Apr 2, 2020
0a624f3
[Test] add test from DFDim validation
jgrewe Apr 2, 2020
904f6f6
Disable cdash submission
achilleas-k Apr 2, 2020
c322686
[travis] Send coverage info from inside Arch container
achilleas-k Apr 2, 2020
00fbb05
[docker/arch] Install lcov inside container
achilleas-k Apr 2, 2020
e6e8a93
[travis] Remove/disable ctest_submit()
achilleas-k Apr 2, 2020
c0375a5
[travis] Echo coverage submit for debugging
achilleas-k Apr 2, 2020
fa8654e
[travis] Use Travis compiler var to set up env
achilleas-k Apr 2, 2020
e0c434c
[DimensionFS] fix uninitialized return var
jgrewe Apr 3, 2020
f3e187e
[Dimension] fix signed/unsigned comparison warning
jgrewe Apr 3, 2020
bd4566b
[FS] fix ambiguous initializer for boost::filesys::exitst
jgrewe Apr 3, 2020
eaf457e
Remove ctest_submit() everywhere
achilleas-k Apr 3, 2020
7d87539
[DataFrameDimHDF] error messages get suffix
jgrewe Apr 3, 2020
855fefb
[DataFrameDim] optionals all over the place
jgrewe Apr 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .appveyor.ctest
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ ctest_start(Continuous)
ctest_configure()
ctest_build()
ctest_test(RETURN_VALUE tests_ret)
ctest_submit()

if(NOT tests_ret EQUAL 0)
message(FATAL_ERROR "Test had failures!")
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -10,6 +10,9 @@ Makefile.conf
# ingore documentation
doc/html
docs/_build
docs/api
docs/api_doc/html
docs/api_doc/xml

# ignore hdf5 files
*.hdf
2 changes: 0 additions & 2 deletions .travis.ctest
Original file line number Diff line number Diff line change
@@ -47,8 +47,6 @@ if(GCOV AND $ENV{CXX} MATCHES "g\\+\\+")
ctest_coverage()
endif()

ctest_submit()

if(NOT tests_ret EQUAL 0)
message(FATAL_ERROR "Test had failures!")
endif()
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@ matrix:
env: FS_BACKEND=OFF DOCKERFILE=ub1804

addons:
apt:
update: true
packages:
- lcov
Comment on lines +31 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is in theory not needed anymore, right @achilleas-k

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. Remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No U!

homebrew:
packages:
- cmake
@@ -45,7 +49,7 @@ cache:
- $HOME/Library/Caches/Homebrew

before_install:
- if [[ "$CXX" == "gcc" ]];
- if [[ "$TRAVIS_COMPILER" == "gcc" ]];
then
export CC=gcc;
export CXX=g++;
@@ -77,8 +81,9 @@ script:
fi

after_success:
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$FS_BACKEND" == "OFF" ]]; then
lcov -q --capture --directory . --no-extern --output-file coverage.info;
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$FS_BACKEND" == "OFF" && "$DOCKERFILE" == "archlinux" && "$CXX" == "g++" ]]; then
echo "Submitting code coverage report";
docker exec nixbuilder lcov -q --capture --directory . --no-extern --output-file coverage.info;
bash <(curl -s https://codecov.io/bash) -f coverage.info -Z;
fi

1 change: 0 additions & 1 deletion .unix.ctest
Original file line number Diff line number Diff line change
@@ -39,4 +39,3 @@ ctest_build()
ctest_test()
ctest_memcheck()
ctest_coverage()
ctest_submit()
5 changes: 0 additions & 5 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
set(CTEST_PROJECT_NAME "nix")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")

set(CTEST_DROP_METHOD "https")
set(CTEST_DROP_SITE "cdash.0xdeadbabe.info")
set(CTEST_DROP_LOCATION "/submit.php?project=nix")
set(CTEST_DROP_SITE_CDASH TRUE)
9 changes: 9 additions & 0 deletions backend/fs/DataArrayFS.hpp
Original file line number Diff line number Diff line change
@@ -126,6 +126,15 @@ class DataArrayFS : virtual public base::IDataArray, public EntityWithSourcesFS
std::shared_ptr<base::ISampledDimension> createSampledDimension(ndsize_t id, double sampling_interval);


std::shared_ptr<base::IDataFrameDimension> createDataFrameDimension(ndsize_t id, const nix::DataFrame &df) {
throw std::runtime_error("not implemented");
}


std::shared_ptr<base::IDataFrameDimension> createDataFrameDimension(ndsize_t id, const nix::DataFrame &df, unsigned col_index) {
throw std::runtime_error("not implemented");
}

bool deleteDimensions();

//--------------------------------------------------
8 changes: 8 additions & 0 deletions backend/fs/DimensionFS.cpp
Original file line number Diff line number Diff line change
@@ -20,6 +20,8 @@ DimensionType dimensionTypeFromStr(const std::string &str) {
return DimensionType::Range;
} else if (str == "sample") {
return DimensionType::Sample;
} else if (str == "data_frame") {
return DimensionType::DataFrame;
} else {
throw std::runtime_error("Not a valid dimension name");
}
@@ -49,6 +51,9 @@ std::string dimensionTypeToStr(DimensionType dim) {
case DimensionType::Sample:
dimType = "sample";
break;
case DimensionType::DataFrame:
dimType = "data_frame";
break;
}

if (dimType.empty()) {
@@ -77,6 +82,9 @@ std::shared_ptr<IDimension> openDimensionFS(const std::string &loc, FileMode mod
case DimensionType::Sample:
dim = std::make_shared<SampledDimensionFS>(loc, mode);
break;
case DimensionType::DataFrame:
dim = std::make_shared<DataFrameDimensionFS>(loc, mode);
break;
}
return dim;
}
54 changes: 54 additions & 0 deletions backend/fs/DimensionFS.hpp
Original file line number Diff line number Diff line change
@@ -10,8 +10,13 @@
#define NIX_DIMENSIONFS_HPP

#include <nix/base/IDimensions.hpp>
#include <nix/base/IBlock.hpp>
#include <nix/base/IFile.hpp>
#include <nix/DataFrame.hpp>

#include "DirectoryWithAttributes.hpp"
#include "DataArrayFS.hpp"

#include <string>
#include <iostream>
#include <ctime>
@@ -142,6 +147,55 @@ class SetDimensionFS : virtual public base::ISetDimension, public DimensionFS {
};


class DataFrameDimensionFS : virtual public base::IDataFrameDimension, public DimensionFS {

public:
DataFrameDimensionFS(const std::string &loc, FileMode mode)
:DimensionFS(loc, mode){};


DataFrameDimensionFS(const std::string &loc, size_t index, FileMode mode)
:DimensionFS(loc, index, mode){};

DimensionType dimensionType() const {
return DimensionType::DataFrame;
}

boost::optional<unsigned> columnIndex() const {
boost::optional<unsigned> index ={};
return index;
}

Column column(boost::optional<unsigned> col_index) const {
nix::Column c;
return c;
}

std::string label(boost::optional<unsigned> col_index) const {
std::string label = "";
return label;
}

std::string unit(boost::optional<unsigned> col_index) const {
std::string unit;
return unit;
};

nix::DataType columnDataType(boost::optional<unsigned> col_index) const {
nix::DataType dtype = nix::DataType::Nothing;
return dtype;
}

std::shared_ptr<base::IDataFrame> dataFrame() const {
//std::shared_ptr<base::IDataFrameFS> df; //FIXME DataFrameFS does not exist
return nullptr;
}

virtual ~DataFrameDimensionFS(){};

};


class RangeDimensionFS : virtual public base::IRangeDimension, public DimensionFS {

public:
3 changes: 2 additions & 1 deletion backend/fs/Directory.cpp
Original file line number Diff line number Diff line change
@@ -136,7 +136,8 @@ bool Directory::removeObjectByNameOrAttribute(const std::string &attribute, cons


void Directory::createDirectoryLink(const std::string &target, const std::string &name) {
if (boost::filesystem::exists({target})) {
bfs::path p(target);
if (boost::filesystem::exists(p)) {
boost::filesystem::create_directory_symlink(boost::filesystem::path(target), loc / boost::filesystem::path(name));
} else {
throw std::runtime_error("Directory::createLink: target does not exist");
12 changes: 7 additions & 5 deletions backend/fs/SectionFS.cpp
Original file line number Diff line number Diff line change
@@ -104,7 +104,6 @@ void SectionFS::repository(const none_t t) {

void SectionFS::link(const std::string &id) {
bfs::path p(location()), l("link");

if (bfs::exists(p / l)) {
link(none);
}
@@ -122,8 +121,9 @@ void SectionFS::link(const std::string &id) {

std::shared_ptr<base::ISection> SectionFS::link() const {
std::shared_ptr<base::ISection> sec;

if (bfs::exists({location() + "/link"})) {
bfs::path p(location());
p /= "link";
if (bfs::exists(p)) {
auto sec_tmp = std::make_shared<SectionFS>(file(), location() + "/link");
// re-get above section "sec_tmp": parent missing, findSections will set it!
auto found = File(file()).findSections(util::IdFilter<Section>(sec_tmp->id()));
@@ -136,8 +136,10 @@ std::shared_ptr<base::ISection> SectionFS::link() const {


void SectionFS::link(const none_t t) {
if (bfs::exists({location() + "/link"})) {
bfs::remove_all({location() + "/link"});
bfs::path p(location());
p /= "link";
if (bfs::exists(p)) {
bfs::remove_all(p);
}
forceUpdatedAt();
}
12 changes: 12 additions & 0 deletions backend/hdf5/DataArrayHDF5.cpp
Original file line number Diff line number Diff line change
@@ -206,6 +206,18 @@ std::shared_ptr<base::ISampledDimension> DataArrayHDF5::createSampledDimension(n
}


std::shared_ptr<base::IDataFrameDimension> DataArrayHDF5::createDataFrameDimension(ndsize_t index, const nix::DataFrame &df, unsigned col_index) {
H5Group g = createDimensionGroup(index);
return make_shared<DataFrameDimensionHDF5>(g, index, file(), block(), df, col_index);
}


std::shared_ptr<base::IDataFrameDimension> DataArrayHDF5::createDataFrameDimension(ndsize_t index, const nix::DataFrame &df) {
H5Group g = createDimensionGroup(index);
return make_shared<DataFrameDimensionHDF5>(g, index, file(), block(), df);
}


H5Group DataArrayHDF5::createDimensionGroup(ndsize_t index) {
boost::optional<H5Group> g = dimension_group(true);

7 changes: 7 additions & 0 deletions backend/hdf5/DataArrayHDF5.hpp
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
#define NIX_DATA_ARRAY_HDF5_H

#include <nix/base/IDataArray.hpp>
#include <nix/DataFrame.hpp>
#include "EntityWithSourcesHDF5.hpp"

#include <boost/multi_array.hpp>
@@ -114,6 +115,12 @@ class DataArrayHDF5 : virtual public base::IDataArray, public EntityWithSources
std::shared_ptr<base::ISampledDimension> createSampledDimension(ndsize_t id, double sampling_interval);


std::shared_ptr<base::IDataFrameDimension> createDataFrameDimension(ndsize_t id, const nix::DataFrame &df);


std::shared_ptr<base::IDataFrameDimension> createDataFrameDimension(ndsize_t id, const nix::DataFrame &df, unsigned col_index);


bool deleteDimensions();

//--------------------------------------------------
Loading