Skip to content

Commit 4a13246

Browse files
authored
Update deprecated functions and fix broken docs and tests (#1201)
* Update deprecated functions * fix formatting * fix docs --------- Co-authored-by: Johannes Terblanche <[email protected]>
1 parent 7594782 commit 4a13246

File tree

23 files changed

+279
-196
lines changed

23 files changed

+279
-196
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
fail_ci_if_error: false
6565

6666
docs:
67-
needs: test
6867
name: Documentation
6968
runs-on: ubuntu-latest
7069
continue-on-error: true
@@ -75,7 +74,7 @@ jobs:
7574
- name: Setup julia
7675
uses: julia-actions/setup-julia@v2
7776
with:
78-
version: 'lts'
77+
version: '1.12'
7978
arch: x64
8079

8180
- name: Build Docs

docs/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[deps]
2-
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
3-
Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
42
DistributedFactorGraphs = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
53
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
64
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"

docs/src/DataStructure.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,11 @@ Accessible properties for each of the factor structures:
3737
- [`VariableSummary`](@ref)
3838
- [`FactorSummary`](@ref)
3939

40-
## DFG Portable and Storeable types
40+
## DFG full types (solvable, portable and storeable)
4141

4242
- [`VariableDFG`](@ref)
4343
- [`FactorDFG`](@ref)
4444

45-
## DFG Full solvable types
46-
47-
- [`VariableCompute`](@ref)
48-
- [`FactorCompute`](@ref)
49-
5045
## Additional Offloaded Data
5146

5247
Additional, larger data can be associated with variables and factors using keyed blob entries.

docs/src/GraphData.md

Lines changed: 22 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ Each variable or factor can have a timestamp associated with it.
5353

5454
Tags are a set of symbols that contain identifiers for the variable or factor.
5555

56-
- [`getTags`](@ref)
56+
- [`listTags`](@ref)
5757
- [`mergeTags!`](@ref)
58-
- [`removeTags!`](@ref)
58+
- [`deleteTags!`](@ref)
5959
- [`emptyTags!`](@ref)
6060

6161

@@ -72,52 +72,11 @@ The solvable flag indicates whether the solver should make use of the variable o
7272

7373
#### Variable Type
7474

75-
The `variableType` is the underlying inference variable type, such as a Pose2.
75+
The `AbstractStateType` is the underlying inference variable type, such as a Pose2.
7676

77-
- [`getVariableType`](@ref)
77+
- [`getStateKind`](@ref)
7878

7979

80-
#### Packed Parametric Estimates
81-
82-
Solved graphs contain packed parametric estimates for the variables, which are keyed by the solution (the default is saved as :default).
83-
84-
For each PPE structure, there are accessors for getting individual values:
85-
86-
- [`getPPEMax`](@ref)
87-
- [`getPPEMean`](@ref)
88-
- [`getPPESuggested`](@ref)
89-
90-
91-
Related functions for getting, adding/updating, and deleting PPE structures:
92-
93-
94-
- [`listPPEs`](@ref)
95-
- [`getPPE`](@ref)
96-
- [`addPPE!`](@ref)
97-
- [`updatePPE!`](@ref)
98-
- [`deletePPE!`](@ref)
99-
- [`mergePPEs!`](@ref)
100-
101-
102-
Example of PPE operations:
103-
104-
```julia
105-
# Add a new PPE of type MeanMaxPPE to :x0
106-
ppe = MeanMaxPPE(:default, [0.0], [0.0], [0.0])
107-
addPPE!(dfg, :x0, ppe)
108-
@show listPPEs(dfg, :x0)
109-
# Get the data back - note that this is a reference to above.
110-
v = getPPE(dfg, :x0, :default)
111-
# Delete it
112-
deletePPE!(dfg, :x0, :default)
113-
# Update add it
114-
updatePPE!(dfg, :x0, ppe, :default)
115-
# Update update it
116-
updatePPE!(dfg, :x0, ppe, :default)
117-
# Bulk copy PPE's for x0 and x1
118-
updatePPE!(dfg, [x0], :default)
119-
```
120-
12180
#### Variable States (Solver Data)
12281

12382
Variable `State`s are used by the IncrementalInference/RoME/Caesar solver.
@@ -147,23 +106,23 @@ stateBack = getState(dfg, :x0, :parametric)
147106
deleteState!(dfg, :x0, :parametric)
148107
```
149108

150-
#### Metadata
109+
#### Bloblets
151110

152-
Metadata (small data) allows you to assign a dictionary to variables. It is a useful way to
153-
keep small amounts of primative (Strings, Integers, Floats, Bool) data in a variable. As it is stored in the graph
111+
Bloblets allow you to assign a dictionary of key-value [Symbol-String] pairs to nodes. It is a useful way to
112+
keep small amounts of primitive (Strings, Integers, Floats, Bool) data that is stored as a string in a node. As it is stored in the graph
154113
itself, large entries will slow the graph down, so if data should exceed a
155114
few bytes/kb, it should rather be saved in Blobs.
156115

157116

158-
- [`getMetadata`](@ref)
159-
- [`setMetadata!`](@ref)
117+
- [`getVariableBloblet`](@ref)
118+
- [`addVariableBloblet!`](@ref)
160119

161120

162121
Example:
163122

164123
```julia
165-
setMetadata!(x0, Dict("entry"=>"entry value"))
166-
getMetadata(x0)
124+
addVariableBloblet!(dfg, :x0, Bloblet(:bloblet_label,"bloblet value"))
125+
getVariableBloblet(dfg, :x0)
167126
```
168127

169128
#### Big Data
@@ -179,23 +138,25 @@ you are working with an in-memory graph, the DFG structure contains the graph it
179138

180139
Graphs reside inside a hierarchy made up in the following way:
181140
- Agent
182-
- Metadata
141+
- Bloblets
183142
- Blobentries
184143
- Graph
185-
- Metadata
144+
- Bloblets
186145
- Blobentries
187146

188-
This data can be retrieved with the follow functions:
189-
190-
- [`getAgentMetadata`](@ref)
191-
- [`getGraphMetadata`](@ref)
147+
Agent and Graph bloblets are useful for storing data that is related to the entire graph, and support CRUD operations:
192148

149+
- [`getAgentBloblet`](@ref)
150+
- [`getGraphBloblet`](@ref)
193151

194-
It can be set using the following functions:
152+
- [`addAgentBloblet!`](@ref)
153+
- [`addGraphBloblet!`](@ref)
195154

196-
- [`setAgentMetadata!`](@ref)
197-
- [`setGraphMetadata!`](@ref)
155+
- [`mergeAgentBloblet!`](@ref)
156+
- [`mergeGraphBloblet!`](@ref)
198157

158+
- [`deleteAgentBloblet!`](@ref)
159+
- [`deleteGraphBloblet!`](@ref)
199160

200161
Example of using graph-level data:
201162

docs/src/services_ref.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ Modules = [DistributedFactorGraphs]
2323
Pages = ["services/CommonAccessors.jl"]
2424
```
2525

26+
## Common
27+
```@autodocs
28+
Modules = [DistributedFactorGraphs]
29+
Pages = [
30+
"services/list.jl",
31+
"services/find.jl",
32+
"services/Tags.jl",
33+
"entities/Bloblet.jl",
34+
"services/Bloblet.jl",
35+
]
36+
```
37+
2638
## DFG Variable Accessors CRUD and SET opperations
2739

2840
```@autodocs

src/DataBlobs/services/BlobEntry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ function gatherBlobentries(
306306
labelFilter = variableLabelFilter,
307307
)
308308
return map(vls) do vl
309-
return vl => getBlobentries(dfg, vl; labelFilter, blobIdFilter)
309+
return vl => getVariableBlobentries(dfg, vl; labelFilter, blobIdFilter)
310310
end
311311
end
312312
const collectBlobentries = gatherBlobentries

src/DataBlobs/services/BlobWrappers.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function loadBlob_Variable(
7070
# hashfunction = sha256,
7171
# checkhash::Bool = true,
7272
)
73-
entry = getBlobentry(dfg, variable_label, entry_label)
73+
entry = getVariableBlobentry(dfg, variable_label, entry_label)
7474
blob = getBlob(dfg, entry)
7575
# checkhash && assertHash(de, db; hashfunction)
7676
return entry, blob
@@ -82,7 +82,7 @@ function saveBlob_Variable!(
8282
blob::Vector{UInt8},
8383
entry::Blobentry,
8484
)
85-
addBlobentry!(dfg, variable_label, entry)
85+
addVariableBlobentry!(dfg, variable_label, entry)
8686
addBlob!(dfg, entry, blob)
8787
return entry
8888
end
@@ -100,8 +100,8 @@ function saveBlob_Variable!(
100100
end
101101

102102
function deleteBlob_Variable!(dfg::AbstractDFG, variable_label::Symbol, entry_label::Symbol)
103-
entry = getBlobentry(dfg, variable_label, entry_label)
104-
deleteBlobentry!(dfg, variable_label, entry_label)
103+
entry = getVariableBlobentry(dfg, variable_label, entry_label)
104+
deleteVariableBlobentry!(dfg, variable_label, entry_label)
105105
deleteBlob!(dfg, entry)
106106
return 2
107107
end

src/Deprecated.jl

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
export FactorCompute
55
const FactorCompute = FactorDFG
66

7-
"""
8-
Types valid for small data.
9-
"""
107
const MetadataTypes = Union{
118
Int,
129
Float64,
@@ -135,18 +132,10 @@ function getVariableTypeName(v::VariableSummary)
135132
return v.statetype
136133
end
137134

138-
"""
139-
$(SIGNATURES)
140-
Get the Metadata entry at `key` for variable `label` in `dfg`
141-
"""
142135
function getMetadata(dfg::AbstractDFG, label::Symbol, key::Symbol)
143136
return getVariable(dfg, label).smallData[key]
144137
end
145138

146-
"""
147-
$(SIGNATURES)
148-
Add a Metadata pair `key=>value` for variable `label` in `dfg`
149-
"""
150139
function addMetadata!(dfg::AbstractDFG, label::Symbol, pair::Pair{Symbol, <:MetadataTypes})
151140
v = getVariable(dfg, label)
152141
haskey(v.smallData, pair.first) && throw(LabelExistsError("Metadata", pair.first))
@@ -155,10 +144,6 @@ function addMetadata!(dfg::AbstractDFG, label::Symbol, pair::Pair{Symbol, <:Meta
155144
return v.smallData #or pair TODO
156145
end
157146

158-
"""
159-
$(SIGNATURES)
160-
Update a Metadata pair `key=>value` for variable `label` in `dfg`
161-
"""
162147
function updateMetadata!(
163148
dfg::AbstractDFG,
164149
label::Symbol,
@@ -174,30 +159,18 @@ function updateMetadata!(
174159
return v.smallData #or pair TODO
175160
end
176161

177-
"""
178-
$(SIGNATURES)
179-
Delete a Metadata entry at `key` for variable `label` in `dfg`
180-
"""
181162
function deleteMetadata!(dfg::AbstractDFG, label::Symbol, key::Symbol)
182163
v = getVariable(dfg, label)
183164
pop!(v.smallData, key)
184165
mergeVariable!(dfg, v)
185166
return 1
186167
end
187168

188-
"""
189-
$(SIGNATURES)
190-
List all Metadata keys for a variable `label` in `dfg`
191-
"""
192169
function listMetadata(dfg::AbstractDFG, label::Symbol)
193170
v = getVariable(dfg, label)
194171
return collect(keys(v.smallData)) #or pair TODO
195172
end
196173

197-
"""
198-
$(SIGNATURES)
199-
Empty all Metadata from variable `label` in `dfg`
200-
"""
201174
function emptyMetadata!(dfg::AbstractDFG, label::Symbol)
202175
v = getVariable(dfg, label)
203176
empty!(v.smallData)

src/DistributedFactorGraphs.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,16 @@ export deleteVariableBloblet!
303303
export listVariableBloblets
304304

305305
export getAgentBloblet
306-
export getGraphBloblet
306+
export addAgentBloblet!
307+
export mergeAgentBloblet!
308+
export deleteAgentBloblet!
309+
export listAgentBloblets
307310

311+
export getGraphBloblet
312+
export addGraphBloblet!
313+
export mergeGraphBloblet!
314+
export deleteGraphBloblet!
315+
export listGraphBloblets
308316
##------------------------------------------------------------------------------
309317
## FileDFG
310318
##------------------------------------------------------------------------------
@@ -451,13 +459,13 @@ const unstable_functions::Vector{Symbol} = [
451459
:getVariableTypeName,
452460
:getStateKind,
453461
:setTimestamp,
454-
:setMetadata!, # no set, use add merge
455462
:setAgentMetadata!,
456463
:setGraphMetadata!,
457464
# :getSolverDataDict,# obsolete
458465
:getAddHistory,
459466

460467
#Deprecated in v0.28
468+
:setMetadata!, # no set, use add merge
461469
:AbstractRelativeMinimize,
462470
:AbstractManifoldMinimize,
463471
:AbstractPrior,

src/FileDFG/services/FileDFG.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ function saveDFG(folder::AbstractString, dfg::AbstractDFG)
3939
map(f -> rm("$varFolder/$f"), readdir(varFolder))
4040
map(f -> rm("$factorFolder/$f"), readdir(factorFolder))
4141
# Variables
42-
@showprogress "saving variables" for v in variables
42+
@showprogress desc = "saving variables" for v in variables
4343
# vPacked = packVariable(v)
4444
JSON.json("$varFolder/$(v.label).json", v; style = DFGJSONStyle())
4545
end
4646
# Factors
47-
@showprogress "saving factors" for f in factors
47+
@showprogress desc = "saving factors" for f in factors
4848
JSON.json("$factorFolder/$(f.label).json", f; style = DFGJSONStyle())
4949
end
5050

5151
#GraphsDFG nodes
5252
@assert isa(dfg, GraphsDFG) "only metadata for GraphsDFG are supported"
53-
p = Progress(4, "Saving DFG Nodes")
53+
p = Progress(4; desc = "Saving DFG Nodes")
5454
JSON.json("$savepath/graphroot.json", dfg.graph; style = DFGJSONStyle())
5555
next!(p)
5656
JSON.json("$savepath/agent.json", dfg.agent; style = DFGJSONStyle())
@@ -119,7 +119,9 @@ function loadDFG!(
119119
variablefiles = readdir(joinpath(loaddir, "variables"); sort = false, join = true)
120120

121121
# type instability on `variables` as either `::Vector{Variable}` or `::Vector{VariableCompute{<:}}` (vector of abstract)
122-
variables = @showprogress 1 "loading variables" asyncmap(variablefiles) do file
122+
variables = @showprogress dt=1 desc = "loading variables" asyncmap(
123+
variablefiles,
124+
) do file
123125
v = JSON.parsefile(file, V; style = DFGJSONStyle())
124126
return addVariable!(dfgLoadInto, v)
125127
end
@@ -128,7 +130,7 @@ function loadDFG!(
128130

129131
factorfiles = readdir(joinpath(loaddir, "factors"); sort = false, join = true)
130132

131-
factors = @showprogress 1 "loading factors" asyncmap(factorfiles) do file
133+
factors = @showprogress dt=1 desc = "loading factors" asyncmap(factorfiles) do file
132134
f = JSON.parsefile(file, F; style = DFGJSONStyle())
133135
return addFactor!(dfgLoadInto, f)
134136
end
@@ -137,7 +139,7 @@ function loadDFG!(
137139

138140
if isa(dfgLoadInto, GraphsDFG) && getTypeDFGFactors(dfgLoadInto) <: FactorDFG
139141
# Finally, rebuild the CCW's for the factors to completely reinflate them
140-
@showprogress 1 "Rebuilding factor solver cache" for factor in factors
142+
@showprogress dt=1 desc = "Rebuilding factor solver cache" for factor in factors
141143
rebuildFactorCache!(dfgLoadInto, factor)
142144
end
143145
end
@@ -170,7 +172,7 @@ function loadDFG(file::AbstractString)
170172
loaddir = Tar.extract(hdr -> contains(hdr.path, dfgnodenames), tar)
171173
close(tar)
172174

173-
progess = Progress(4, "Loading DFG Nodes")
175+
progess = Progress(4; desc = "Loading DFG Nodes")
174176
agent = JSON.parsefile(joinpath(loaddir, "agent.json"), Agent; style = DFGJSONStyle())
175177
next!(progess)
176178
graph = JSON.parsefile(

0 commit comments

Comments
 (0)