Skip to content

Commit 5c9ed9a

Browse files
authored
Merge pull request #440 from CrayLabs/develop
This PR brings master up to date with develop for v0.5.0 release. [ committed by @al-rigazzi ] [ reviewed by @billschereriii @MattToast ]
2 parents 6a4ef5a + 6c3c5d3 commit 5c9ed9a

File tree

163 files changed

+2893
-1220
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2893
-1220
lines changed

.github/workflows/run_post_merge_tests.yml renamed to .github/workflows/run_static_and_examples.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,24 @@
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
#
2828

29-
name: run_post_merge_tests
30-
31-
# This file is for tests that are to be run rarely, once on each merge.
29+
name: run_static_and_examples
3230

3331
on:
3432
push:
3533
branches:
3634
- master
3735
- develop
38-
36+
pull_request:
37+
branches:
38+
- master
39+
- develop
3940
env:
4041
HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker
4142
HOMEBREW_NO_AUTO_UPDATE: "ON"
4243
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
4344
HOMEBREW_NO_GITHUB_API: "ON"
4445
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
4546
DEBIAN_FRONTEND: "noninteractive" # disable interactive apt installs
46-
SSDB: "127.0.0.1:6379"
47-
SMARTREDIS_TEST_CLUSTER: False
4847

4948
jobs:
5049

@@ -56,7 +55,7 @@ jobs:
5655
matrix:
5756
os: [ubuntu-20.04] # cannot test on macOS as docker isn't supported on Mac
5857
compiler: [intel, 8, 9, 10, 11] # intel compiler, and versions of GNU compiler
59-
rai_v: [1.2.4, 1.2.5] # versions of RedisAI
58+
rai_v: [1.2.7] # version(s) of RedisAI
6059
py_v: ['3.7.x', '3.8.x', '3.9.x', '3.10.x'] # versions of Python
6160
env:
6261
FC: gfortran-${{ matrix.compiler }}
@@ -97,12 +96,15 @@ jobs:
9796
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB &&
9897
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list &&
9998
sudo apt-get update -y &&
100-
sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
99+
sudo apt-get install -y intel-oneapi-compiler-fortran &&
101100
source /opt/intel/oneapi/setvars.sh &&
101+
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
102+
sudo apt-get install -y intel-oneapi-common-vars &&
103+
source /opt/intel/oneapi/setvars.sh --force &&
102104
printenv >> $GITHUB_ENV &&
103105
echo "CC=icx" >> $GITHUB_ENV &&
104106
echo "CXX=icpx" >> $GITHUB_ENV &&
105-
echo "FC=ifort" >> $GITHUB_ENV
107+
echo "FC=ifx" >> $GITHUB_ENV
106108
107109
# Install additional dependencies
108110
- name: Install Cmake Linux

.github/workflows/run_tests.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
fail-fast: false
6060
matrix:
6161
os: [ubuntu-20.04] # cannot test on macOS as docker isn't supported on Mac
62-
rai_v: [1.2.4, 1.2.5] # versions of RedisAI
62+
rai_v: [1.2.7] # versions of RedisAI
6363
py_v: ['3.7.x', '3.8.x', '3.9.x', '3.10.x'] # versions of Python
6464
compiler: [intel, 8, 9, 10, 11] # intel compiler, and versions of GNU compiler
6565
env:
@@ -75,6 +75,13 @@ jobs:
7575
with:
7676
python-version: ${{ matrix.py_v }}
7777

78+
# Free up some disk space
79+
- name: Free disk space
80+
run: |
81+
sudo rm -rf /usr/share/dotnet &&
82+
sudo rm -rf /opt/ghc &&
83+
sudo rm -rf "/usr/local/share/boost"
84+
7885
# Install compilers (Intel or GCC)
7986
- name: Install GCC
8087
if: "!contains( matrix.compiler, 'intel' )" # if using GNU compiler
@@ -101,12 +108,34 @@ jobs:
101108
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB &&
102109
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list &&
103110
sudo apt-get update -y &&
104-
sudo apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
111+
sudo apt-get install -y intel-oneapi-compiler-fortran &&
105112
source /opt/intel/oneapi/setvars.sh &&
113+
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
114+
sudo apt-get install -y intel-oneapi-common-vars &&
115+
source /opt/intel/oneapi/setvars.sh --force &&
106116
printenv >> $GITHUB_ENV &&
107117
echo "CC=icx" >> $GITHUB_ENV &&
108118
echo "CXX=icpx" >> $GITHUB_ENV &&
109-
echo "FC=ifort" >> $GITHUB_ENV
119+
echo "FC=ifx" >> $GITHUB_ENV
120+
121+
# Set up perl environment for LCOV
122+
- uses: actions/checkout@v3
123+
- name: Setup perl
124+
uses: shogo82148/actions-setup-perl@v1
125+
with:
126+
perl-version: '5.30'
127+
install-modules: Memory::Process
128+
129+
# Install additional perl Modules
130+
- name: Add perl modules
131+
run: |
132+
sudo apt install libcapture-tiny-perl && \
133+
sudo apt install libdatetime-perl && \
134+
sudo apt install libdevel-cover-perl && \
135+
sudo apt install libdigest-md5-perl && \
136+
sudo apt install libfile-spec-perl && \
137+
sudo apt install libjson-xs-perl && \
138+
sudo apt install libtime-hires-perl
110139
111140
# Install additional dependencies
112141
- name: Install Cmake Linux
@@ -167,7 +196,7 @@ jobs:
167196
168197
# Process and upload code coverage (Python was collected during pytest)
169198
- name: Collect coverage from C/C++/Fortran testers
170-
run: third-party/lcov/install/usr/local/bin/lcov -c -d build/Coverage/CMakeFiles -o coverage.info
199+
run: third-party/lcov/install/bin/lcov --ignore-errors gcov,mismatch --keep-going -c -d build/Coverage/CMakeFiles -o coverage.info
171200

172201
- name: Upload coverage to Codecov
173202
uses: codecov/codecov-action@v3

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ endif (POLICY CMP0048)
3131

3232
# Project definition for the SmartRedis project
3333
cmake_minimum_required(VERSION 3.13)
34-
project(SmartRedis VERSION "0.4.2")
34+
project(SmartRedis VERSION "0.5.0")
3535

