Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dhs logging #9

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading