[openstack-dev] [mistral] Mistral Custom Actions API Design
dougal at redhat.com
Thu Mar 9 17:24:37 UTC 2017
On 9 March 2017 at 17:19, Dougal Matthews <dougal at redhat.com> wrote:
> On 9 March 2017 at 04:35, Ryan Brady <rbrady at redhat.com> wrote:
>> At the PTG and previous discussions in IRC, I mentioned there were two
>> different design ideas I had for the developer experience for custom action
>> development in mistral-lib. The purpose and intent behind the patch was
>> discussed in person at the PTG and that was helpful for me wrt to scope. I
>> feel it would be helpful to discuss and decide together the final piece of
>> this patch. I'd like to get any feedback on either of these two ideas as
>> they will shape how developers integrate with Mistral in the future, impact
>> our OpenStack integration efforts in mistral-extra. Nothing stops a
>> developer from adopting either style in their custom action libraries, but
>> most will likely want to remain consistent with style present in the
>> upstream code.
>> I have created separate declaration and usage examples in hopes of
>> illustrating some of the similarities and differences. To me it seems the
>> base class example is more declarative/explicit, but the mixin example is
>> more extensible and dry. Both examples reflect on backwards compatibility
>> and possible changes to how mistral checks for sync/async actions and how
>> to pass the context (as needed by actions that integrate with OpenStack).
>> base classes declaration: https://gist.github.com/rbrady/ff86c484e8e6e53b
>> base class usage: https://gist.github.com/rbrady/716a02fb2bd38d822c6df8
> The base class approach gets my vote for two reasons:
> 1. It is the simplest to use and document.
> 2. I don't think we have enough combinations (yet?) to warrant mixins.
3. The set_context method on the mixin isn't as clear as passing it to run.
Imagine I am scanning your code, I can see from the run that the context is
passed in. I don't need to look for the base class and look to see if
self.context is used.
>> mixins declaration: https://gist.github.com/rbrady/d30ae640b19df658
>> mixins usage: https://gist.github.com/rbrady/248cb52d5c5f94854d8c76
>> Ryan Brady
>> Cloud Engineering
>> rbrady at redhat.com
>> 919.890.8925 <(919)%20890-8925>
>>  https://review.openstack.org/#/c/411412/
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscrib
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev