Skip to content

Commit 97adfc5

Browse files
committed
[add] logging RedisAI git sha on startup
1 parent d8189e5 commit 97adfc5

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/opt/cmake/modules)
77
# Set a default build type if none was specified
88
set(default_build_type "Release")
99

10+
IF(REDISAI_GIT_SHA)
11+
add_definitions(-DREDISAI_GIT_SHA=${REDISAI_GIT_SHA} )
12+
ENDIF()
13+
1014
IF(NOT CMAKE_BUILD_TYPE)
1115
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
1216
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE

opt/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ CMAKE_FLAGS += \
110110
-DDEPS_PATH=$(abspath $(DEPS_DIR)) \
111111
-DINSTALL_PATH=$(abspath $(INSTALL_DIR)) \
112112
-DUSE_COVERAGE=$(USE_COVERAGE) \
113+
-DREDISAI_GIT_SHA=\"$(GIT_SHA)\" \
113114
-DDEVICE=$(DEVICE)
114115

115116
ifeq ($(WITH_TF),0)

src/config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ typedef enum {
1717

1818
typedef enum { RAI_DEVICE_CPU = 0, RAI_DEVICE_GPU = 1 } RAI_Device;
1919

20-
#define RAI_ENC_VER 9900
21-
2220
//#define RAI_COPY_RUN_INPUT
2321
#define RAI_COPY_RUN_OUTPUT
2422
#define RAI_PRINT_BACKEND_ERRORS

src/redisai.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@
2121
#include "util/queue.h"
2222
#include "rmutil/args.h"
2323
#include "run_info.h"
24+
#include "version.h"
2425

2526
#define REDISAI_H_INCLUDE
2627
#include "redisai.h"
2728
#undef REDISAI_H_INCLUDE
2829

30+
#ifndef REDISAI_GIT_SHA
31+
#define REDISAI_GIT_SHA "unknown"
32+
#endif
33+
2934
int redisMajorVersion;
3035
int redisMinorVersion;
3136
int redisPatchVersion;
@@ -1257,7 +1262,8 @@ int RedisModule_OnLoad(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
12571262
return REDISMODULE_ERR;
12581263
}
12591264

1260-
RedisModule_Log(ctx, "notice", "RedisAI version: %d", RAI_ENC_VER);
1265+
RedisModule_Log(ctx, "notice", "RedisAI version %d, git_sha=%s",
1266+
RAI_ENC_VER, REDISAI_GIT_SHA);
12611267

12621268
int flags = RedisModule_GetContextFlags(ctx);
12631269

src/redisai.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include "model_struct.h"
88
#include "model_script_run_session.h"
99
#include "background_workers.h"
10-
11-
#define REDISAI_LLAPI_VERSION 1
10+
#include "version.h"
1211

1312
#define MODULE_API_FUNC(x) (*x)
1413

src/version.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef SRC_VERSION_H_
2+
#define SRC_VERSION_H_
3+
4+
#define RAI_ENC_VER 9900
5+
6+
/* API versions. */
7+
#define REDISAI_LLAPI_VERSION 1
8+
9+
#endif /* SRC_VERSION_H_ */

0 commit comments

Comments
 (0)