You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce update argument to collect_results! to sync results files. (#286)
* Introduce `update` argument to `collect_results!` to sync results files.
This allows `collect_results!` to synchronize an existing results
collection with the files it scans. If it encounters a file with a
newer `mtime` than the results collection, it updates the entry. If it
has entries for which the files are missing it deletes those entries.
* Run update tests in temporary directory.
* Record and check against individual file s.
* Use field in JLD2 file for mtime info instead of df column.
* Be conservative when dealing with old result collections.
* Update version number and changelog
* correct a typo
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
# 2.5.0
2
+
* Add an `update` option of `collect_results!` allowing the updating of an existing results collection if data files were modified or deleted.
1
3
# 2.4.1
2
4
*`savename`'s default options now have `sigdigits = 3` instead of `digits = 3` as stated in the documentation string. This was supposed to happen already since 2.0 but did not because of a bug. (#284)
3
5
* Any subtypes of `AbstractDict` now work with DrWatson (#283).
newfile =false, # keyword only for defining collect_results without !
79
87
kwargs...)
80
88
81
89
if newfile ||!isfile(filename)
82
90
!newfile && verbose &&@info"Starting a new result collection..."
83
91
df = DataFrames.DataFrame()
92
+
mtimes =Dict{String,Float64}()
84
93
else
85
94
verbose &&@info"Loading existing result collection..."
86
-
df =wload(filename)["df"]
95
+
data =wload(filename)
96
+
df = data["df"]
97
+
# Check if we have pre-recorded mtimes (if not this could be because of an old results database).
98
+
if"mtime"∈keys(data)
99
+
mtimes = data["mtime"]
100
+
else
101
+
if update
102
+
throw(InvalidResultsCollection("update of existing results collection requested, but no previously recorded modification time found. Likely the existing results collection was produced with an old version of DrWatson. Recomputing the collection solves this problem."))
103
+
end
104
+
mtimes =nothing
105
+
end
87
106
end
88
107
@info"Scanning folder $folder for result files."
89
108
@@ -99,24 +118,66 @@ function collect_results!(filename, folder;
0 commit comments