)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"3cc2f6e922024257bab05a5099f5d5af57c5dec3","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\"automaton\" library, that is already in uses by several other OpenStack"},{"line_number":16,"context_line":"projects for similar purposes."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Class State is holds a state-space and a name of the state, and a list"},{"line_number":19,"context_line":"of states that we could go from it. Each State instance references 0"},{"line_number":20,"context_line":"or more other states within the same state-space as it\u0027s next_states"},{"line_number":21,"context_line":"attribute thus creating a directed graph."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_575e4046","line":18,"updated":"2015-07-06 16:15:25.000000000","message":"This seems like something that should just be in the automaton library itself; although it sounds like a dict of states, so why not just use a dict (the fsm class already retains this same information, so maybe its not even needed?)??\n\nIs the idea that state-space would contain the information like what ironic did in https://github.com/openstack/ironic/blob/master/ironic/common/states.py but in a single \u0027space\u0027 class?","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"cc98afe387a31bd802b986bd4ef4234c297e3e19","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\"automaton\" library, that is already in uses by several other OpenStack"},{"line_number":16,"context_line":"projects for similar purposes."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Class State is holds a state-space and a name of the state, and a list"},{"line_number":19,"context_line":"of states that we could go from it. Each State instance references 0"},{"line_number":20,"context_line":"or more other states within the same state-space as it\u0027s next_states"},{"line_number":21,"context_line":"attribute thus creating a directed graph."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_da334cf5","line":18,"in_reply_to":"ba3cc151_1831c4ec","updated":"2015-07-06 20:25:40.000000000","message":"Agreed that it could be done in automaton - and it could be a useful feature. I can also imagine an argument that having aliases is something that can easily be built on top :)\n\nI can see it being useful as a core feature for OpenStack in general with our strong policy on backwards compat.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"64e5a31498bed4092169bd86ece1339b091f78db","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\"automaton\" library, that is already in uses by several other OpenStack"},{"line_number":16,"context_line":"projects for similar purposes."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Class State is holds a state-space and a name of the state, and a list"},{"line_number":19,"context_line":"of states that we could go from it. Each State instance references 0"},{"line_number":20,"context_line":"or more other states within the same state-space as it\u0027s next_states"},{"line_number":21,"context_line":"attribute thus creating a directed graph."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_a3398e43","line":18,"in_reply_to":"ba3cc151_575e4046","updated":"2015-07-06 17:23:19.000000000","message":"Right - really need to document \u0027whys\u0027 too not only the \u0027whats\u0027\n\nThere are several advantages to having a wrapper class like this. \n\nThe Space class is meant to hold a global dictionary of states that we can easily instantiate an instance of an FSM with. If you look at the way it\u0027s used in teh next patch (not yet pushed to match this version but the idea is the same), or in the tests - you will see that _all_ you need to do is declare states - IMHO much more concise than the ironic code where you need to declare transitions explicitly. Then an FSM instance can be created at any time by just instantiating it with a space of states, and giving it a current state potentially. there is no need to have a global instance that we copy like in ironic. The reason this is more useful for Nova is that we use the state machine for migrations for example in several services on an request RPC path, not only in the conductor like ironic does - so copying a python object who\u0027s information is mostly global/stored is not reasonable for us.\n\nIf you consider this approach to be generally useful - we could add some bits of it to automaton for sure.\n\nIn addition to that this will allow us to rename states in a live systems where both names can be stored in the DB as we can wrap deprecated state names in this and just declare them as such.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"e8332c8436be3760f646f7ab3b52ed504930c751","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\"automaton\" library, that is already in uses by several other OpenStack"},{"line_number":16,"context_line":"projects for similar purposes."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Class State is holds a state-space and a name of the state, and a list"},{"line_number":19,"context_line":"of states that we could go from it. Each State instance references 0"},{"line_number":20,"context_line":"or more other states within the same state-space as it\u0027s next_states"},{"line_number":21,"context_line":"attribute thus creating a directed graph."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_1831c4ec","line":18,"in_reply_to":"ba3cc151_a3398e43","updated":"2015-07-06 17:44:23.000000000","message":"After talking on IRC, i get the state-space stuff (its just another way to define the states that will be a machine, although imho it does seem overly complex here); as for renaming, that seems like u just want some kind of state \u0027aliasing\u0027 support, which could just be done in automaton itself (easily).","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"e2423e52cacf18bc226cc87e23a21616ae3000a6","unresolved":false,"context_lines":[{"line_number":15,"context_line":"\"automaton\" library, that is already in uses by several other OpenStack"},{"line_number":16,"context_line":"projects for similar purposes."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Class State is holds a state-space and a name of the state, and a list"},{"line_number":19,"context_line":"of states that we could go from it. Each State instance references 0"},{"line_number":20,"context_line":"or more other states within the same state-space as it\u0027s next_states"},{"line_number":21,"context_line":"attribute thus creating a directed graph."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_9e72957b","line":18,"in_reply_to":"ba3cc151_da334cf5","updated":"2015-07-06 21:36:06.000000000","message":"Sure, automaton patches welcome :)\n\nWe release it pretty much as needed, so I don\u0027t think it would take to long :-P","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"60d55aed29b281b4cccfe2cf36ab558c941de721","unresolved":false,"context_lines":[{"line_number":23,"context_line":"Class FSM represents a state machine, and is a slightly customized"},{"line_number":24,"context_line":"version of the automaton FiniteMachine class that when given a"},{"line_number":25,"context_line":"state-space, builds a graph of all known states and it\u0027s transitions,"},{"line_number":26,"context_line":"and also exposes a step() method that will either progress the machine"},{"line_number":27,"context_line":"to a new state or raise an error if the transition is not valid for the"},{"line_number":28,"context_line":"given state-space."},{"line_number":29,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_ee80da8d","line":26,"updated":"2015-07-06 18:54:40.000000000","message":"step() seems like process_event() and therefore i\u0027m not sure if its needed?","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"b5339705c2110cd6b58619071ccd312e3b86ccb8","unresolved":false,"context_lines":[{"line_number":23,"context_line":"Class FSM represents a state machine, and is a slightly customized"},{"line_number":24,"context_line":"version of the automaton FiniteMachine class that when given a"},{"line_number":25,"context_line":"state-space, builds a graph of all known states and it\u0027s transitions,"},{"line_number":26,"context_line":"and also exposes a step() method that will either progress the machine"},{"line_number":27,"context_line":"to a new state or raise an error if the transition is not valid for the"},{"line_number":28,"context_line":"given state-space."},{"line_number":29,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_cf15a29b","line":26,"in_reply_to":"ba3cc151_77a55602","updated":"2015-07-07 15:59:38.000000000","message":"For now....\n\nState machines typically process an event, then transition to a new state. Just because nova doesn\u0027t quite know what to call those \u0027events\u0027 right now doesn\u0027t mean it will in the future... Anyways, I hope nova eventually cares about using it correctly someday...","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"153ee961af610c1f854d4bdb5f35cb3b2069df19","unresolved":false,"context_lines":[{"line_number":23,"context_line":"Class FSM represents a state machine, and is a slightly customized"},{"line_number":24,"context_line":"version of the automaton FiniteMachine class that when given a"},{"line_number":25,"context_line":"state-space, builds a graph of all known states and it\u0027s transitions,"},{"line_number":26,"context_line":"and also exposes a step() method that will either progress the machine"},{"line_number":27,"context_line":"to a new state or raise an error if the transition is not valid for the"},{"line_number":28,"context_line":"given state-space."},{"line_number":29,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"ba3cc151_77a55602","line":26,"in_reply_to":"ba3cc151_ee80da8d","updated":"2015-07-07 15:24:06.000000000","message":"With the difference that it takes the next state, and not an event, which is what Nova cares about.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"}],"nova/states.py":[{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"3cc2f6e922024257bab05a5099f5d5af57c5dec3","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        self.states \u003d states or {}"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class State(object):"},{"line_number":29,"context_line":"    _registered_states \u003d collections.defaultdict(_StateStore)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def __new__(cls, state_space, name, initial\u003dFalse, next_states\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_d70490c7","line":28,"updated":"2015-07-06 16:15:25.000000000","message":"So this and state-store confuses me a little, a state machine already has its states and transitions, why have another class (named state/state-store) that has that information also? Why not just retain that in the FSM below in the first place...\n\nPerhaps a comment/docstring explaining why this is needed would be useful.\n\nIs the idea for this just to contain all the states in a nice place? Or something else? Perhaps it should just be in the automaton library itself?","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"d79f1aa6dab1cd82b08828ef927b31e7e1880fa8","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        self.states \u003d states or {}"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class State(object):"},{"line_number":29,"context_line":"    _registered_states \u003d collections.defaultdict(_StateStore)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def __new__(cls, state_space, name, initial\u003dFalse, next_states\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_de0edde4","line":28,"in_reply_to":"ba3cc151_1a20d448","updated":"2015-07-06 21:36:53.000000000","message":"Ok dokie.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"7d2c58803e62a27dacc5b2885ef4fec6cdefdca5","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        self.states \u003d states or {}"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class State(object):"},{"line_number":29,"context_line":"    _registered_states \u003d collections.defaultdict(_StateStore)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def __new__(cls, state_space, name, initial\u003dFalse, next_states\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_f86180d4","line":28,"in_reply_to":"ba3cc151_432522c0","updated":"2015-07-06 17:57:13.000000000","message":"Sounds like something that could just go into automaton\n\nPerhaps under something like:\n\n   automaton/\n      __init__.py\n      readers/\n         __init__.py\n         state_space.py\n      ...\n\nThen automaton can have alternate ways of reading from different things. Although I\u0027d rather have this named differently, since to me its more of a adjancy list (from graph terminology) http://xlinux.nist.gov/dads/HTML/adjacencyListRep.html vs what other projects use which is more of a edge list, ... So perhaps it should just be called adjacency_list instead of state-space in the first place :-P","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"64e5a31498bed4092169bd86ece1339b091f78db","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        self.states \u003d states or {}"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class State(object):"},{"line_number":29,"context_line":"    _registered_states \u003d collections.defaultdict(_StateStore)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def __new__(cls, state_space, name, initial\u003dFalse, next_states\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_432522c0","line":28,"in_reply_to":"ba3cc151_d70490c7","updated":"2015-07-06 17:23:19.000000000","message":"Some of this was explained on the commit message, but let me add one more thing - the concerns of this class and the state dictionary in automaton classes are slightly different. Automaton classes only concern themselves with names of states and the way a machine would go from one state to the next (we don\u0027t care about all of that in Nova like firing callbacks etc.), This class concerns itself with having a nice programming interface to declaring states in a space of states, and also providing a place to put future functionality (for example renaming states in a system that stores them somewhere) that is really mostly Nova specific.\n\nIf you think some of it is useful - I\u0027d be happy to propose it for automaton soon (no need to block the Nova work on it though.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"cc98afe387a31bd802b986bd4ef4234c297e3e19","unresolved":false,"context_lines":[{"line_number":25,"context_line":"        self.states \u003d states or {}"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class State(object):"},{"line_number":29,"context_line":"    _registered_states \u003d collections.defaultdict(_StateStore)"},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"    def __new__(cls, state_space, name, initial\u003dFalse, next_states\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_1a20d448","line":28,"in_reply_to":"ba3cc151_f86180d4","updated":"2015-07-06 20:25:40.000000000","message":"sounds good! will look into this later in the week when I work out some other Nova patches that build upon this a bit.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"3cc2f6e922024257bab05a5099f5d5af57c5dec3","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        _add_state(initial_state)"},{"line_number":78,"context_line":"        self.default_start_state \u003d initial_state.name"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    @property"},{"line_number":81,"context_line":"    def states_(self):"},{"line_number":82,"context_line":"        return [State(self.state_space, state_name)"},{"line_number":83,"context_line":"                for state_name in self.states]"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_174bd85a","line":80,"updated":"2015-07-06 16:15:25.000000000","message":"Why have these?","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"64e5a31498bed4092169bd86ece1339b091f78db","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        _add_state(initial_state)"},{"line_number":78,"context_line":"        self.default_start_state \u003d initial_state.name"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    @property"},{"line_number":81,"context_line":"    def states_(self):"},{"line_number":82,"context_line":"        return [State(self.state_space, state_name)"},{"line_number":83,"context_line":"                for state_name in self.states]"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_03207af6","line":80,"in_reply_to":"ba3cc151_174bd85a","updated":"2015-07-06 17:23:19.000000000","message":"yeah they are not critical at all","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"253570a1c1384200e2e865dcb00fba36ea531261","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        return State(self.state_space, self.current_state)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"    def _transition(self, new_state):"},{"line_number":90,"context_line":"        return self.current_state + \u0027-\u0027 + new_state.name"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def step(self, state):"},{"line_number":93,"context_line":"        if isinstance(state, six.string_types):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_f892e0f5","line":90,"updated":"2015-07-06 18:03:44.000000000","message":"This seems like something that should just be in the state-space as a way to make \u0027fake\u0027 transitions, vs being here (afaik this is just due to this codes current lack of transition names, which may get better someday).","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"cc98afe387a31bd802b986bd4ef4234c297e3e19","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        return State(self.state_space, self.current_state)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"    def _transition(self, new_state):"},{"line_number":90,"context_line":"        return self.current_state + \u0027-\u0027 + new_state.name"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def step(self, state):"},{"line_number":93,"context_line":"        if isinstance(state, six.string_types):"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_da758c32","line":90,"in_reply_to":"ba3cc151_f892e0f5","updated":"2015-07-06 20:25:40.000000000","message":"yes that sounds more right than it living here,","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"3cc2f6e922024257bab05a5099f5d5af57c5dec3","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            self.process_event(self._transition(state))"},{"line_number":97,"context_line":"        except automaton_exceptions.NotInitialized:"},{"line_number":98,"context_line":"            self.initialize(state.name)"},{"line_number":99,"context_line":"        except automaton_exceptions.NotFound:"},{"line_number":100,"context_line":"            raise exception.InvalidStateTransition(state\u003dself.current_state,"},{"line_number":101,"context_line":"                                                   new_state\u003dstate.name)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_f41c3279","line":98,"updated":"2015-07-06 16:15:25.000000000","message":"This just seems weird. Why not just explicitly call initialize in the right place?","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"861b0f43c5b9cf011073103690b745bbc334c81d","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            self.process_event(self._transition(state))"},{"line_number":97,"context_line":"        except automaton_exceptions.NotInitialized:"},{"line_number":98,"context_line":"            self.initialize(state.name)"},{"line_number":99,"context_line":"        except automaton_exceptions.NotFound:"},{"line_number":100,"context_line":"            raise exception.InvalidStateTransition(state\u003dself.current_state,"},{"line_number":101,"context_line":"                                                   new_state\u003dstate.name)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_63ff0635","line":98,"in_reply_to":"ba3cc151_f41c3279","updated":"2015-07-06 17:25:46.000000000","message":"agreed.","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"64e5a31498bed4092169bd86ece1339b091f78db","unresolved":false,"context_lines":[{"line_number":95,"context_line":"        try:"},{"line_number":96,"context_line":"            self.process_event(self._transition(state))"},{"line_number":97,"context_line":"        except automaton_exceptions.NotInitialized:"},{"line_number":98,"context_line":"            self.initialize(state.name)"},{"line_number":99,"context_line":"        except automaton_exceptions.NotFound:"},{"line_number":100,"context_line":"            raise exception.InvalidStateTransition(state\u003dself.current_state,"},{"line_number":101,"context_line":"                                                   new_state\u003dstate.name)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba3cc151_436d2231","line":98,"in_reply_to":"ba3cc151_f41c3279","updated":"2015-07-06 17:23:19.000000000","message":"yar - I am actually thinking of removing this","commit_id":"437548f0cd336beab3b3b1887597cfea78d774d8"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"5c85625e8575efa741a0fa5c3ed576c5492f7678","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            state \u003d State(self.state_space, state)"},{"line_number":123,"context_line":"        try:"},{"line_number":124,"context_line":"            self.process_event(self.current_state_._transition(state))"},{"line_number":125,"context_line":"        except automaton_exceptions.NotInitialized:"},{"line_number":126,"context_line":"            self.initialize(state.name)"},{"line_number":127,"context_line":"        except automaton_exceptions.NotFound:"},{"line_number":128,"context_line":"            raise exception.InvalidStateTransition(state\u003dself.current_state,"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_4f73d2e7","line":125,"updated":"2015-07-07 16:08:46.000000000","message":"I still don\u0027t understand why u are initializing at step() time, just initialize it at the right place from the calling code and avoid trying to do that in here. If it can\u0027t be found where to do the initialize then thats a bigger problem imho. Combining two seperate functions (initialization and transitioning a state machine) into one seems just like a bad idea.","commit_id":"3bdbeb23de7d1d0c257852d837c561b5e8e66885"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"282007fef768b49f45dc48c849b7682d8ef49bf3","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            state \u003d State(self.state_space, state)"},{"line_number":123,"context_line":"        try:"},{"line_number":124,"context_line":"            self.process_event(self.current_state_._transition(state))"},{"line_number":125,"context_line":"        except automaton_exceptions.NotInitialized:"},{"line_number":126,"context_line":"            self.initialize(state.name)"},{"line_number":127,"context_line":"        except automaton_exceptions.NotFound:"},{"line_number":128,"context_line":"            raise exception.InvalidStateTransition(state\u003dself.current_state,"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_c0856f59","line":125,"in_reply_to":"ba3cc151_4f73d2e7","updated":"2015-07-07 16:42:30.000000000","message":"Ah right - I forgot about this when updating it today. will do.","commit_id":"3bdbeb23de7d1d0c257852d837c561b5e8e66885"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"d61f222405437122d04cbcf8e26713f40f379f3e","unresolved":false,"context_lines":[{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        return obj"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    def _transition(self, new_state):"},{"line_number":68,"context_line":"        return self.name + \u0027-\u0027 + new_state.name"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def __unicode__(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_49b49934","line":67,"updated":"2015-07-10 00:41:49.000000000","message":"I really start to wonder if all the hackery below with `states_` and `current_state_` just to get around not having transitions names should just be solved by having transition names in the first place.","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"06e5a00eb664975c13b88ee320b1d55d6baec19e","unresolved":false,"context_lines":[{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        return obj"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    def _transition(self, new_state):"},{"line_number":68,"context_line":"        return self.name + \u0027-\u0027 + new_state.name"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"    def __unicode__(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_a95525c3","line":67,"in_reply_to":"ba3cc151_49b49934","updated":"2015-07-10 00:47:23.000000000","message":"In general I mean, spend the time thinking about transition names and there implications and meanings (just like ironic folks spent time figuring out) and then apply the same process here (vs skipping thinking about it at all).","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"cd330136a6195ef68619dae481452ce6d5ae696a","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    state. This lets us avoid having a global instance of a machine that we"},{"line_number":81,"context_line":"    copy, and in turn lets us  instantiate a throwaway one when needed."},{"line_number":82,"context_line":"    \"\"\""},{"line_number":83,"context_line":"    def __init__(self, state_space, set_state\u003dNone):"},{"line_number":84,"context_line":"        if state_space not in State._registered_states:"},{"line_number":85,"context_line":"            raise exception.InvalidStateSpace(state_space\u003dstate_space)"},{"line_number":86,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_8935c1dc","line":83,"updated":"2015-07-10 00:38:56.000000000","message":"This association with a `state_space` seems like it should belong in a factory or other method, this is not really imho initializing a state machine attribute but doing a heck of a-lot more (and starts to feel like a violation of what a constructor should do, ie minimal stuff, not setup a full state machine).\n\nWhich makes me wonder about this:\n\n   @classmethod\n   def prepare_machine(cls, space_name):\n       .... create a fsm...\n       .... do the _populate_states call\n       .... initialize it\n       return it\n\nThen the `__init__` method isn\u0027t overload to do all these things.","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"cd330136a6195ef68619dae481452ce6d5ae696a","unresolved":false,"context_lines":[{"line_number":109,"context_line":"        self.default_start_state \u003d initial_state.name"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"    @property"},{"line_number":112,"context_line":"    def states_(self):"},{"line_number":113,"context_line":"        return [State(self.state_space, state_name)"},{"line_number":114,"context_line":"                for state_name in self.states]"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_e94a4d5b","line":112,"updated":"2015-07-10 00:38:56.000000000","message":"Thought u were going to remove this?","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"cd330136a6195ef68619dae481452ce6d5ae696a","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    @property"},{"line_number":117,"context_line":"    def current_state_(self):"},{"line_number":118,"context_line":"        return State(self.state_space, self.current_state)"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def step(self, state):"},{"line_number":121,"context_line":"        if isinstance(state, six.string_types):"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_0950d109","line":118,"updated":"2015-07-10 00:38:56.000000000","message":"Thought u were going to remove this?","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"5c3abbce29c0422306da0963cfb048472ce8d0e4","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        return State(self.state_space, self.current_state)"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def step(self, state):"},{"line_number":121,"context_line":"        if isinstance(state, six.string_types):"},{"line_number":122,"context_line":"            state \u003d State(self.state_space, state)"},{"line_number":123,"context_line":"        try:"},{"line_number":124,"context_line":"            self.process_event(self.current_state_._transition(state))"}],"source_content_type":"text/x-python","patch_set":7,"id":"ba3cc151_2918351e","line":121,"updated":"2015-07-10 00:49:52.000000000","message":"So the only real reason for this step function is because we don\u0027t have a known useful set of transition names, I start to wonder if time should just be spent on figuring that out, vs hacking auto-generated ones in.","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"cfa40c07c87eb4b0a0c08538c5a4d77132a8f998","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        obj.state_space \u003d state_space"},{"line_number":58,"context_line":"        obj.name \u003d name"},{"line_number":59,"context_line":"        obj.terminal \u003d terminal"},{"line_number":60,"context_line":"        obj.next_states \u003d next_states and set(next_states) or set([])"},{"line_number":61,"context_line":"        store.states[name] \u003d obj"},{"line_number":62,"context_line":"        if initial:"},{"line_number":63,"context_line":"            store.initial \u003d obj"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a41bdd9_0ecf4a57","line":60,"updated":"2015-07-13 06:44:53.000000000","message":"should we check the next_states is coming from the same state_space?","commit_id":"47e83277c8e1e9193ba51da47dcd55f701c21ef7"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"9a23eeb204abdfd30c9ed996918f72a2aed19018","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        obj.state_space \u003d state_space"},{"line_number":58,"context_line":"        obj.name \u003d name"},{"line_number":59,"context_line":"        obj.terminal \u003d terminal"},{"line_number":60,"context_line":"        obj.next_states \u003d next_states and set(next_states) or set([])"},{"line_number":61,"context_line":"        store.states[name] \u003d obj"},{"line_number":62,"context_line":"        if initial:"},{"line_number":63,"context_line":"            store.initial \u003d obj"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a41bdd9_2d8ed378","line":60,"in_reply_to":"9a41bdd9_0ecf4a57","updated":"2015-07-13 07:22:11.000000000","message":"Emm...I tested it quickly.\n\nIn [1]: from nova import states\n\nIn [2]: state \u003d states.State(\"ns1\", \u0027st1\u0027)\n\nIn [3]: state2 \u003d states.State(\"ns2\", \"st2\", initial\u003dTrue, next_states\u003d[state])\n\nIn [4]: states.FSM(\u0027ns2\u0027)\nOut[4]: \u003cnova.states.FSM at 0x7f93bd304150\u003e\n\nIn [5]: m \u003d states.FSM(\u0027ns2\u0027)\n\nIn [9]: m.step(\u0027st1\u0027)\nOut[9]: \u003cnova.states.FSM at 0x7f93bd3042d0\u003e\n\nIn [10]: m.current_state\nOut[10]: \u0027st1\u0027\n\nIn [11]: m.current_state_\nOut[11]: \u003cnova.states.State at 0x7f93bd329110\u003e\n\nIn [12]: m.current_state_.state_space\nOut[12]: \u0027ns2\u0027\n\n\nafter execute \"m.current_state_\". It create new state (\"ns2\", \"st1\")","commit_id":"47e83277c8e1e9193ba51da47dcd55f701c21ef7"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"e43b2727540cfafe807690f490e9549183e0e271","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        obj.state_space \u003d state_space"},{"line_number":58,"context_line":"        obj.name \u003d name"},{"line_number":59,"context_line":"        obj.terminal \u003d terminal"},{"line_number":60,"context_line":"        obj.next_states \u003d next_states and set(next_states) or set([])"},{"line_number":61,"context_line":"        store.states[name] \u003d obj"},{"line_number":62,"context_line":"        if initial:"},{"line_number":63,"context_line":"            store.initial \u003d obj"}],"source_content_type":"text/x-python","patch_set":9,"id":"9a41bdd9_766b481f","line":60,"in_reply_to":"9a41bdd9_2d8ed378","updated":"2015-07-13 08:45:10.000000000","message":"Nice catch - I actually started doing validation of next_states but then I decided to post without it just to hear thougths on the idea.\n\nWill update the patch - thanks for the thorough review","commit_id":"47e83277c8e1e9193ba51da47dcd55f701c21ef7"}],"requirements.txt":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"f7f69720cce45ca5bf8530f7546f8b797c5a42a4","unresolved":false,"context_lines":[{"line_number":48,"context_line":"psutil\u003c2.0.0,\u003e\u003d1.1.1"},{"line_number":49,"context_line":"oslo.versionedobjects!\u003d0.5.0,\u003e\u003d0.3.0"},{"line_number":50,"context_line":"alembic\u003e\u003d0.7.2"},{"line_number":51,"context_line":"automaton"}],"source_content_type":"text/plain","patch_set":7,"id":"ba3cc151_03753ec9","line":51,"updated":"2015-07-09 09:27:47.000000000","message":"more a question than a comment, shouldn\u0027t we have the same versions that for global-reqs so here:\n\n  automaton\u003e\u003d0.2.0","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"1f76349aecf6b056d4cb9551ae977fd33467727a","unresolved":false,"context_lines":[{"line_number":48,"context_line":"psutil\u003c2.0.0,\u003e\u003d1.1.1"},{"line_number":49,"context_line":"oslo.versionedobjects!\u003d0.5.0,\u003e\u003d0.3.0"},{"line_number":50,"context_line":"alembic\u003e\u003d0.7.2"},{"line_number":51,"context_line":"automaton"}],"source_content_type":"text/plain","patch_set":7,"id":"ba3cc151_07b53ceb","line":51,"in_reply_to":"ba3cc151_03753ec9","updated":"2015-07-09 13:25:29.000000000","message":"yeah we should probably I never bothered to check the global requirements really.","commit_id":"ce2ad333a3563436f5994d2af42345745cec5477"}]}
