Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(178)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 5909056: Implement child relation hook context with lookup by relation id

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 9 months ago by jimbaker
Modified:
13 years, 9 months ago
Reviewers:
mp+99149, hazmat
Visibility:
Public.
https://code.launchpad.net/~jimbaker/juju/relation-hook-context/+merge/99149 Requires: https://code.launchpad.net/~jimbaker/juju/relation-id/+merge/99148 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 9

Patch Set 2 : - #

Total comments: 9

Patch Set 3 : - #

Patch Set 4 : Implement child relation hook context with lookup by relation id #

Total comments: 1
Created: 13 years, 9 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+629 lines, -96 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M juju/hooks/invoker.py View 1 2 6 chunks +67 lines, -8 lines 1 comment Download
M juju/hooks/scheduler.py View 1 1 chunk +1 line, -1 line 0 comments Download
M juju/hooks/tests/test_invoker.py View 1 2 3 35 chunks +217 lines, -44 lines 0 comments Download
M juju/state/errors.py View 1 2 1 chunk +14 lines, -0 lines 0 comments Download
M juju/state/hook.py View 1 2 9 chunks +117 lines, -34 lines 0 comments Download
M juju/state/relation.py View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M juju/state/tests/test_errors.py View 1 2 2 chunks +9 lines, -1 line 0 comments Download
M juju/state/tests/test_hook.py View 1 2 5 chunks +174 lines, -5 lines 0 comments Download
M juju/state/tests/test_relation.py View 1 2 3 1 chunk +18 lines, -0 lines 0 comments Download
M juju/state/tests/test_topology.py View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M juju/state/topology.py View 1 2 1 chunk +1 line, -1 line 0 comments Download
M juju/unit/lifecycle.py View 1 1 chunk +1 line, -0 lines 0 comments Download
M juju/unit/tests/test_lifecycle.py View 1 2 chunks +5 lines, -1 line 0 comments Download
Total messages: 9
|
jimbaker
Please take a look.
13 years, 9 months ago (2012年03月26日 01:49:32 UTC) #1
Please take a look.
Sign in to reply to this message.
hazmat
mostly the concern here is how this is trying to achieve a consistent state. https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py ...
13 years, 9 months ago (2012年03月27日 22:27:51 UTC) #2
mostly the concern here is how this is trying to achieve a consistent state.
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py
File juju/hooks/invoker.py (right):
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py#newcode129
juju/hooks/invoker.py:129: self._relation_contexts_flush_order = []
why are we tracking the context order here? the changes being made are to a
resource (unit-settings) that is effectively locked for the duration of the hook
execution.
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py#newcode285
juju/hooks/invoker.py:285: changes = yield context.flush()
for context in self._relation_context.values() given the above comment.
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py
File juju/state/hook.py (right):
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py#newcode127
juju/state/hook.py:127: 
we discussed this in our call, but fwiw.
its not clear that hook context should be responsible for this, as it manages a
single execution context. definitely passing in a topology to a state manager
raises a red flag.
there's inherently a race here, thats currently being avoided by passing around
the topology. afaics a cleaner way to do and avoid the topology passing is 1)
calculate the full rel set upfront, 2) this lets the individual hook contexts
continue to manage their own consistency on a per relation basis.
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py#newcode162
juju/state/hook.py:162: getattr(self, "_change", EMPTY_CHANGE),
empty change should go into the spec. charm authors would need to be aware of
this. several charms dispatch on change type. for non implicit hook contexts, i
think the change should always be none, else its propagating change information
out of context.
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py#newcode197
juju/state/hook.py:197: self._relation_id = relation_id if relation_id else
change.relation_id
why would it be passed in sometimes and on the change at others.
it feels like the construction should be uniform here, the caller is making the
distinction between implicit/implied contexts.
ie. relation_id is required.
Sign in to reply to this message.
jimbaker
Please take a look.
13 years, 9 months ago (2012年03月30日 05:30:27 UTC) #3
Please take a look.
Sign in to reply to this message.
jimbaker
Please take a look at the latest proposal https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py File juju/hooks/invoker.py (right): https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py#newcode129 juju/hooks/invoker.py:129: self._relation_contexts_flush_order ...
13 years, 9 months ago (2012年03月30日 06:10:57 UTC) #4
Please take a look at the latest proposal
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py
File juju/hooks/invoker.py (right):
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py#newcode129
juju/hooks/invoker.py:129: self._relation_contexts_flush_order = []
Removed per discussion.
https://codereview.appspot.com/5909056/diff/1/juju/hooks/invoker.py#newcode285
juju/hooks/invoker.py:285: changes = yield context.flush()
Removed
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py
File juju/state/hook.py (right):
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py#newcode127
juju/state/hook.py:127: 
No longer passing in the topology to the state mgr
https://codereview.appspot.com/5909056/diff/1/juju/state/hook.py#newcode197
juju/state/hook.py:197: self._relation_id = relation_id if relation_id else
change.relation_id
Now required
Sign in to reply to this message.
hazmat
lgtm. please add a bug for the inconsistent memberships across relations within a hook. also ...
13 years, 9 months ago (2012年04月02日 15:16:37 UTC) #5
lgtm.
please add a bug for the inconsistent memberships across relations within a
hook.
also add a test for a relation removed during execution (post invoker start).
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py
File juju/hooks/invoker.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py#newcod...
juju/hooks/invoker.py:151: # flushed since it could be a nonrelational context
drop everything after the semicolon, as the rest isn't true, the primary context
is always tracked as _context.
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py#newcod...
juju/hooks/invoker.py:158: relation_idents = set((yield
self.get_relation_idents(None)))
could use an inline comment, about what its doing (ie. None ==all)
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/tests/test_invoke...
File juju/hooks/tests/test_invoker.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/tests/test_invoke...
juju/hooks/tests/test_invoker.py:988: " Setting changed: 'a'='42' (was
unset)",
changes need to be qualified with relation ident now that they can refer to any
of a unit's relation settings.
https://codereview.appspot.com/5909056/diff/6001/juju/state/hook.py
File juju/state/hook.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/state/hook.py#newcode18
juju/state/hook.py:18: "relation_ident change_type unit_name")):
nice
https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.py
File juju/state/tests/test_hook.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.p...
juju/state/tests/test_hook.py:452: ValueError)
these would be better as invalidrelationidentity
Sign in to reply to this message.
jimbaker
Please take a look. https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.py File juju/state/tests/test_hook.py (right): https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.py#newcode452 juju/state/tests/test_hook.py:452: ValueError) Changed to InvalidRelationIdentity.
13 years, 9 months ago (2012年04月04日 00:58:14 UTC) #6
Please take a look.
https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.py
File juju/state/tests/test_hook.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/state/tests/test_hook.p...
juju/state/tests/test_hook.py:452: ValueError)
Changed to InvalidRelationIdentity.
Sign in to reply to this message.
jimbaker
This also addresses the following concerns: Relation members will now be empty if the relation ...
13 years, 9 months ago (2012年04月04日 01:04:56 UTC) #7
This also addresses the following concerns:
Relation members will now be empty if the relation has been removed, paralleling
what happens in a DepartedRelationHookContext; formerly an InternalTopologyError
was actually raised. This also required fixing code in juju.state.relation.
Removing relations is now tested, both in test_hook and test_invoker.
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py
File juju/hooks/invoker.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py#newcod...
juju/hooks/invoker.py:151: # flushed since it could be a nonrelational context
That was part of an obsolete comment; removed
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/invoker.py#newcod...
juju/hooks/invoker.py:158: relation_idents = set((yield
self.get_relation_idents(None)))
On 2012年04月02日 15:16:37, hazmat wrote:
> could use an inline comment, about what its doing (ie. None ==all)
Done.
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/tests/test_invoke...
File juju/hooks/tests/test_invoker.py (right):
https://codereview.appspot.com/5909056/diff/6001/juju/hooks/tests/test_invoke...
juju/hooks/tests/test_invoker.py:988: " Setting changed: 'a'='42' (was
unset)",
Relation settings on relations other than the parent are now qualified.
Sign in to reply to this message.
jimbaker
Please take a look.
13 years, 9 months ago (2012年04月04日 01:17:10 UTC) #8
Please take a look.
Sign in to reply to this message.
hazmat
looks good, nice work. one minor discussed on irc. https://codereview.appspot.com/5909056/diff/8212/juju/hooks/invoker.py File juju/hooks/invoker.py (right): https://codereview.appspot.com/5909056/diff/8212/juju/hooks/invoker.py#newcode308 juju/hooks/invoker.py:308: ...
13 years, 9 months ago (2012年04月04日 01:32:03 UTC) #9
looks good, nice work. one minor discussed on irc.
https://codereview.appspot.com/5909056/diff/8212/juju/hooks/invoker.py
File juju/hooks/invoker.py (right):
https://codereview.appspot.com/5909056/diff/8212/juju/hooks/invoker.py#newcod...
juju/hooks/invoker.py:308: if context is self._context:
it feels like we should always have rel id reported on change instead of
omitting it
Sign in to reply to this message.
|
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /