Skip to content

Commit 72d150d

Browse files
authored
Merge pull request #407 from JuliaRobotics/master
v0.7.5-rc1
2 parents 27c7abd + ca4b9af commit 72d150d

20 files changed

+603
-145
lines changed

.travis.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: julia
22
sudo: required
3-
dist: trusty
3+
# dist: trusty
44

55
os:
66
- linux
@@ -22,9 +22,14 @@ env:
2222
jobs:
2323
include:
2424
- julia: 1.3
25+
dist: trusty
2526
env: IIF_TEST=true
2627
if: NOT branch =~ ^release.*$
27-
# - arch: arm64
28+
# Set the password for Neo4j to neo4j:test
29+
before_script:
30+
- sleep 10
31+
- curl -v POST http://neo4j:neo4j@localhost:7474/user/neo4j/password -d"password=test"
32+
- arch: arm64
2833
- stage: "Documentation"
2934
julia: 1.3
3035
os: linux
@@ -35,17 +40,27 @@ jobs:
3540
fast_finish: true
3641
allow_failures:
3742
- julia: nightly
38-
# - arch: arm64
43+
- arch: arm64
3944
#- env: IIF_TEST=true
4045

4146
notifications:
4247
email: false
4348

4449

45-
# Set the password for Neo4j to neo4j:test
46-
before_script:
47-
- sleep 10
48-
- curl -v POST http://neo4j:neo4j@localhost:7474/user/neo4j/password -d"password=test"
50+
# Attempt to install neo4j on Xenial and set the password for Neo4j to neo4j:test
51+
# Cloud tests errors with authentication error
52+
#before_script:
53+
# - sudo add-apt-repository -y ppa:openjdk-r/ppa
54+
# - sudo apt-get update
55+
# - wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
56+
# - echo 'deb https://debian.neo4j.com stable latest' | sudo tee -a /etc/apt/sources.list.d/neo4j.list
57+
# - sudo apt-get update
58+
# - apt list -a neo4j
59+
# - sudo apt-get install neo4j=1:4.0.0
60+
# - sudo service neo4j start
61+
# - sleep 10
62+
# - sudo neo4j-admin set-initial-password test
63+
# - curl -I http://localhost:7474/
4964

5065
after_success:
5166
- julia -e 'using Pkg; cd(Pkg.dir("DistributedFactorGraphs")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.7.4"
3+
version = "0.7.5"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -31,7 +31,7 @@ LightGraphs = "1.2, 1.3"
3131
Neo4j = "2"
3232
Reexport = "0.2, 0.3, 0.4, 0.5, 1"
3333
Requires = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 1"
34-
Unmarshal = "0.3"
34+
Unmarshal = "0.3, 0.4"
3535
julia = "1.2"
3636

3737
[extras]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ addFactor!(dfg, [v1, v2], DFGFactor{Int, :Symbol}(:f1)) # Rather use a RoME-type
5858
Please see the documentation for more information on interacting with the factor graph.
5959

6060
## Setting up a Quick Neo4j Database
61-
The simplest way to set up a test database is with Docker.
61+
The simplest way to set up a test database is with Docker. The Neo4j driver currenly doesn't work with Neo4j 4.0, version 3.5 can be used as in this example.
6262

6363
To pull the Neo4j image:
6464
```bash
65-
docker pull neo4j
65+
docker pull neo4j:3.5
6666
```
6767

6868
To run the image with user `neo4j` and password `test`:
6969

7070
```bash
71-
docker run -d --publish=7474:7474 --publish=7687:7687 --env NEO4J_AUTH=neo4j/test neo4j
71+
docker run -d --publish=7474:7474 --publish=7687:7687 --env NEO4J_AUTH=neo4j/test neo4j:3.5
7272
```
7373

7474
> **Note** If you just installed docker and having permission issues, please see [this ask Ubuntu forum](https://askubuntu.com/questions/941816/permission-denied-when-running-docker-after-installing-it-as-a-snap).

src/BigData/services/AbstractBigDataEntries.jl

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ end
2020
$(SIGNATURES)
2121
Add Big Data Entry to a DFG variable
2222
"""
23-
function addBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)::AbstractBigDataEntry
23+
function addBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)
2424
haskey(var.bigData,bde.key) && error("BigData entry $(bde.key) already exists in variable")
2525
var.bigData[bde.key] = bde
2626
return bde
@@ -31,33 +31,63 @@ end
3131
Add Big Data Entry to distributed factor graph.
3232
Should be extended if DFG variable is not returned by reference.
3333
"""
34-
function addBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)::AbstractBigDataEntry
34+
function addBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)
3535
return addBigDataEntry!(getVariable(dfg, label), bde)
3636
end
3737

38+
addDataEntry!(x...) = addBigDataEntry!(x...)
39+
40+
"""
41+
$(SIGNATURES)
42+
Add Big Data Entry to distributed factor graph.
43+
Should be extended if DFG variable is not returned by reference.
44+
"""
45+
function addDataEntry!(dfg::AbstractDFG,
46+
lbl::Symbol,
47+
descr::Symbol,
48+
mimeType::AbstractString,
49+
data::Vector{UInt8} )
50+
#
51+
node = isVariable(dfg, lbl) ? getVariable(dfg, lbl) : getFactor(dfg, lbl)
52+
# Make a big data entry in the graph - use JSON2 to just write this
53+
element = GeneralBigDataEntry(dfg, node, descr, mimeType=mimeType)
54+
# Set it in the store
55+
addBigData!(fec.datastore, element, data)
56+
# Add the entry to the graph
57+
addBigDataEntry!(node, element)
58+
end
59+
60+
"""
61+
$SIGNATURES
62+
63+
Does a data entry (element) exist at `key`.
64+
"""
65+
hasDataEntry(var::DFGVariable, key::Symbol) = haskey(var.bigData, key)
66+
const hasBigDataEntry = hasDataEntry
67+
3868
"""
3969
$(SIGNATURES)
4070
Get big data entry
4171
"""
42-
function getBigDataEntry(var::AbstractDFGVariable, key::Symbol)::Union{Nothing, AbstractBigDataEntry}
43-
!haskey(var.bigData, key) && (error("BigData entry $(key) does not exist in variable"); return nothing)
72+
function getBigDataEntry(var::AbstractDFGVariable, key::Symbol)
73+
!hasDataEntry(var, key) && (error("BigData entry $(key) does not exist in variable"); return nothing)
4474
return var.bigData[key]
4575
end
4676

47-
function getBigDataEntry(dfg::AbstractDFG, label::Symbol, key::Symbol)::Union{Nothing, AbstractBigDataEntry}
77+
function getBigDataEntry(dfg::AbstractDFG, label::Symbol, key::Symbol)
4878
return getBigDataEntry(getVariable(dfg, label), key)
4979
end
5080

5181
"""
5282
$(SIGNATURES)
5383
Update big data entry
5484
"""
55-
function updateBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)::Union{Nothing, AbstractBigDataEntry}
85+
function updateBigDataEntry!(var::AbstractDFGVariable, bde::AbstractBigDataEntry)
5686
!haskey(var.bigData,bde.key) && (@warn "$(bde.key) does not exist in variable, adding")
5787
var.bigData[bde.key] = bde
5888
return bde
5989
end
60-
function updateBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)::Union{Nothing, AbstractBigDataEntry}
90+
function updateBigDataEntry!(dfg::AbstractDFG, label::Symbol, bde::AbstractBigDataEntry)
6191
# !isVariable(dfg, label) && return nothing
6292
return updateBigDataEntry!(getVariable(dfg, label), bde)
6393
end
@@ -66,31 +96,36 @@ end
6696
$(SIGNATURES)
6797
Delete big data entry from the factor graph.
6898
Note this doesn't remove it from any data stores.
99+
100+
Notes:
101+
- users responsibility to delete big data in db before deleting entry
69102
"""
70-
function deleteBigDataEntry!(var::AbstractDFGVariable, key::Symbol)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
103+
function deleteBigDataEntry!(var::AbstractDFGVariable, key::Symbol)
71104
bde = getBigDataEntry(var, key)
72105
bde == nothing && return nothing
73106
delete!(var.bigData, key)
74107
return var
75108
end
76-
function deleteBigDataEntry!(dfg::AbstractDFG, label::Symbol, key::Symbol)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
109+
function deleteBigDataEntry!(dfg::AbstractDFG, label::Symbol, key::Symbol)
110+
#users responsibility to delete big data in db before deleting entry
77111
!isVariable(dfg, label) && return nothing
78112
return deleteBigDataEntry!(getVariable(dfg, label), key)
79113
end
80114

81-
function deleteBigDataEntry!(var::AbstractDFGVariable, entry::AbstractBigDataEntry)::Union{Nothing, AbstractDFGVariable} #users responsibility to delete big data in db before deleting entry
115+
function deleteBigDataEntry!(var::AbstractDFGVariable, entry::AbstractBigDataEntry)
116+
#users responsibility to delete big data in db before deleting entry
82117
return deleteBigDataEntry!(var, entry.key)
83118
end
84119

85120
"""
86121
$(SIGNATURES)
87122
Get big data entries, Vector{AbstractBigDataEntry}
88123
"""
89-
function getBigDataEntries(var::AbstractDFGVariable)::Vector{AbstractBigDataEntry}
124+
function getBigDataEntries(var::AbstractDFGVariable)
90125
#or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
91126
collect(values(var.bigData))
92127
end
93-
function getBigDataEntries(dfg::AbstractDFG, label::Symbol)::Union{Nothing, Vector{AbstractBigDataEntry}}
128+
function getBigDataEntries(dfg::AbstractDFG, label::Symbol)
94129
!isVariable(dfg, label) && return nothing
95130
#or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
96131
getBigDataEntries(getVariable(dfg, label))
@@ -101,10 +136,10 @@ end
101136
$(SIGNATURES)
102137
getBigDataKeys
103138
"""
104-
function getBigDataKeys(var::AbstractDFGVariable)::Vector{Symbol}
139+
function getBigDataKeys(var::AbstractDFGVariable)
105140
collect(keys(var.bigData))
106141
end
107-
function getBigDataKeys(dfg::AbstractDFG, label::Symbol)::Union{Nothing, Vector{Symbol}}
142+
function getBigDataKeys(dfg::AbstractDFG, label::Symbol)
108143
!isVariable(dfg, label) && return nothing
109144
getBigDataKeys(getVariable(dfg, label))
110145
end

