Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4d1f0c6
First example success with cmake
May 29, 2025
aed2e76
Further CMake integration (all C++ examples up through example 8)
May 30, 2025
cade82f
All C++ examples now work with CMake (example 10 is broken for other …
May 30, 2025
c58f53f
Example 10 "fixed"
Jun 2, 2025
9686712
Python is pythoning with Cmake!
Jun 3, 2025
8a49d12
All examples done (up for review)
Jun 10, 2025
5408c0d
Initial comment fixes
Jun 11, 2025
f5bae66
Made all configure files with CMake cache variables
Jun 13, 2025
fb28eab
Further changes made for Pull Request.
Jun 17, 2025
98f2db8
Java examples with spdlog
Jun 17, 2025
ddde401
run.sh.in files pushed
Jun 20, 2025
c0dcbf0
example 4 run.sh updated
Jun 23, 2025
5d852b5
Better integration with external builds
Jun 23, 2025
6017012
Better integration with external builds
Jun 23, 2025
6a3bc9f
First five examples with bat files
Jun 23, 2025
19fd85d
Java bat files
Jun 23, 2025
c8856f7
Fixed Install Prefix for external build
Jun 24, 2025
cbba14f
Examples now work for both internal and external builds
Jun 25, 2025
7a1c15d
Removed absolute path from CMakeLists
Jun 26, 2025
771ebff
Java examples now compile in both Windows and Linux
Jun 26, 2025
cc6486d
Examples 2, 9 and 13 can now all be compiled together
Jun 30, 2025
9a1e372
2, 9 and 13 files cont.
Jun 30, 2025
2c240de
Python fixes
Jun 30, 2025
b57a2f9
Library path fixes
Jun 30, 2025
8f938ef
More python fixes for dependencies
Jul 1, 2025
0164812
ignores unnecessary files now
Jul 1, 2025
c084efd
Removed clutter from top level
Jul 2, 2025
5f6b3be
Java protobuf jar default path set
FlinkerBluid Jul 31, 2025
bccfb0b
Example 14 cmakelists modified
FlinkerBluid Jul 31, 2025
ba99c37
Alma build fix attempt 1
FlinkerBluid Jul 31, 2025
14b257c
Attempt 2
FlinkerBluid Jul 31, 2025
a03eb9d
2AAA
FlinkerBluid Jul 31, 2025
67453fc
attempt 3
FlinkerBluid Jul 31, 2025
239b029
3A
FlinkerBluid Jul 31, 2025
464de4e
3C
FlinkerBluid Jul 31, 2025
e24f5d7
4
FlinkerBluid Jul 31, 2025
39bb30f
4B
FlinkerBluid Jul 31, 2025
8edb453
4C
FlinkerBluid Jul 31, 2025
a0dc6f6
5
FlinkerBluid Jul 31, 2025
4b6e99b
5B
FlinkerBluid Jul 31, 2025
5ac9cee
6
FlinkerBluid Jul 31, 2025
ecbd4b7
5c
FlinkerBluid Jul 31, 2025
51fb6c2
6
FlinkerBluid Jul 31, 2025
e1f31ac
7
FlinkerBluid Jul 31, 2025
a2ef678
6 restored
FlinkerBluid Jul 31, 2025
81a05ab
6 again
FlinkerBluid Jul 31, 2025
68c8d50
7
FlinkerBluid Aug 1, 2025
9bc1cad
Merge remote-tracking branch 'kguilbert/private-spdlog'
FlinkerBluid Aug 1, 2025
a1d7072
CMakeLists changes in files not already changed in merge
FlinkerBluid Aug 1, 2025
913260c
Merge remote-tracking branch 'gravity/master'
FlinkerBluid Aug 1, 2025
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ option(SKIP_PYTHON "Skip building Gravity Python wrapper")
set(JAVA_HOME "" CACHE PATH "Path to JDK to use")
set(Protobuf_SRC_ROOT_FOLDER "" CACHE PATH "Path to Protobuf source build")
set(ZMQ_HOME "" CACHE PATH "Path to your local ZeroMQ installation")
set(JAVA_PROTOBUF_JAR "/usr/share/java/protobuf.jar" CACHE PATH "Location of protobuf jar file")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me - making it a cache variable with a default, you can over-ride from the command line if necessary


get_filename_component(ABS_CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE BASE_DIR "${CMAKE_BINARY_DIR}")
string(REPLACE "\"" "" ABS_CMAKE_INSTALL_PREFIX "${ABS_CMAKE_INSTALL_PREFIX}")
Expand Down Expand Up @@ -156,6 +157,7 @@ set(GRAVITY_USING_EXTERNAL_PROTOBUF)

if (Protobuf_FOUND AND NOT GRAVITY_USE_EXTERNAL_PROTOBUF)
message(STATUS "Using local protobuf libraries")

else()
message(STATUS "Using external protobuf build")
set(GRAVITY_USING_EXTERNAL_PROTOBUF ON)
Expand Down Expand Up @@ -312,7 +314,9 @@ else()
LIST_SEPARATOR |
CMAKE_ARGS
-DGRAVITY_ROOT=${PUBLIC_STAGING_DIR}
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/test/examples
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/test/examples
-DTOPLEVEL_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DEXTERNAL_JAVA_JAR=${protobufs-java_BINARY_DIR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-DSKIP_JAVA=${SKIP_JAVA}
Expand Down
2 changes: 2 additions & 0 deletions cmake/FindZeroMQ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ if(ZeroMQ_LIBRARY)
IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(libzmq PROPERTIES
IMPORTED_LOCATION_RELEASE "${ZeroMQ_LIBRARY_RELEASE}")
cmake_path(GET ZeroMQ_LIBRARY_RELEASE PARENT_PATH ZeroMQ_LIBRARY_DIRECTORY)
set(ZeroMQ_LIBRARY_DIRECTORY "${ZeroMQ_LIBRARY_DIRECTORY}" CACHE ON FILEPATH)
endif()
if(EXISTS "${ZeroMQ_LIBRARY_DEBUG}")
set_property(TARGET libzmq APPEND PROPERTY
Expand Down
12 changes: 6 additions & 6 deletions src/api/java/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ include(UseJava)
gravity_find_protobuf(ON)

# TODO check GRAVITY_USING_EXTERNAL_PROTOBUF
set(PUBLIC_JAR "/usr/share/java/protobuf.jar" "${Protobuf_SRC_ROOT_FOLDER}/java/target/protobuf-java-${Protobuf_VERSION}.jar")
#set(PUBLIC_JAR "/usr/share/java/protobuf.jar" "${Protobuf_SRC_ROOT_FOLDER}/java/target/protobuf-java-${Protobuf_VERSION}.jar")
set(PUBLIC_JAR "${JAVA_PROTOBUF_JAR}" "${Protobuf_SRC_ROOT_FOLDER}/java/target/protobuf-java-${Protobuf_VERSION}.jar")

set(CMAKE_JAVA_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/protobuf-java.jar" ${PUBLIC_JAR})

set(CMAKE_JAVA_COMPILE_FLAGS -sourcepath "${CMAKE_CURRENT_LIST_DIR}/src/java")

set(JAVA_SRCS
Expand Down Expand Up @@ -72,8 +74,6 @@ gravity_add_jar_debug_release(${PROJECT_NAME} SOURCES ${JAVA_SRCS} ${JAVA_PROTO_
"${CMAKE_BINARY_DIR}/java/com/aphysci/gravity/swig/gravityJNI.java"
"${CMAKE_BINARY_DIR}/java/com/aphysci/gravity/swig/gravity.java"
"${CMAKE_BINARY_DIR}/java/com/aphysci/gravity/swig/gravityConstants.java"
OUTPUT_NAME gravity)


gravity_install_jar(${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
gravity_add_dependency(${PROJECT_NAME})
OUTPUT_NAME gravity
OUTPUT_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
gravity_add_dependency(${PROJECT_NAME})
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ endif()
if (NOT SKIP_PYTHON)
add_subdirectory(api/python)
endif()
add_subdirectory(examples)
add_subdirectory(examples)
2 changes: 2 additions & 0 deletions test/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
run.sh
cmake_build
bin
*Debug.bat
*Release.bat
8 changes: 6 additions & 2 deletions test/examples/1-BasicDataProduct/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.17)
project(BasicDataProduct)
#
# see CMakeLists.txt one level up on how to set up CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH
# see CMakeLists.txt one level up on how to set up CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH
#


find_package(Gravity QUIET)
find_package(Gravity QUIET)

# since we use spdlog directly
find_package(spdlog REQUIRED)
Expand All @@ -19,3 +19,7 @@ target_link_libraries(BasicDataProductPublisher PRIVATE gravity spdlog::spdlog_h
add_executable(BasicDataProductSubscriber BasicDataProductSubscriber.cpp)
set_target_properties(BasicDataProductSubscriber PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
target_link_libraries(BasicDataProductSubscriber PRIVATE gravity spdlog::spdlog_header_only)

configure_file(run.sh.in ${BasicDataProduct_SOURCE_DIR}/run.sh)
configure_file(RunBasicDataProductDebug.bat.in ${BasicDataProduct_SOURCE_DIR}/RunBasicDataProductDebug.bat)
configure_file(RunBasicDataProductRelease.bat.in ${BasicDataProduct_SOURCE_DIR}/RunBasicDataProductRelease.bat)
19 changes: 19 additions & 0 deletions test/examples/1-BasicDataProduct/Gravity.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# This section is common to all components
#
[general]
# Set the log level for logs written to the log file
GravityFileLogLevel=debug

# Set the log level for logs written to the console that started the component
#Can make output look funky, so uncomment at your own risk
#GravityConsoleLogLevel=debug

# Without this, Gravity will spend a few seconds trying to retrieve
# parameters from a remote ConfigServer.
NoConfigServer=true

# The URL where the ServiceDirectory will be found. This value is the same as the default.
ServiceDirectoryURL="tcp://localhost:5555"


16 changes: 16 additions & 0 deletions test/examples/1-BasicDataProduct/RunBasicDataProductDebug.bat.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
setlocal

cd @CMAKE_INSTALL_PREFIX@/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/deps/libzmq/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/deps/protobuf/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/bin
set Path=%Path%;@LOCAL_ZEROMQ_RUNTIME_DIR@
set path=%Path%;@LOCAL_PROTOBUF_RUNTIME_DIR@
set path=%Path%;@BasicDataProduct_BINARY_DIR@/Debug

start ServiceDirectory@CMAKE_DEBUG_POSTFIX@.exe
sleep 3
start BasicDataProductPublisher@CMAKE_DEBUG_POSTFIX@.exe
sleep 3
start BasicDataProductSubscriber@CMAKE_DEBUG_POSTFIX@.exe
16 changes: 16 additions & 0 deletions test/examples/1-BasicDataProduct/RunBasicDataProductRelease.bat.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
setlocal

cd @CMAKE_INSTALL_PREFIX@/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/deps/libzmq/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/deps/protobuf/bin
set Path=%Path%;@ABS_GRAVITY_ROOT@/bin
set Path=%Path%;@LOCAL_ZEROMQ_RUNTIME_DIR@
set path=%Path%;@LOCAL_PROTOBUF_RUNTIME_DIR@
set path=%Path%;@BasicDataProduct_BINARY_DIR@/Release

start ServiceDirectory.exe
sleep 3
start BasicDataProductPublisher.exe
sleep 3
start BasicDataProductSubscriber.exe
18 changes: 12 additions & 6 deletions test/examples/1-BasicDataProduct/run.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@
# @configure_input@

# Tool-related substitution variables
PROTOBUF_LIB_DIR=@PROTOBUF_LIBDIR@
ZMQ_LIB_DIR=@ZEROMQ_LIBDIR@
PROTOBUF_LIB_DIR=@Protobuf_LIBRARY_RELEASE@
ZMQ_LIB_DIR=@ZeroMQ_LIBRARY_RELEASE@
ONE_BIN_DIR=@BasicDataProduct_BINARY_DIR@
SD_BIN_DIR=@ServiceDirectory_BINARY_DIR@ #For internal builds
COMP_BIN_DIR=@TOPLEVEL_INSTALL_PREFIX@/bin #For external builds
CME_LIB_DIR=@TOPLEVEL_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
CMI_LIB_DIR=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@

export PATH=$PATH:../../../src/components/cpp/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../../src/api/cpp:../../../src/keyvalue_parser:$ZMQ_LIB_DIR:$PROTOBUF_LIB_DIR

export PATH=$PATH:$ONE_BIN_DIR:$SD_BIN_DIR:$COMP_BIN_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../../src/api/cpp:../../../src/keyvalue_parser:$ZMQ_LIB_DIR:$PROTOBUF_LIB_DIR:$CME_LIB_DIR:$CMI_LIB_DIR

control_c()
# run if user hits control-c
Expand All @@ -42,10 +48,10 @@ SDPID=$!
# sleep for a second to give the service directory a chance to start up
sleep 1

./BasicDataProductPublisher &
BasicDataProductPublisher &
PUBPID=$!

# sleep for a second to give the publisher a chance to register its data product
sleep 1

./BasicDataProductSubscriber
BasicDataProductSubscriber
5 changes: 4 additions & 1 deletion test/examples/10-Archiving/ArchiveTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#include <iostream>
#include <GravityNode.h>
#include <GravityLogger.h>
#include <spdlog/spdlog.h>
#include <Utility.h>

#include "../protobuf/BasicCounterDataProduct.pb.h"
#include "BasicCounterDataProduct.pb.h"
#include "protobuf/FileArchiverControlRequestPB.pb.h"

int main()
Expand Down Expand Up @@ -75,10 +76,12 @@ int main()
count++;
if (count > 50) count = 1;

//Turns archiving on and off every 5 count (on->off->on....)
if (count % 5 == 0)
{
GravityDataProduct gdp("FileArchiverControlRequest");
FileArchiverControlRequestPB request;
//Suspend flag turns off further input into the archiver
Comment thread
mbarger99 marked this conversation as resolved.
request.set_suspend(suspend);
suspend = !suspend;
gdp.setData(request);
Expand Down
34 changes: 34 additions & 0 deletions test/examples/10-Archiving/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
cmake_minimum_required(VERSION 3.17)
project(Archiving)
#
# see CMakeLists.txt on how to set up CMAKE_PREFIX_PATH and CMAKE_MODULE_PATH
#

# for gravity_protobuf_generate
include(GravitySupport)


find_package(spdlog REQUIRED)
find_package(Gravity QUIET)

file(GLOB PROTO_FILES "${CMAKE_CURRENT_LIST_DIR}/../protobuf/*.proto")

gravity_protobuf_generate(APPEND_PATH PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR} OUT_VAR PROTO_SRCS
PROTOS ${PROTO_FILES})

add_custom_target(${PROJECT_NAME}_protos ALL DEPENDS ${PROTO_SRCS})

set(CMAKE_DEBUG_POSTFIX _d)
add_executable(ArchiveTest ArchiveTest.cpp ${PROTO_SRCS})
set_target_properties(ArchiveTest PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
target_link_libraries(ArchiveTest PRIVATE gravity spdlog::spdlog_header_only)
target_include_directories(ArchiveTest PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(ArchiveTest ${PROJECT_NAME}_protos)

add_executable(ReplayTest ReplayTest.cpp ${PROTO_SRCS})
set_target_properties(ReplayTest PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
target_link_libraries(ReplayTest PRIVATE gravity spdlog::spdlog_header_only)
target_include_directories(ReplayTest PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
add_dependencies(ReplayTest ${PROJECT_NAME}_protos)

configure_file(run.sh.in ${Archiving_SOURCE_DIR}/run.sh)
5 changes: 3 additions & 2 deletions test/examples/10-Archiving/Gravity.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
[general]
ServiceDirectoryURL="tcp://localhost:5555"
NoConfigServer=true
LocalLogLevel=debug
ConsoleLogLevel=debug
GravityLocalLogLevel=debug
GravityFileLogLevel=debug
#GravityConsoleLogLevel=debug

[FileArchiver]
ArchiveFilename="archive.bin"
Expand Down
3 changes: 2 additions & 1 deletion test/examples/10-Archiving/ReplayTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
#include <GravityNode.h>
#include <GravityLogger.h>
#include <GravitySubscriber.h>
#include <spdlog/spdlog.h>
#include <Utility.h>

#include "../protobuf/BasicCounterDataProduct.pb.h"
#include "BasicCounterDataProduct.pb.h"

using namespace gravity;
using namespace std;
Expand Down
23 changes: 15 additions & 8 deletions test/examples/10-Archiving/run.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@
# @configure_input@

# Tool-related substitution variables
PROTOBUF_LIB_DIR=@PROTOBUF_LIBDIR@
ZMQ_LIB_DIR=@ZEROMQ_LIBDIR@
PROTOBUF_LIB_DIR=@Protobuf_LIBRARY_RELEASE@
ZMQ_LIB_DIR=@ZeroMQ_LIBRARY_RELEASE@
TEN_BIN_DIR=@Archiving_BINARY_DIR@
SD_BIN_DIR=@ServiceDirectory_BINARY_DIR@
ARCH_BIN_DIR=@Archiver_BINARY_DIR@
PB_BIN_DIR=@Playback_BINARY_DIR@
COMP_BIN_DIR=@TOPLEVEL_INSTALL_PREFIX@/bin #For external builds
CME_LIB_DIR=@TOPLEVEL_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
CMI_LIB_DIR=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@

export PATH=$PATH:../../../src/components/cpp/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../../src/api/cpp:../../../src/keyvalue_parser:$ZMQ_LIB_DIR:$PROTOBUF_LIB_DIR
export PATH=$PATH:$TEN_BIN_DIR:$SD_BIN_DIR:$ARCH_BIN_DIR:$PB_BIN_DIR:$COMP_BIN_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../../src/api/cpp:../../../src/keyvalue_parser:$ZMQ_LIB_DIR:$PROTOBUF_LIB_DIR:$CME_LIB_DIR:$CMI_LIB_DIR

cleanup()
# run if user hits control-c
Expand Down Expand Up @@ -58,9 +65,9 @@ SDPID=$!
# 5 seconds, ArchiveTest will toggle the suspend flag on the FileArchiver. This means
# that only about half of the published counter values will be archived.
##
FileArchiver &
Archiver &
FAPID=$!
./ArchiveTest &
ArchiveTest &
ATPID=$!

sleep 20
Expand All @@ -77,9 +84,9 @@ sleep 1
# and that the messages that were archived are still published once a second - just like ArchiveTest did originally.
##
echo Starting ReplayTest
./ReplayTest &
ReplayTest &
RTPID=$!
FileReplay &
Playback &
FRPID=$!

sleep 20
Expand Down
2 changes: 2 additions & 0 deletions test/examples/11-PythonPubSub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ set_property(TEST pypubsub PROPERTY ENVIRONMENT_MODIFICATION
"PYTHONPATH=path_list_prepend:${ABS_GRAVITY_ROOT}/${CMAKE_INSTALL_LIBDIR}"
"PYTHONPATH=path_list_prepend:${CMAKE_CURRENT_BINARY_DIR}"
)

configure_file(run.sh.in ${PythonPubSub_SOURCE_DIR}/run.sh)
4 changes: 2 additions & 2 deletions test/examples/11-PythonPubSub/Gravity.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[general]
ServiceDirectoryURL="tcp://127.0.0.1:5555"
NoConfigServer=true
LocalLogLevel=DEBUG
ConsoleLogLevel=DEBUG
GravityFileLogLevel=DEBUG
#GravityConsoleLogLevel=DEBUG

14 changes: 10 additions & 4 deletions test/examples/11-PythonPubSub/pypub.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@

import time
import logging

from gravity import GravityNode, GravityDataProduct, gravity, GravitySubscriber, Log
from gravity import GravityNode, GravityDataProduct, gravity, GravitySubscriber, SpdLogHandler
from BasicCounterDataProduct_pb2 import BasicCounterDataProductPB




class MySubscriber(GravitySubscriber):
# We're only using GravitySubscriber here, but this is generally the way we
# initialize Gravity Python components to ensure that __init__ is called
Expand All @@ -16,15 +19,18 @@ def subscriptionFilled(self, dataProducts):
counterPB = BasicCounterDataProductPB()
for gdp in dataProducts:
gdp.populateMessage(counterPB)
Log.message("received counter with value = "+str(counterPB.count))
gravlogger.warning("received counter with value = "+str(counterPB.count))


gravlogger = logging.getLogger()
gravlogger.setLevel(logging.WARNING) # let all logs pass through to Gravity logger
gravlogger.addHandler(SpdLogHandler(True))
mySub = MySubscriber()

gn = GravityNode()
while gn.init("PyPub") != gravity.SUCCESS:
Log.warning("failed to init, retrying...")
gravlogger.warning("failed to init, retrying...")
time.sleep(1)

gn.registerDataProduct("PythonGDP", gravity.TCP)
gn.subscribe("PythonGDP", mySub)

Expand Down
Loading
Loading