Skip to content

Commit

Permalink
fix bug in mv method
Browse files Browse the repository at this point in the history
  • Loading branch information
samtkaplan committed Oct 13, 2024
1 parent 41a13c1 commit 026c6de
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/CloudSeis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2238,11 +2238,12 @@ Base.cp(src::CSeis, dst_container::Container, extents=Colon(); kwargs...) = cp(s
"""
mv(src::CSeis, dst::Container; batch_size=32, workers=Distributed.workers)
move a CloudSeis data-set to `dst`. See `cp` for a description of `batch_size`
move a CloudSeis data-set to `dst` and where `dst` is either of type `Container` or
of type `Vector{Container}`. See `cp` for a description of `batch_size`
and `workers`.
"""
function Base.mv(src::CSeis, dst::Container; kwargs...)
cp(src, dst, project=project, location=location; kwargs...)
function Base.mv(src::CSeis, dst::Union{Container,Vector{<:Container}}; kwargs...)
cp(src, dst; kwargs...)
rm(src)
end

Expand Down
23 changes: 23 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,29 @@ const compressors = Sys.iswindows() ? ("none","blosc","leftjustify","zfp") : ("n
rm(iocp)
end

@testset "mv" begin
r = uuid4()
c_in = mkcontainer(cloud, "test-$r-cs")
io = csopen_robust(c_in, "w", axis_lengths=[10,11,50], frames_per_extent=10, compressor=compressor, compressor_options=compressor_options)
x = rand(Float32,10,11,50)
write(io, x, :, :, :)
close(io)

r = uuid4()
c = mkcontainer(cloud, "test-$r-cs")

mv(io, c)

iomv = csopen(c)
@test readtrcs(iomv, :, :, :) x rtol=rtol
if isa(c_in, AbstractArray)
@test isdir(c_in[1]) == false
else
@test isdir(c_in) == false
end
rm(iomv)
end

@testset "robust cscreate" begin
r = uuid4()
io = csopen_robust(mkcontainer(cloud, "test-$r-cs"), "w", axis_lengths=[10,11,12], force=true, compressor=compressor, compressor_options=compressor_options)
Expand Down

0 comments on commit 026c6de

Please sign in to comment.