Skip to content

Commit

Permalink
Merge pull request #9 from ecmwf/feature/dhs-logging
Browse files Browse the repository at this point in the history
Add dhs logging
  • Loading branch information
ChrisspyB authored Sep 5, 2024
2 parents 013e10c + de64f9f commit 628dee5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if (HAVE_GRIBJUMP_LOCAL_EXTRACT)
message(FATAL_ERROR "AEC version is too old. Minimum supported version is 1.1.1. Found version: ${AEC_VERSION}")
endif()

# Optional dependency: dhskit
ecbuild_find_package( NAME dhskit VERSION 0.8.6 )
set(GRIBJUMP_HAVE_DHSKIT ${dhskit_FOUND})

endif()

########################################################################################################################
Expand All @@ -66,13 +70,15 @@ if (HAVE_GRIBJUMP_LOCAL_EXTRACT)
add_subdirectory( tests )
endif()

########################################################################################################################
# PLUGIN
# Write and install the manifest file for the plugin
set( gribjump_plugin_file share/plugins/gribjump-plugin.yml )
file( WRITE ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} "plugin:\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " name: gribjump-plugin\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " namespace: int.ecmwf\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " url: http://www.ecmwf.int\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " version: ${${PROJECT_NAME}_VERSION}\n" ) # TODO set version
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " version: ${${PROJECT_NAME}_VERSION}\n" )
file( APPEND ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} " library: gribjump\n" )

install( FILES ${CMAKE_BINARY_DIR}/${gribjump_plugin_file} DESTINATION share/plugins )
Expand Down
4 changes: 4 additions & 0 deletions src/gribjump/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ if( HAVE_GRIBJUMP_LOCAL_EXTRACT )

endif()

if (GRIBJUMP_HAVE_DHSKIT)
list( APPEND SERVER_LIBS dhskit )
endif()

ecbuild_add_library(

TARGET gribjump
Expand Down
1 change: 1 addition & 0 deletions src/gribjump/gribjump_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
// features

#define GRIBJUMP_HAVE_FDB @GRIBJUMP_HAVE_FDB@
#cmakedefine GRIBJUMP_HAVE_DHSKIT

#endif // gribjump_gribjump_config_h
30 changes: 21 additions & 9 deletions src/tools/gribjump-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,38 @@
* does it submit to any jurisdiction.
*/

#include "gribjump/remote/GribJumpServer.h"
#include "eckit/runtime/Application.h"

#include <unistd.h>
#include <fstream>

#include "eckit/config/Resource.h"
#include "eckit/net/Port.h"
#include "eckit/runtime/Application.h"

namespace gribjump {
#include "gribjump/gribjump_config.h"
#include "gribjump/remote/GribJumpServer.h"

#ifdef GRIBJUMP_HAVE_DHSKIT
#include "dhskit/runtime/DHSApplication.h"
#endif

namespace {
#ifdef GRIBJUMP_HAVE_DHSKIT
using BaseApp = dhskit::DHSApplication;
#else
using BaseApp = eckit::Application;
#endif
} // namespace


namespace gribjump {

class GribJumpServerApp : public eckit::Application, public GribJumpServer {
class GribJumpServerApp : public BaseApp, public GribJumpServer {
public:
GribJumpServerApp(int argc, char** argv) :
Application(argc, argv),
GribJumpServer(eckit::net::Port(
"gribJumpServer",
eckit::Resource<int>("$GRIBJUMP_SERVER_PORT;gribjumpServerPort", LibGribJump::instance().config().getInt("server.port", 9777)
BaseApp(argc, argv),
GribJumpServer(eckit::net::Port( // gribjumpServerPort
"gribjumpServer", eckit::Resource<int>("$GRIBJUMP_SERVER_PORT", LibGribJump::instance().config().getInt("server.port", 9777)
)))
{}

Expand All @@ -48,7 +61,6 @@ class GribJumpServerApp : public eckit::Application, public GribJumpServer {


int main(int argc, char** argv) {
eckit::Log::info() << "Starting gribjump server" << std::endl;
gribjump::GribJumpServerApp app(argc, argv);
app.start();
return 0;
Expand Down

0 comments on commit 628dee5

Please sign in to comment.