Skip to content

Commit

Permalink
Merge branch 'main' into 120_slice_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
markspec authored Sep 27, 2024
2 parents 7ada18c + 7f2759c commit 8054a6f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run clang-format style check for C/C++/Protobuf programs.
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/cmake_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # [ubuntu-latest, macos-latest]
os: [ubuntu-24.04] # [ubuntu-latest, macos-latest]
compiler: [g++, clang++]
runs-on: ${{ matrix.os }}
permissions:
Expand All @@ -30,11 +30,16 @@ jobs:
cxx-compiler: ${{ matrix.compiler }}
- name: Build tests
run: cd build && pwd && make -j
- name: Install Python 3.10
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update -y
sudo apt install -y python3.10 python3.10-venv python3.10-dev
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
- name: Install test dependencies
run: |
sudo apt-get install -y python3.10-full \
&& pip install --upgrade pip \
&& pip install wheel yapf cpplint zarr xarray
python3.10 -m pip install --upgrade pip setuptools wheel --no-input
python3.10 -m pip install yapf cpplint zarr xarray --no-input
- name: Run tests
run: |
cd build/mdio/ \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # [ubuntu-latest, macos-latest]
os: [ubuntu-24.04] # [ubuntu-latest, macos-latest]
compiler: [g++]
runs-on: ${{ matrix.os }}
permissions:
Expand Down
2 changes: 0 additions & 2 deletions mdio/acceptance_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ TEST(Variable, optionalAttrs) {
ASSERT_TRUE(f8.status().ok()) << f8.status();
ASSERT_TRUE(voided.status().ok()) << voided.status();

std::cout << i2.value().GetAttributes().dump(4) << std::endl;

EXPECT_EQ(i2.value().GetAttributes()["attributes"]["foo"], "bar")
<< i2.value().GetAttributes();
EXPECT_EQ(i4.value().GetAttributes()["attributes"]["foo"], "bar")
Expand Down
31 changes: 12 additions & 19 deletions mdio/variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,31 +641,24 @@ Future<Variable<T, R, M>> OpenVariable(const nlohmann::json& json_store,
// specifies a different chunkGrid, it will not be used and should
// actually fail here.
nlohmann::json correctedSuppliedAttrs = suppliedAttributes;
if (correctedSuppliedAttrs["attributes"].contains("metadata")) {
if (correctedSuppliedAttrs["attributes"]["metadata"].contains(
"chunkGrid")) {
correctedSuppliedAttrs["attributes"]["metadata"].erase("chunkGrid");
if (correctedSuppliedAttrs.contains("attributes")) {
if (correctedSuppliedAttrs["attributes"].contains("metadata")) {
if (correctedSuppliedAttrs["attributes"]["metadata"].contains(
"chunkGrid")) {
correctedSuppliedAttrs["attributes"]["metadata"].erase("chunkGrid");
}
}
for (auto& item :
correctedSuppliedAttrs["attributes"]["metadata"].items()) {
correctedSuppliedAttrs["attributes"][item.key()] =
std::move(item.value());
auto savedAttrs = correctedSuppliedAttrs["attributes"];
correctedSuppliedAttrs.erase("attributes");
for (auto& item : savedAttrs.items()) {
correctedSuppliedAttrs[item.key()] = std::move(item.value());
}
correctedSuppliedAttrs["attributes"].erase("metadata");
}
// BFS to make sure supplied attributes match stored attributes
nlohmann::json searchableMetadata = new_metadata;
if (searchableMetadata["attributes"].contains("variable_name")) {
if (searchableMetadata.contains("variable_name")) {
// Since we don't actually want to have to specify the variable name
searchableMetadata["attributes"].erase("variable_name");
}
if (searchableMetadata["attributes"].contains("metadata")) {
for (auto& item :
searchableMetadata["attributes"]["metadata"].items()) {
searchableMetadata["attributes"][item.key()] =
std::move(item.value());
}
searchableMetadata["attributes"].erase("metadata");
searchableMetadata.erase("variable_name");
}
std::queue<std::pair<nlohmann::json, nlohmann::json>> queue;
queue.push({searchableMetadata, correctedSuppliedAttrs});
Expand Down

0 comments on commit 8054a6f

Please sign in to comment.