JuliaDataCubes / JuliaDataCubes/YAXArrays.jl

precompiletools fails on savecube

Open
#349 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
132
Forks
25
PR merge metrics
No merged PRs in 30d

Description

contents of MyPkg/src/MyPkg.jl:

using PrecompileTools, YAXArrays, Zarr
@setup_workload begin         
    @compile_workload begin   
        A = YAXArray(rand(2,3,4))
        savecube(A, tempname(), driver=:zarr)
    end
end

strangely, :zarr is not found when using that package:

julia> using MyPkg
[ Info: Precompiling MyPkg [a54793ad-6546-4bc9-b456-c4a67c0445e2]
ERROR: LoadError: KeyError: key :zarr not found
Stacktrace:
  [1] getindex(h::OrderedCollections.OrderedDict{Symbol, Any}, key::Symbol)
    @ OrderedCollections ~/.julia/packages/OrderedCollections/SInLM/src/ordered_dict.jl:385
  [2] backendfrompath(g::String; driver::Symbol)
    @ YAXArrayBase ~/.julia/packages/YAXArrayBase/R6Frw/src/datasets/datasetinterface.jl:89
  [3] backendfrompath
    @ ~/.julia/packages/YAXArrayBase/R6Frw/src/datasets/datasetinterface.jl:79 [inlined]
  [4] savedataset(ds::YAXArrays.Datasets.Dataset; path::String, persist::Nothing, overwrite::Bool, append::Bool, skeleton::Bool, backend::Symbol, driver::Symbol, max_cache::Float64, writefac::Float64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ YAXArrays.Datasets ~/.julia/packages/YAXArrays/no0he/src/DatasetAPI/Datasets.jl:544
  [5] savecube(c::YAXArrays.Cubes.YAXArray{Float64, 3, Array{Float64, 3}, Tuple{DimensionalData.Dimensions.Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, DimensionalData.Dimensions.Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, DimensionalData.Dimensions.Dim{:Dim_3, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}, path::String; layername::String, datasetaxis::String, max_cache::Float64, backend::Symbol, driver::Symbol, chunks::Nothing, overwrite::Bool, append::Bool, skeleton::Bool, writefac::Float64, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
<SNIP>

yet if i run the contents of the @compile_workload block manually, it runs fine:

julia> using PrecompileTools, YAXArrays, Zarr

julia> A = YAXArray(rand(2,3,4))
2×3×4 YAXArray{Float64,3} with dimensions: 
  Dim{:Dim_1} Sampled{Int64} Base.OneTo(2) ForwardOrdered Regular Points,
  Dim{:Dim_2} Sampled{Int64} Base.OneTo(3) ForwardOrdered Regular Points,
  Dim{:Dim_3} Sampled{Int64} Base.OneTo(4) ForwardOrdered Regular Points
Total size: 192.0 bytes


julia> savecube(A, tempname(), driver=:zarr)
2×3×4 YAXArray{Float64,3} with dimensions: 
  Dim{:Dim_1} Sampled{Int64} Base.OneTo(2) ForwardOrdered Regular Points,
  Dim{:Dim_2} Sampled{Int64} Base.OneTo(3) ForwardOrdered Regular Points,
  Dim{:Dim_3} Sampled{Int64} Base.OneTo(4) ForwardOrdered Regular Points
Total size: 192.0 bytes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction in MyPkg/src/MyPkg.jl and compare the @compile_workload execution with the same savecube call run manually. Investigate why driver=:zarr resolves during manual execution but not during precompilation; done means the workload completes without the KeyError while resolving the Zarr driver.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.