Skip to content

Commit

Permalink
Small tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisspyB committed Oct 4, 2024
1 parent 07aa255 commit 8453943
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/gribjump/Engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ void Engine::forwardRemoteExtraction(filemap_t& filemap) {
// format: fdbhost:port -> gjhost:port
/// @todo: dont parse servermap every request
std::map<std::string, std::string> servermap_str = LibGribJump::instance().config().getMap("servermap");
ASSERT(!servermap_str.empty());

for (auto& [fdb, gj] : servermap_str) {
LOG_DEBUG_LIB(LibGribJump) << "Servermap: " << fdb << " -> " << gj << std::endl;
Expand All @@ -188,17 +189,13 @@ void Engine::forwardRemoteExtraction(filemap_t& filemap) {
for (auto& [fname, extractionItems] : filemap) {
eckit::URI uri = extractionItems[0]->URI();
eckit::net::Endpoint fdbEndpoint;
if(!isRemote(uri)){
// throw eckit::SeriousBug("File is not remote: " + fname);
// XXX: this is an error. For development, we will treat it as dummy.
///@todo: remove this
std::cout << "XXX File is not remote: " << fname << std::endl;
fdbEndpoint = eckit::net::Endpoint("dummy", 1234);
}
else {
fdbEndpoint = eckit::net::Endpoint(uri.host(), uri.port());

if(!isRemote(uri)) {
throw eckit::SeriousBug("URI is not remote: " + fname);
}

fdbEndpoint = eckit::net::Endpoint(uri.host(), uri.port());

if (servermap.find(fdbEndpoint) == servermap.end()) {
throw eckit::SeriousBug("No gribjump endpoint found for fdb endpoint: " + std::string(fdbEndpoint));
}
Expand Down Expand Up @@ -237,11 +234,12 @@ void Engine::scheduleTasks(filemap_t& filemap){
size_t counter = 0;
for (auto& [fname, extractionItems] : filemap) {
if (isRemote(extractionItems[0]->URI())) {
ASSERT(false); // This should never happen
taskGroup_.enqueueTask(new InefficientFileExtractionTask(taskGroup_, counter++, fname, extractionItems));
// Only possible if we are using remoteFDB, which requires remoteExtraction to be enabled.
// We technically do support it via inefficient extraction, but we are disabling this for now.
// taskGroup_.enqueueTask(new InefficientFileExtractionTask(taskGroup_, counter++, fname, extractionItems));
throw eckit::SeriousBug("Got remote URI from FDB, but remoteExtraction enabled in gribjump config.");
}
else {
// Reaching here is an error on the databridge, as it means we think the file is local...
taskGroup_.enqueueTask(new FileExtractionTask(taskGroup_, counter++, fname, extractionItems));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/tools/gribjump-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class GribJumpServerApp : public BaseApp, public GribJumpServer {
private:
GribJumpServerApp(const GribJumpServerApp&);
void run() override {
unique();
for (;;) {
::sleep(10);
}
Expand Down

0 comments on commit 8453943

Please sign in to comment.