Skip to content

Commit

Permalink
use save_zip and load_zip (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 authored Oct 17, 2023
1 parent d8ac5ef commit 45f150d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MEDYANSimRunner"
uuid = "b58a3b99-22e3-44d1-b5ea-258f082a6fe8"
authors = ["nhz2 <[email protected]>"]
version = "0.4.1"
version = "0.4.2"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand All @@ -23,5 +23,5 @@ DeepDiffs = "1"
JSON3 = "1"
LoggingExtras = "1"
OrderedCollections = "1"
SmallZarrGroups = "0.5, 0.6, 0.7"
SmallZarrGroups = "0.7.1"
julia = "1.9"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ Random.seed!(collect(reinterpret(UInt64, sha256(job))))
job_header, state = setup(job)
save job_header
step = 0
SmallZarrGroups.save_dir(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_dir(snapshot_zip_file), state)
SmallZarrGroups.save_zip(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_zip(snapshot_zip_file), state)
while true
state = loop(step, state)
step = step + 1
SmallZarrGroups.save_dir(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_dir(snapshot_zip_file), state)
SmallZarrGroups.save_zip(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_zip(snapshot_zip_file), state)
if done(step::Int, state)[1]
break
end
Expand Down
4 changes: 2 additions & 2 deletions src/outputdiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function print_traj_diff(io::IO, jobout1::AbstractString, jobout2::AbstractStrin
for snapshotname in (snapshots1 snapshots2)
full_name1 = joinpath(snapshot1dir, snapshotname)
full_name2 = joinpath(snapshot2dir, snapshotname)
group1 = SmallZarrGroups.load_dir(full_name1)
group2 = SmallZarrGroups.load_dir(full_name2)
group1 = SmallZarrGroups.load_zip(full_name1)
group2 = SmallZarrGroups.load_zip(full_name2)
SmallZarrGroups.print_diff(io, group1, group2, full_name1, full_name2, "", startswith("#"))
end
elseif snapshot1dir_exists && !snapshot2dir_exists
Expand Down
6 changes: 2 additions & 4 deletions src/run-sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,12 @@ end

function zip_group(g::ZGroup)::Vector{UInt8}
io = IOBuffer()
writer = SmallZarrGroups.ZarrZipWriter(io)
SmallZarrGroups.save_dir(writer, g)
SmallZarrGroups.closewriter(writer)
SmallZarrGroups.save_zip(io, g)
take!(io)
end

function unzip_group(data::Vector{UInt8})::ZGroup
SmallZarrGroups.load_dir(SmallZarrGroups.ZarrZipReader(data))
SmallZarrGroups.load_zip(data)
end


2 comments on commit 45f150d

@nhz2
Copy link
Member Author

@nhz2 nhz2 commented on 45f150d Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/93596

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.2 -m "<description of version>" 45f150dfdcbc0098908a841ac0b0385dfc7da9b7
git push origin v0.4.2

Please sign in to comment.