-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from DICL/cleaning-logical-blocks-feature
Completes and isolates logical block feature
- Loading branch information
Showing
15 changed files
with
182 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
release_no=$(grep -oP "release: \K(v\d*.\d*.\d*)" <(git log -1 --pretty=%B)) | ||
|
||
if [ "$?" = "0" ]; then | ||
cmd="git tag -a $release_no -m \"`git log -1 --pretty=%B`\"" | ||
echo "$cmd" | ||
eval $cmd | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,59 @@ | ||
AM_CPPFLAGS_T = $(AM_CPPFLAGS) -include unittest++/UnitTest++.h | ||
LDADD_T = $(LDADD) -l:libUnitTest++.a -ldl -lsqlite3 | ||
|
||
# Input your tests files here | ||
check_PROGRAMS = units metadata | ||
check_SCRIPTS = integration | ||
|
||
TESTS = units | ||
LDADD_T = $(LDADD) -l:libUnitTest++.a | ||
|
||
check_DATA = $(top_srcdir)/doc/eclipse.json | ||
CLEANFILES = eclipse.json | ||
check_PROGRAMS = | ||
TESTS = | ||
|
||
#<<<<<<<<<<<<<<<<Input your tests files here>>>>>>>>>>>>>>>>>>>> | ||
|
||
# INTEGRATION TEST | ||
# --------------------------------------------------------------------- | ||
check_SCRIPTS = integration | ||
check-integration: integration | ||
bash integration.sh | ||
|
||
integration: | ||
cp $(top_srcdir)/tests/integration_test.sh integration.sh | ||
chmod +x integration.sh | ||
|
||
|
||
# Input the dependencies of the test files here | ||
units_LDADD = $(LDADD_T) | ||
units_CPPFLAGS = $(AM_CPPFLAGS_T) | ||
units_SOURCES = $(messages_files) \ | ||
# MESSAGES TEST | ||
# --------------------------------------------------------------------- | ||
check_PROGRAMS += messages | ||
TESTS += messages | ||
messages_LDADD = $(LDADD_T) -ldl -lsqlite3 | ||
messages_CPPFLAGS = $(AM_CPPFLAGS_T) | ||
messages_SOURCES = $(messages_files) \ | ||
tests/main.cc \ | ||
tests/messages_test.cc \ | ||
src/network/asyncchannel.cc \ | ||
src/network/server.cc \ | ||
src/nodes/machine.cc \ | ||
src/nodes/node.cc | ||
src/nodes/node.cc | ||
|
||
metadata_LDADD = $(LDADD_T) | ||
# METADATA TEST | ||
# --------------------------------------------------------------------- | ||
check_PROGRAMS += metadata | ||
metadata_LDADD = $(LDADD_T) -ldl -lsqlite3 | ||
metadata_CPPFLAGS = $(AM_CPPFLAGS_T) | ||
metadata_SOURCES = tests/metadata_test.cc \ | ||
src/fileleader/directory.cc \ | ||
$(messages_files) | ||
|
||
check-integration: integration | ||
bash integration.sh | ||
|
||
integration: | ||
cp $(top_srcdir)/tests/integration_test.sh integration.sh | ||
chmod +x integration.sh | ||
# LOGICAL BLOCKS TEST | ||
# --------------------------------------------------------------------- | ||
if LOGICAL_BLOCKS_FEATURE | ||
check_PROGRAMS += lblocks | ||
TESTS += lblocks | ||
|
||
lblocks_LDADD = $(LDADD_T) -lzookeeper_mt | ||
lblocks_CPPFLAGS = $(AM_CPPFLAGS_T) | ||
lblocks_SOURCES = tests/main.cc \ | ||
tests/stats_scheduler_test.cc \ | ||
src/stats/scheduler_factory.cc \ | ||
src/stats/scheduler_score_based.cc \ | ||
src/stats/scheduler_simple.cc \ | ||
src/stats/zk_listener.cc | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include <settings.hh> | ||
#include <iostream> | ||
#include <sstream> | ||
#include <vector> | ||
#include <messages/filedescription.hh> | ||
#include <common/histogram.hh> | ||
#include <stats/logical_blocks_scheduler.hh> | ||
|
||
using namespace std; | ||
using namespace eclipse::logical_blocks_schedulers; | ||
using namespace eclipse::messages; | ||
|
||
namespace { | ||
|
||
struct listener_1_busy : public eclipse::stats_listener { | ||
listener_1_busy() = default; | ||
~listener_1_busy() = default; | ||
|
||
std::vector<double> get_io_stats() { | ||
return {0.01, 0.01, 0.01, 0.99}; | ||
} | ||
}; | ||
|
||
struct stats_fixture { | ||
std::vector<std::string> nodes = {"1", "2", "3", "4"}; | ||
map<string, string> opts; | ||
FileDescription fd; | ||
|
||
stats_fixture () { | ||
opts["alpha"] = "0.5"; | ||
opts["beta"] = "0.5"; | ||
|
||
fd.name = "file"; | ||
fd.blocks = {"file_1", "file_2", "file_3", "file_4", "file_5"}; | ||
fd.hash_keys = {123123, 124123, 32323, 4242, 424245}; | ||
fd.block_size = {123123, 124123, 32323, 4242, 424245}; | ||
fd.block_hosts= {"1", "2", "3", "4", "4"}; | ||
} | ||
}; | ||
|
||
} | ||
|
||
SUITE(STATS_TESTS) { | ||
|
||
TEST_FIXTURE(stats_fixture, simple_test) { | ||
Histogram boundaries (4, 100); | ||
auto scheduler = scheduler_factory("scheduler_simple", &boundaries, opts); | ||
scheduler->listener.reset(new listener_1_busy()); | ||
scheduler->generate(fd, nodes); | ||
|
||
CHECK_EQUAL(fd.logical_blocks.size(), 4); | ||
CHECK_EQUAL(fd.logical_blocks[0].physical_blocks.size(), 1); | ||
CHECK_EQUAL(fd.logical_blocks[1].physical_blocks.size(), 1); | ||
CHECK_EQUAL(fd.logical_blocks[2].physical_blocks.size(), 1); | ||
CHECK_EQUAL(fd.logical_blocks[3].physical_blocks.size(), 2); | ||
} | ||
|
||
TEST_FIXTURE(stats_fixture, score_based_tests) { | ||
Histogram boundaries (4, 100); | ||
auto scheduler = scheduler_factory("scheduler_score_based", &boundaries, opts); | ||
scheduler->listener.reset(new listener_1_busy()); | ||
scheduler->generate(fd, nodes); | ||
|
||
CHECK_EQUAL(3, fd.logical_blocks.size()); | ||
CHECK_EQUAL(1, fd.logical_blocks[0].physical_blocks.size()); | ||
CHECK_EQUAL(2, fd.logical_blocks[1].physical_blocks.size()); | ||
CHECK_EQUAL(2, fd.logical_blocks[2].physical_blocks.size()); | ||
} | ||
} |