src/CloudGraphsDFG/entities/CloudGraphsDFG.jl

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mutable struct CloudGraphsDFG{T <: AbstractParams} <: AbstractDFG
1010
userId::String
1111
robotId::String
1212
sessionId::String
13+
description::String
1314
encodePackedTypeFunc
1415
getPackedTypeFunc
1516
decodePackedTypeFunc
@@ -26,38 +27,41 @@ function CloudGraphsDFG{T}(neo4jConnection::Neo4j.Connection,
2627
userId::String,
2728
robotId::String,
2829
sessionId::String,
30+
description::String,
2931
encodePackedTypeFunc,
3032
getPackedTypeFunc,
3133
decodePackedTypeFunc,
3234
rebuildFactorMetadata!;
3335
solverParams::T=NoSolverParams()) where T <: AbstractParams
3436
graph = Neo4j.getgraph(neo4jConnection)
3537
neo4jInstance = Neo4jInstance(neo4jConnection, graph)
36-
return CloudGraphsDFG{T}(neo4jInstance, userId, robotId, sessionId, encodePackedTypeFunc, getPackedTypeFunc, decodePackedTypeFunc, rebuildFactorMetadata!, Symbol[], solverParams)
38+
return CloudGraphsDFG{T}(neo4jInstance, userId, robotId, sessionId, description, encodePackedTypeFunc, getPackedTypeFunc, decodePackedTypeFunc, rebuildFactorMetadata!, Symbol[], solverParams)
3739
end
3840
"""
3941
$(SIGNATURES)
4042
Create a new CloudGraphs-based DFG factor graph by specifying the Neo4j connection information.
4143
"""
4244
function CloudGraphsDFG{T}(host::String,
43-
port::Int,
44-
dbUser::String,
45-
dbPassword::String,
46-
userId::String,
47-
robotId::String,
48-
sessionId::String,
49-
encodePackedTypeFunc,
50-
getPackedTypeFunc,
51-
decodePackedTypeFunc,
52-
rebuildFactorMetadata!;
53-
solverParams::T=NoSolverParams()) where T <: AbstractParams
45+
port::Int,
46+
dbUser::String,
47+
dbPassword::String,
48+
userId::String,
49+
robotId::String,
50+
sessionId::String,
51+
description::String,
52+
encodePackedTypeFunc,
53+
getPackedTypeFunc,
54+
decodePackedTypeFunc,
55+
rebuildFactorMetadata!;
56+
solverParams::T=NoSolverParams()) where T <: AbstractParams
5457
neo4jConnection = Neo4j.Connection(host, port=port, user=dbUser, password=dbPassword);
55-
return CloudGraphsDFG{T}(neo4jConnection, userId, robotId, sessionId, encodePackedTypeFunc, getPackedTypeFunc, decodePackedTypeFunc, rebuildFactorMetadata!, solverParams=solverParams)
58+
return CloudGraphsDFG{T}(neo4jConnection, userId, robotId, sessionId, description, encodePackedTypeFunc, getPackedTypeFunc, decodePackedTypeFunc, rebuildFactorMetadata!, solverParams=solverParams)
5659
end
5760

5861

5962
function show(io::IO, c::CloudGraphsDFG)
6063
println(io, "CloudGraphsDFG:")
6164
println(io, " - Neo4J instance: $(c.neo4jInstance.connection.host)")
6265
println(io, " - Session: $(c.userId):$(c.robotId):$(c.sessionId)")
66+
println(io, " - Description: ", c.description)
6367
end

0 commit comments

Comments
 (0)