3636
# Configure options for the SmartRedis project
3737
option(SR_PYTHON "Build the python module" OFF)

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SmartRedis and SmartSim share the same contributor guidelines. Please refer to
2+
[CONTRIBUTING.rst](https://github.com/CrayLabs/SmartSim/blob/develop/CONTRIBUTING.rst)
3+
in the SmartSim repo or at CrayLabs[https://www.craylabs.org/docs/contributing.html]

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# General settings
2828
MAKEFLAGS += --no-print-directory
2929
SHELL:=/bin/bash
30+
CWD := $(shell pwd)
3031

3132
# Params for third-party software
3233
HIREDIS_URL := https://github.com/redis/hiredis.git
@@ -42,7 +43,7 @@ REDISAI_URL := https://github.com/RedisAI/RedisAI.git
4243
CATCH2_URL := https://github.com/catchorg/Catch2.git
4344
CATCH2_VER := v2.13.6
4445
LCOV_URL := https://github.com/linux-test-project/lcov.git
45-
LCOV_VER := v1.15
46+
LCOV_VER := v2.0
4647

4748
# Build variables
4849
NPROC := $(shell nproc 2>/dev/null || python -c "import multiprocessing as mp; print (mp.cpu_count())" 2>/dev/null || echo 4)
@@ -58,7 +59,7 @@ SR_TEST_REDIS_MODE := Clustered
5859
SR_TEST_UDS_FILE := /tmp/redis.sock
5960
SR_TEST_PORT := 6379
6061
SR_TEST_NODES := 3
61-
SR_TEST_REDISAI_VER := v1.2.3
62+
SR_TEST_REDISAI_VER := v1.2.7
6263
SR_TEST_DEVICE := cpu
6364
SR_TEST_PYTEST_FLAGS := -vv -s
6465

@@ -318,7 +319,7 @@ SSDB_STRING := $(shell echo $(SSDB_STRING) | tr -d " ")
318319
# 1: the test directory in which to run tests
319320
define run_smartredis_tests_with_standalone_server
320321
echo "Launching standalone Redis server" && \
321-
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_SERVER_MODE=Standalone && \
322+
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_DB_TYPE=Standalone && \
322323
export SMARTREDIS_TEST_CLUSTER=False SMARTREDIS_TEST_DEVICE=$(SR_TEST_DEVICE) && \
323324
export SSDB=127.0.0.1:$(SR_TEST_PORT) && \
324325
python utils/launch_redis.py --port $(SR_TEST_PORT) --nodes 1 \
@@ -340,7 +341,7 @@ endef
340341
# 1: the test directory in which to run tests
341342
define run_smartredis_tests_with_clustered_server
342343
echo "Launching clustered Redis server" && \
343-
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_SERVER_MODE=Clustered && \
344+
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_DB_TYPE=Clustered && \
344345
export SMARTREDIS_TEST_CLUSTER=True SMARTREDIS_TEST_DEVICE=$(SR_TEST_DEVICE) && \
345346
export SSDB=$(SSDB_STRING) && \
346347
python utils/launch_redis.py --port $(SR_TEST_PORT) --nodes $(SR_TEST_NODES) \
@@ -364,7 +365,7 @@ endef
364365
# 1: the test directory in which to run tests
365366
define run_smartredis_tests_with_uds_server
366367
echo "Launching standalone Redis server with Unix Domain Socket support"
367-
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_SERVER_MODE=Standalone && \
368+
export SR_TEST_DEVICE=$(SR_TEST_DEVICE) SR_DB_TYPE=Standalone && \
368369
export SMARTREDIS_TEST_CLUSTER=False SMARTREDIS_TEST_DEVICE=$(SR_TEST_DEVICE) && \
369370
export SSDB=unix://$(SR_TEST_UDS_FILE) && \
370371
python utils/launch_redis.py --port $(SR_TEST_PORT) --nodes 1 \
@@ -596,12 +597,13 @@ third-party/catch/single_include/catch2/catch.hpp:
596597

597598
# LCOV (hidden test target)
598599
.PHONY: lcov
599-
lcov: third-party/lcov/install/usr/local/bin/lcov
600-
third-party/lcov/install/usr/local/bin/lcov:
600+
lcov: third-party/lcov/install/bin/lcov
601+
third-party/lcov/install/bin/lcov:
602+
@echo Installing LCOV
601603
@mkdir -p third-party
602604
@cd third-party && \
603605
git clone $(LCOV_URL) lcov --branch $(LCOV_VER) --depth=1
604606
@cd third-party/lcov && \
605607
mkdir -p install && \
606-
CC=gcc CXX=g++ DESTDIR="install/" make install && \
608+
CC=gcc CXX=g++ make PREFIX=$(CWD)/third-party/lcov/install/ install && \
607609
echo "Finished installing LCOV"

conftest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
np.uint64,
5454
]
5555

56-
@pytest.fixture
57-
def use_cluster():
58-
return os.getenv('SMARTREDIS_TEST_CLUSTER', "").lower() == 'true'
59-
6056
@pytest.fixture
6157
def mock_data():
6258
return MockTestData

doc/advanced_topics.rst

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Advanced Topics
55
This page of documentation is reserved for advanced topics
66
that may not be needed for all users.
77

8-
.. _advanced_topics_dataset_aggregation:
8+
.. _advanced-topics-dataset-aggregation:
99

1010
Dataset Aggregation
1111
===================
@@ -92,15 +92,15 @@ predicate is matched on the length of the list:
9292

9393
.. code-block:: cpp
9494
95-
# Block until the list reaches a specific length
95+
// Block until the list reaches a specific length
9696
bool poll_list_length(const std::string& name, int list_length,
9797
int poll_frequency_ms, int num_tries);
9898
99-
# Block until the list reaches or exceeds a specific length
99+
// Block until the list reaches or exceeds a specific length
100100
bool poll_list_length_gte(const std::string& name, int list_length,
101101
int poll_frequency_ms, int num_tries);
102102
103-
# Block until the list is no longer than a specific length
103+
// Block until the list is no longer than a specific length
104104
bool poll_list_length_lte(const std::string& name, int list_length,
105105
int poll_frequency_ms, int num_tries);
106106
@@ -114,13 +114,72 @@ lead to race conditions:
114114

115115
.. code-block:: cpp
116116
117-
# Copy an aggregation list
117+
// Copy an aggregation list
118118
void copy_list(const std::string& src_name,
119119
const std::string& dest_name);
120120
121-
# Rename an aggregation list
121+
// Rename an aggregation list
122122
void rename_list(const std::string& src_name,
123123
const std::string& dest_name);
124124
125-
# Delete an aggregation list
125+
// Delete an aggregation list
126126
void delete_list(const std::string& list_name);
127+
128+
.. _advanced-topics-multi-db:
129+
130+
Multiple Database Support
131+
=========================
132+
133+
SmartRedis offers clients the ability to interact with multiple databases
134+
concurrently. Each Client represents a connection to a specific database,
135+
but an application with multiple clients can have each one connected to a
136+
different database.
137+
138+
Differentiating databases via environment variables
139+
---------------------------------------------------
140+
141+
In order to differentiate the databases that clients connect to, SmartRedis
142+
relies on differentiation in the environment variables that the client uses
143+
to initialize itself. Of primary importance here are the SSDB and SR_DB_TYPE
144+
variables, but all environment variables (other than SR_LOG_LEVEL and
145+
SR_LOG_FILE, which are shared for all databases) are duplicated in order to
146+
represent additional databases.
147+
148+
This duplication is done via suffixing: an underscore and the identifier for
149+
the database are suffixed to the base variable names to derive a set of
150+
environment variables specific to each database. For example, SSDB_INPUT
151+
and SR_DB_TYPE_INPUT reflect a database named ``INPUT``.
152+
153+
For backward compatibility, the default database is anonymous and thus its
154+
environment variables use neither an underscore nor a database name. This
155+
behavior exactly matches earlier releases of SmartRedis.
156+
157+
Instantiating Clients for named databases
158+
-----------------------------------------
159+
160+
Beginning with version 0.5.0 of SmartRedis, users can initialize Clients
161+
using a new construction method that accepts a ConfigOptions object as
162+
an input parameter. In turn, the ConfigOptions object can be constructed
163+
via the ConfigOptions create_from_environment() factory method, which
164+
accepts the suffix to be applied to environment variables when looking
165+
them up (or an empty string, to indicate that the default names should be
166+
used, as for an anonymous database). Depending on the programming language
167+
for the SmartRedis client, variously None, NULL, or skipping the
168+
ConfigOptions parameter altogether also implicitly requests an anonymous
169+
database.
170+
171+
For example, to create a Client for a database named ``INPUT`` in C++,
172+
one would write the following code:
173+
174+
.. code-block:: cpp
175+
176+
// Create a ConfigOptions object
177+
auto co = ConfigOptions::create_from_environment("INPUT");
178+
179+
// Pass it to the Client constructor along with an identifier for logging
180+
Client* input_client = new Client(co, "input_client");
181+
182+
Note that with the Client constructor that accepts a ConfigOptions object,
183+
there is no parameter for whether the database is clustered or not. This is
184+
because the type of database is now read in from the SR_DB_TYPE environment
185+
variable (with optional {_suffix}).

0 commit comments

Comments
 (0)