Skip to content

Commit d3dc7b7

Browse files
authored
Deprecate User Robot Session in favour of using Graph and Agent (#1100)
1 parent fad7f35 commit d3dc7b7

28 files changed

+403
-351
lines changed

NEWS.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
Listing news on any major breaking changes in DFG. For regular changes, see integrated Github.com project milestones for DFG.
22

3-
# v0.24
3+
# v0.25
44
- Deprecated nouns:
55
SessionBlobEntry -> GraphBlobEntry
66
RobotBlobEntry -> AgentBlobEntry
77
UserBlobEntry -> AgentBlobEntry
88
RobotData -> AgentMetadata
9-
SessionData -> GraphMetadata
9+
SessionData -> GraphMetadata
10+
UserLabel -> AgentLabel
11+
RobotLabel -> AgentLabel
12+
SessionLabel -> GraphLabel
13+
- v0.24 FileDFGs can be loaded with v0.25 with the exception of the User[Label/Data/BlobEntries]
1014

1115
# v0.24
1216

docs/src/GraphData.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,19 +174,17 @@ getSmallData(x0)
174174
## Graph-Related Data
175175

176176
DFG can store data in the graph itself (as opposed to inside graph elements).
177-
When you retrieve graphs from a database, this information is carried along. If
178-
you are working with an in-memory graph, the structure is flattened into the
179-
graph itself as `userData`, `robotData`, and `sessionData`.
177+
When you retrieve distributed factor graphs from a database, this information is carried along. If
178+
you are working with an in-memory graph, the DFG structure contains the graph itself as well as
179+
`Agent` and `Graph` data.
180180

181181
Graphs reside inside a hierarchy made up in the following way:
182-
- User1
183-
- Robot1
184-
- Session1 (the graph itself)
185-
- User2
186-
- Robot2
187-
- Robot3
188-
- Session2
189-
- Session3
182+
- Agent
183+
- Metadata
184+
- BlobEntries
185+
- Graph
186+
- Metadata
187+
- BlobEntries
190188

191189
This data can be retrieved with the follow functions:
192190

ext/DFGPlots.jl

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -83,58 +83,4 @@ function gplot(dfg::GraphsDFG; keyargs...)
8383
return gplot(dfg.g; keyargs...)
8484
end
8585

86-
#TODO decide if we want to overload show for display in juno, It's a bit annoying with development
87-
# function Base.show(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
88-
function plotDFG(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
89-
if length(ls(dfg)) != 0
90-
size = get(io, :juno_plotsize, [100, 100])
91-
92-
plot_output = IOBuffer()
93-
GraphPlot.draw(
94-
GraphPlot.SVGJS(
95-
plot_output,
96-
GraphPlot.Compose.default_graphic_width,
97-
GraphPlot.Compose.default_graphic_width,
98-
false,
99-
),
100-
plotDFG(dfg),
101-
)
102-
plotsvg = String(take!(plot_output))
103-
104-
print(
105-
io,
106-
"""
107-
<div style="
108-
background-color: #eee;
109-
color: #222;
110-
width: $(size[1]-40)px;
111-
height: $(size[2]-40)px;
112-
position: absolute;
113-
top: 0;
114-
left: 0;
115-
padding: 20px;
116-
margin: 0;
117-
">
118-
$(typeof(dfg))
119-
<ul>
120-
<li>$(getUserLabel(dfg))</li>
121-
<li>$(getRobotLabel(dfg))</li>
122-
<li>$(getSessionLabel(dfg))</li>
123-
<li>$(getDescription(dfg))</li>
124-
</ul>
125-
<script charset="utf-8">
126-
$(read(GraphPlot.Compose.snapsvgjs, String))
127-
</script>
128-
<script charset="utf-8">
129-
$(read(GraphPlot.gadflyjs, String))
130-
</script>
131-
$(plotsvg)
132-
</div>
133-
""",
134-
)
135-
else
136-
Base.show(io, dfg)
137-
end
138-
end
139-
14086
end

src/Common.jl

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,15 @@ sortDFG(vars::Vector{Symbol}; lt = natural_lt, kwargs...) = sort(vars; lt = lt,
7272
##==============================================================================
7373
## Validation of session, robot, and user labels.
7474
##==============================================================================
75-
global _invalidIds = [
76-
"USER",
77-
"ROBOT",
78-
"SESSION",
79-
"AGENT",
80-
"VARIABLE",
81-
"FACTOR",
82-
"PPE",
83-
"BLOB_ENTRY",
84-
"FACTORGRAPH",
85-
]
75+
global _invalidIds =
76+
["GRAPH", "AGENT", "VARIABLE", "FACTOR", "PPE", "BLOB_ENTRY", "FACTORGRAPH"]
8677

8778
const global _validLabelRegex::Regex = r"^[a-zA-Z][-\w\.\@]*$"
8879

8980
"""
9081
$(SIGNATURES)
9182
92-
Returns true if the label is valid for a session, robot, or user ID.
83+
Returns true if the label is valid for node.
9384
"""
9485
function isValidLabel(id::Union{Symbol, String})
9586
if typeof(id) == Symbol

src/DataBlobs/entities/BlobEntry.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
$(TYPEDEF)
88
99
A `BlobEntry` is a small about of structured data that holds reference information to find an actual blob. Many `BlobEntry`s
10-
can exist on different graph nodes spanning Robots, and Sessions which can all reference the same `Blob`. A `BlobEntry`
11-
is also a equivalent to a bridging entry between local `.originId` and a remotely assigned `.blobIds`.
10+
can exist on different graph nodes spanning Agents and Factor Graphs which can all reference the same `Blob`.
1211
1312
Notes:
14-
- All `.blobId`s are unique across the entire distributed system and are immutable. The `.originId` should be globally unique except for stochastic `uuid4` collisions that cannot be checked from a main reference owing to practical limitations such as network connectivity.
13+
- `blobId`s should be unique within a blobstore and are immutable.
1514
"""
1615
Base.@kwdef struct BlobEntry
1716
""" Remotely assigned and globally unique identifier for the `BlobEntry` itself (not the `.blobId`). """
@@ -26,7 +25,7 @@ Base.@kwdef struct BlobEntry
2625
blobstore::Symbol = :default
2726
""" A hash value to ensure data consistency which must correspond to the stored hash upon retrieval. Use `bytes2hex(sha256(blob))`. [Legacy: some usage functions allow the check to be skipped if needed.] """
2827
hash::String = ""# Probably https://docs.julialang.org/en/v1/stdlib/SHA
29-
""" Context from which a BlobEntry=>Blob was first created. E.g. user|robot|session|varlabel. """
28+
""" Context from which a BlobEntry=>Blob was first created. E.g. agent|graph|varlabel. """
3029
origin::String = ""
3130
""" number of bytes in blob as a string"""
3231
size::Union{String, Nothing} = "" #TODO remove union, use "" as nothing

src/DataBlobs/services/BlobEntry.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ end
1515

1616
"""
1717
$(SIGNATURES)
18-
Function to generate source string - userLabel|robotLabel|sessionLabel|varLabel
18+
Function to generate source string - agentLabel|graphLabel|varLabel
1919
"""
2020
function buildSourceString(dfg::AbstractDFG, label::Symbol)
21-
return "$(getUserLabel(dfg))|$(getRobotLabel(dfg))|$(getSessionLabel(dfg))|$label"
21+
return "$(getAgentLabel(dfg))|$(getGraphLabel(dfg))|$label"
2222
end
2323

2424
##==============================================================================

src/Deprecated.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
@deprecate setRobotData!(args...) setAgentMetadata!(args...)
3232
@deprecate setSessionData!(args...) setGraphMetadata!(args...)
3333

34-
#TODO
35-
# @deprecate getUserLabel(dfg) getAgentLabel(dfg)
36-
# @deprecate getRobotLabel(dfg) getAgentLabel(dfg)
37-
# @deprecate getSessionLabel(dfg) getGraphLabel(dfg)
34+
@deprecate getUserLabel(dfg) getAgentLabel(dfg)
35+
@deprecate getRobotLabel(dfg) getAgentLabel(dfg)
36+
@deprecate getSessionLabel(dfg) getGraphLabel(dfg)
37+
38+
export DFGSummary
39+
DFGSummary(args) = error("DFGSummary is deprecated")
40+
@deprecate getSummary(dfg::AbstractDFG) getSummaryGraph(dfg)
3841

3942
## ================================================================================
4043
## Deprecated in v0.24

src/DistributedFactorGraphs.jl

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export AbstractParams, NoSolverParams
6464
export AbstractBlobStore
6565

6666
# accessors & crud
67-
export getUserLabel, getRobotLabel, getSessionLabel
6867
export getDFGInfo
6968
export getDescription,
7069
setDescription!,
@@ -95,9 +94,10 @@ export getBlobStore,
9594
addBlobStore!, updateBlobStore!, deleteBlobStore!, emptyBlobStore!, listBlobStores
9695

9796
# TODO Not sure these are needed or should work everywhere, implement in cloud?
98-
export updateAgentMetadata!,
99-
updateGraphMetadata!, deleteAgentMetadata!, deleteGraphMetadata!
100-
export emptyAgentMetadata!, emptyGraphMetadata!
97+
# NOTE not exporiting these for now. For consistency `get` and `set` might work better.
98+
# export updateAgentMetadata!,
99+
# updateGraphMetadata!, deleteAgentMetadata!, deleteGraphMetadata!
100+
# export emptyAgentMetadata!, emptyGraphMetadata!
101101

102102
# Graph Types: exported from modules or @reexport
103103
export InMemoryDFGTypes, LocalDFG
@@ -127,10 +127,7 @@ export isConnected
127127

128128
export getBiadjacencyMatrix
129129

130-
#summary structure
131-
export DFGSummary
132-
133-
export getSummary, getSummaryGraph
130+
export getSummaryGraph
134131

135132
# Abstract Nodes
136133
export DFGNode, AbstractDFGVariable, AbstractDFGFactor
@@ -148,6 +145,8 @@ export getVariableLabelNumber
148145
# accessors
149146
export getLabel, getTimestamp, setTimestamp, setTimestamp!, getTags, setTags!
150147

148+
export getAgentLabel, getGraphLabel
149+
151150
# Node Data
152151
export isSolveInProgress, getSolveInProgress
153152

@@ -341,8 +340,6 @@ include("entities/DFGFactor.jl")
341340

342341
include("entities/DFGVariable.jl")
343342

344-
include("entities/AbstractDFGSummary.jl")
345-
346343
include("entities/Agent.jl")
347344

348345
include("services/AbstractDFG.jl")

src/GraphsDFG/FactorGraphs/FactorGraphs.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@ function addFactor!(
139139
(@error "Label $(factor.label) already in fg"; return false)
140140

141141
for vlabel in variableLabels
142-
!haskey(g.labels, vlabel) && (
143-
throw(KeyError(vlabel))
144-
# @error "Variable '$(vlabel)' not found in graph when creating Factor '$(factor.label)'"; return false
142+
!haskey(g.labels, vlabel) && (throw(KeyError(vlabel))
143+
# @error "Variable '$(vlabel)' not found in graph when creating Factor '$(factor.label)'"; return false
145144
) #TODO debug error or exception?
146145
end
147146

src/GraphsDFG/GraphsDFG.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ using OrderedCollections
88
using StructTypes
99

1010
using ...DistributedFactorGraphs
11-
12-
# import ...DistributedFactorGraphs: AbstractDFG, DFGNode, AbstractDFGVariable, AbstractDFGFactor, DFGSummary, AbstractParams, NoSolverParams, DFGVariable, DFGFactor
11+
using ...DistributedFactorGraphs: Agent
1312

1413
# import DFG functions to extend
1514
import ...DistributedFactorGraphs:

0 commit comments

Comments
 (0)