Skip to content

Commit

Permalink
Merge branch 'hotfix/1.10.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Oct 13, 2023
2 parents b7a1440 + 24fb431 commit d976b6a
Show file tree
Hide file tree
Showing 24 changed files with 681 additions and 121 deletions.
7 changes: 7 additions & 0 deletions .github/ci-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencies: |
ecmwf/ecbuild
MathisRosenhauer/libaec@master
ecmwf/eccodes
ecmwf/eckit
dependency_branch: develop
parallelism_factor: 8
8 changes: 8 additions & 0 deletions .github/ci-hpc-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build:
modules:
- ninja
dependencies:
- ecmwf/ecbuild@develop
- ecmwf/eccodes@develop
- ecmwf/eckit@develop
parallel: 64
11 changes: 11 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: cd

on:
push:
tags:
- '**'

jobs:
deploy:
uses: ecmwf-actions/reusable-workflows/.github/workflows/create-package.yml@v2
secrets: inherit
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
uses: ecmwf-actions/downstream-ci/.github/workflows/downstream-ci.yml@main
with:
metkit: ecmwf/metkit@${{ github.event.pull_request.head.sha || github.sha }}
codecov_upload: true
secrets: inherit

# Run CI of private downstream packages on self-hosted runners
Expand Down Expand Up @@ -73,12 +74,3 @@ jobs:
repository: private-downstream-ci
event_type: downstream-ci-hpc
payload: '{"metkit": "ecmwf/metkit@${{ github.event.pull_request.head.sha || github.sha }}"}'

codecov:
name: code-coverage
if: ${{ !github.event.pull_request.head.repo.fork && github.event.action != 'labeled' || github.event.label.name == 'approved-for-ci' }}
uses: ./.github/workflows/reusable-ci.yml
with:
metkit: ecmwf/metkit@${{ github.event.pull_request.head.sha || github.sha }}
codecov: true
secrets: inherit
33 changes: 0 additions & 33 deletions .github/workflows/reusable-ci-hpc.yml

This file was deleted.

38 changes: 0 additions & 38 deletions .github/workflows/reusable-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.16
1.10.17
42 changes: 12 additions & 30 deletions src/metkit/hypercube/HyperCube.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,28 @@
#include "metkit/mars/MarsRequest.h"
#include "metkit/mars/Type.h"

namespace metkit {
namespace hypercube {
namespace metkit::hypercube {

static metkit::mars::Type& type(const std::string& name) {
static metkit::mars::MarsLanguage language("retrieve");
return *language.type(name);
}

namespace {
class AxisOrder {
public: // methods
static AxisOrder& instance() {
static AxisOrder instance;
return instance;
}

const std::vector<std::string>& axes() {
return axes_;
}

private: // methods
AxisOrder() {
eckit::Value axis = eckit::YAMLParser::decodeFile(axisYamlFile());
const eckit::Value axesNames = axis["axes"];

for (size_t i = 0; i < axesNames.size(); ++i) {
axes_.push_back(axesNames[i]);
}
}
AxisOrder::AxisOrder() {
eckit::Value axis = eckit::YAMLParser::decodeFile(axisYamlFile());
const eckit::Value axesNames = axis["axes"];

eckit::PathName axisYamlFile() {
return "~metkit/share/metkit/axis.yaml";
for (size_t i = 0; i < axesNames.size(); ++i) {
axes_.push_back(axesNames[i]);
}
}

private: // members
std::vector<std::string> axes_;
};
AxisOrder& AxisOrder::instance() {
static AxisOrder instance;
return instance;
}


class Axis {
public:
Axis(const std::string& name, const std::vector<std::string>& values) :
Expand Down Expand Up @@ -308,5 +291,4 @@ size_t HyperCube::fieldOrdinal(const metkit::mars::MarsRequest& r, bool noholes)
return idx;
}

} // namespace hypercube
} // namespace metkit
} // namespace metkit::hypercube
15 changes: 15 additions & 0 deletions src/metkit/hypercube/HyperCube.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ namespace hypercube {

class Axis;

class AxisOrder {
public: // methods
static AxisOrder& instance();

const std::vector<std::string>& axes() { return axes_; }

private: // methods
AxisOrder();

eckit::PathName axisYamlFile() { return "~metkit/share/metkit/axis.yaml"; }

private: // members
std::vector<std::string> axes_;
};

class HyperCube {
public:
HyperCube(const metkit::mars::MarsRequest&);
Expand Down
8 changes: 6 additions & 2 deletions src/metkit/mars/DHSProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class PassiveProxyCallback : public BaseCallbackConnection {

public:

explicit PassiveProxyCallback(const Endpoint& proxyhost) :
explicit PassiveProxyCallback(const Endpoint& proxyhost, bool useProxyHostAsCallback = true) :
control_(net::TCPClient().connect(proxyhost)),
proxyHost_(proxyhost) {

Expand All @@ -213,6 +213,10 @@ class PassiveProxyCallback : public BaseCallbackConnection {
LOG_DEBUG_LIB(LibMetkit) << "Remote address. host=" << remoteAddr_<< std::endl;

passiveAddr_ = Endpoint(control_);

if (useProxyHostAsCallback) {
passiveAddr_ = Endpoint(proxyhost.host(), passiveAddr_.port());
}

LOG_DEBUG_LIB(LibMetkit) << "Passive address. host=" << passiveAddr_<< std::endl;

Expand All @@ -222,7 +226,7 @@ class PassiveProxyCallback : public BaseCallbackConnection {
}

explicit PassiveProxyCallback(const Configuration& config) :
PassiveProxyCallback(selectProxyHost(config)) {}
PassiveProxyCallback(selectProxyHost(config), config.getBool("useProxyHostAsCallback", true)) {}

explicit PassiveProxyCallback(Stream& s) :
PassiveProxyCallback(Endpoint(s)) {}
Expand Down
2 changes: 1 addition & 1 deletion src/metkit/mars/MarsParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ std::string MarsParser::parseString(char quote)
}

static bool inindent(char c) {
return isalnum(c) || c == '_' || c == ':' || c == '-' || c == '.';
return isalnum(c) || c == '_' || c == ':' || c == '-' || c == '.' || c == '@';
}


Expand Down
21 changes: 15 additions & 6 deletions src/metkit/mars/MarsRequest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,20 @@ bool MarsRequest::empty() const {


void MarsRequest::print(std::ostream& s) const {
dump(s, "", "");
dump(s, "", "", true);
}

void MarsRequest::dump(std::ostream& s, const char* cr, const char* tab) const {
void MarsRequest::dump(std::ostream& s, const char* cr, const char* tab, bool verb) const {
std::list<Parameter>::const_iterator begin = params_.begin();
std::list<Parameter>::const_iterator end = params_.end();


s << verb_;

if (verb) {
s << verb_ << ',';
}
std::string separator = "";
if (begin != end) {
s << ',' << cr << tab;
s << separator << cr << tab;
separator = ",";

int a = 0;
for (std::list<Parameter>::const_iterator i = begin; i != end; ++i) {
Expand Down Expand Up @@ -401,6 +403,13 @@ std::list<Parameter>::iterator MarsRequest::find(const std::string& name) {
return params_.end();
}

void MarsRequest::erase(const std::string& name) {
auto it = find(name);
if (it != params_.end()) {
params_.erase(it);
}
}

//----------------------------------------------------------------------------------------------------------------------

std::vector<MarsRequest> MarsRequest::parse(std::istream& in, bool strict) {
Expand Down
4 changes: 3 additions & 1 deletion src/metkit/mars/MarsRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MarsRequest {

void md5(eckit::MD5&) const;

void dump(std::ostream&, const char* cr = "\n", const char* tab = "\t") const;
void dump(std::ostream&, const char* cr = "\n", const char* tab = "\t", bool verb = true) const;

void setValuesTyped(Type*, const std::vector<std::string>&);

Expand All @@ -106,6 +106,8 @@ class MarsRequest {

MarsRequest extract(const std::string& category) const;

void erase(const std::string& param);

public: // static methods
static MarsRequest parse(const std::string& s, bool strict = false);
static std::vector<MarsRequest> parse(std::istream&, bool strict = false);
Expand Down
9 changes: 9 additions & 0 deletions src/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ ecbuild_add_executable( TARGET bufr-sanity-check
NO_AS_NEEDED
LIBS metkit eckit_option )

ecbuild_add_executable(
TARGET mars-archive-script
SOURCES mars-archive-script.cc
CONDITION HAVE_BUILD_TOOLS
INCLUDES ${ECKIT_INCLUDE_DIRS}
NO_AS_NEEDED
LIBS metkit
)

# ecbuild_add_executable( TARGET ncmerge
# SOURCES ncmerge.cc
# CONDITION HAVE_NETCDF
Expand Down
Loading

0 comments on commit d976b6a

Please sign in to comment.