-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize graph CRUD API for update/merge/union #182
Comments
What is the scope for this? Does it include addVariable/factor. It would be nice to have consistency everywhere. |
Personally, we should just make it work (i.e. use what we have) for DFG v0.5.0, but then we should think about
for DFG v0.6.0? |
@dehann , please explain a bit more on the different solves |
EDIT DF, JT Sideline: So there's a larger discussion about how to stop users from using DFG.addVariable and start using IIF.addVariable for graphs that pack etc. It's led to a bit of confusion, trying to think of a good way to encourage users to use the IIF functions, and actually hide the DFG functions. Just planting the seed that it will affect this discussion.
Overall: These will be breaking changes as we would be changing signatures/behavior for addVariable/etc.. Let's do them for DFG 0.6.
As a philosophy, I'd like us to represent the underlying datastructure with no magic - e.g. most of our graph represents a dictionary - so implement standard behavior like a dictionary so that it feels familiar to users. Think of it as making sure users feel at home.
|
|
EDIT: xref https://www.juliarobotics.org/Caesar.jl/latest/faq/#What-is-supersolve?-1 |
Ok, Thanks, That cleared it up somewhat. |
GearsAD and I had a bit of confusion on the layers and where CRUD operations happens, so lets also try and define it here (I'll try, but please edit it to be more correct):
So my Idea here is to get everyone on the same page of what a crud operation mean on each level. EDIT: Updated a bit. What seems to stand out is that there are 2 kinds of operations:
|
Its CRUD vs Set-Theory... two terminologies for similar things -- as long as the outcome is sensible. After reading your previous comment, I started wondering if its not a good idea to actually tabulate this in the data design wiki for the data fields down the rows and which data level across the columns. Maybe we can indicate the container as the association. I'll try an example here but its not that easy at first pass, and should move to the wiki if we going to do this: Variable
EDIT: Moved to wiki |
Do we have an answer on this yet? I am starting to use other solve keys. |
Does it make sense to only copy one key in the solver data dict? For example |
Unil now I thought we should just copy the whole variable and then just refer to the independent solvekeys. No particular reason for it, except that we haven't explored this functionality much yet. We can do As it stands now, get gives you all keys, and update should update all keys. Not clear which answer were you looking for in addition to that? Can you clarify what you mean by split? |
👍 I also like the idea of reducing the variable size. Say you have 100 super solves on the server and just want
So its not something you are set for in the final design, just as it is now? On Variable level it is fine on the solver data dict is where I have the problem. I feel it defeats the purpose of the whole super solve structure.
Sorry if my terminology/English is wrong but i'll try and explain in concept. Don't get stuck on the names such as get/add/update/delete / CRUD / set theory. Its just for the concept.
That brings us back to #166
#201 already places #185 and comment in that already fits in with this A first use case as motivation.
So you can try and wait for
EDIT: Note currently it is addVariable and not setVariable. |
Thanks for example - makes sense. Yes, we laid the foundation but it hasn't been used yet, so this is a good discussion for the solver-side of it. Let me look over the weekend 👍 |
I like the idea of working on solve keys, because generally the solver would just want to work with a single key. The only issue I can see with this is that when calling
|
Thanks @Affie for good discussion today. Takeaways from discussion:
Please add if I missed anything. |
To summarize what we discussed:
We can consider using DFGVariable as immutable, ie. after you make it, it becomes a reference to the data it contains and you can change its fields safely. If you updateVariable it will overwrite it with a completely new one.
DFGVariable for convenience mutable struct DFGVariable <: AbstractDFGVariable
label::Symbol
timestamp::DateTime
tags::Vector{Symbol}
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}
solverDataDict::Dict{Symbol, VariableNodeData}
smallData::Dict{String, String}
bigData::Dict{Symbol, AbstractBigDataEntry}
solvable::Int
_internalId::Int64
end EDIT: On
so what about
|
So the next step is to create the inner CRUD for solver data. Not to be confused with mergeUpdateVariableSolverData! PR #231 Currently I only need an So usage would be: key = :parametric
v = getVariable(cloudfg, :x1, key) # or getVariable(cloudfg, :x1) since the update will only be on one key
vnd = solverData(v::DFGVariable, key=key)
#do something with vnd
updateVariableSolverData!(cloudfg, vnd, :x1, key) Does this sound correct. I don't know if it complicates things unnecessary. For performance, bulk operations would be needed for the cloud. EDIT: Edited a lot but if no key case
key = :parametric
v = getVariable(cloudfg, :x1) should return all keys |
How about if no key is given then it influences all keys in the current dfg object?
It should be possible (in the future) to start many of the same solvers, and just dictate a special solveKey, .e.g. @Affie, this will likely impact the decision on how to user |
If I understand you correctly, I don't think this is applicable if the
(or maybe if it only has one solvekey, that one)
Yes, that's why I looked at it again. If you are working in memory on :parametric, it doesn't make sense to deepcopy the variable and strip out :default or other solve keys. If you then |
If you ask to update a key that is not in a graph, then the new one should just be added to that DFG object? |
I guess it should follow updateVariable behavior. If it does not exist it is created. Thats how setSolverData currently works also. |
Yes, definitely. So no behavioral change in existing getVariable method.
|
If many fields in Variable and Factor become immutable, then we would likely need a way to replace the entire object so that small changes can be made. In this discussion: From the user perspective its something small, like: setTimestamp!(getVariable(dfg, :x12), now()) but the code underneath would then actually do a delete and replace. |
The weakest part at this point is not having definitions for standard API. So the direction now I believe should be that we define set theoretic graph terms like |
xref #232 |
I'm catching up on this and thanks it seems like it is snowballing. I'd like to nail this down a bit :) okay: standardization. Yes - sets looks good ✔️. One thing, I'd like to push not to make the functions smarter than they need to be. Update a variable should update the complete variable - that is needed for general use. Understand if we need something special, but then let's introduce that as a new function - e.g. inner CRUD for solver data. That makes sense. |
definitions of EDIT: problem is API standardization has become the venue for design decisions as well as word meaning. Definition ratificatin via the wiki is intended to resolve the latter first, since design is going to take longer. |
could i invite commentary on verbNoun definitions please, most content already populated on the wiki. |
EDIT: COMMENT MISTAKE, moved to #145 as suggested below. |
I think its should be in #145 |
OOPS THANKS, copying there |
FYI a large part of this has been captured in the new verbNoun definitions: |
I think we should be good on update/merge/union. This issue helped us identify the need for verbNoun definitions which is mostly complete and hence I think we can close this. |
To capture discussion and decision: want to make sure we have consistent update/merge/union behavior. I think there was a renaming from update to merge at some point perhaps. Something to the effect of (and free to disagree):
update
will update an existing key,merge
will update or add depending on the key,union
cannot update existing key but can add differing keys.Strictly speaking union should return differing and both on collision, but we not ready to support all that functionality yet I think.
The text was updated successfully, but these errors were encountered: