<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Alright, thanks Winson!<div><br></div><div>Team, please review.</div><div><br><div>
<div>Renat Akhmerov</div><div>@ Mirantis Inc.</div><div><br></div><br class="Apple-interchange-newline">
</div>
<br><div><div>On 21 Mar 2014, at 06:43, W Chan <<a href="mailto:m4d.coder@gmail.com">m4d.coder@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">I submitted a rough draft for review @ <a href="https://review.openstack.org/#/c/81941/">https://review.openstack.org/#/c/81941/</a>. Instead of using the pecan hook, I added a class property for the transport in the abstract engine class. On the pecan app setup, I passed the shared transport to the engine on load. Please provide feedback. Thanks.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 17, 2014 at 9:37 AM, Ryan Petrello <span dir="ltr"><<a href="mailto:ryan.petrello@dreamhost.com" target="_blank">ryan.petrello@dreamhost.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Changing the configuration object at runtime is not thread-safe. If you want to share objects with controllers, I’d suggest checking out Pecan’s hook functionality.<br>
<br>
<a href="http://pecan.readthedocs.org/en/latest/hooks.html#implementating-a-pecan-hook" target="_blank">http://pecan.readthedocs.org/en/latest/hooks.html#implementating-a-pecan-hook</a><br>
<br>
e.g.,<br>
<br>
class SpecialContextHook(object):<br>
<br>
def __init__(self, some_obj):<br>
self.some_obj = some_obj<br>
<br>
def before(self, state):<br>
# In any pecan controller, `pecan.request` is a thread-local webob.Request instance,<br>
# allowing you to access `pecan.request.context[‘foo’]` in your controllers. In this example,<br>
# self.some_obj could be just about anything - a Python primitive, or an instance of some class<br>
state.request.context = {<br>
‘foo’: self.some_obj<br>
}<br>
<br>
...<br>
<br>
wsgi_app = pecan.Pecan(<br>
my_package.controllers.root.RootController(),<br>
hooks=[SpecialContextHook(SomeObj(1, 2, 3))]<br>
)<br>
<br>
---<br>
Ryan Petrello<br>
Senior Developer, DreamHost<br>
<a href="mailto:ryan.petrello@dreamhost.com">ryan.petrello@dreamhost.com</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Mar 14, 2014, at 8:53 AM, Renat Akhmerov <<a href="mailto:rakhmerov@mirantis.com">rakhmerov@mirantis.com</a>> wrote:<br>
<br>
> Take a look at method get_pecan_config() in mistral/api/app.py. It’s where you can pass any parameters into pecan app (see a dictionary ‘cfg_dict’ initialization). They can be then accessed via pecan.conf as described here: <a href="http://pecan.readthedocs.org/en/latest/configuration.html#application-configuration" target="_blank">http://pecan.readthedocs.org/en/latest/configuration.html#application-configuration</a>. If I understood the problem correctly this should be helpful.<br>
><br>
> Renat Akhmerov<br>
> @ Mirantis Inc.<br>
><br>
><br>
><br>
> On 14 Mar 2014, at 05:14, Dmitri Zimine <<a href="mailto:dz@stackstorm.com">dz@stackstorm.com</a>> wrote:<br>
><br>
>> We have access to all configuration parameters in the context of api.py. May be you don't pass it but just instantiate it where you need it? Or I may misunderstand what you're trying to do...<br>
>><br>
>> DZ><br>
>><br>
>> PS: can you generate and update mistral.config.example to include new oslo messaging options? I forgot to mention it on review on time.<br>
>><br>
>><br>
>> On Mar 13, 2014, at 11:15 AM, W Chan <<a href="mailto:m4d.coder@gmail.com">m4d.coder@gmail.com</a>> wrote:<br>
>><br>
>>> On the transport variable, the problem I see isn't with passing the variable to the engine and executor. It's passing the transport into the API layer. The API layer is a pecan app and I currently don't see a way where the transport variable can be passed to it directly. I'm looking at <a href="https://github.com/stackforge/mistral/blob/master/mistral/cmd/api.py#L50" target="_blank">https://github.com/stackforge/mistral/blob/master/mistral/cmd/api.py#L50</a> and <a href="https://github.com/stackforge/mistral/blob/master/mistral/api/app.py#L44" target="_blank">https://github.com/stackforge/mistral/blob/master/mistral/api/app.py#L44</a>. Do you have any suggestion? Thanks.<br>
>>><br>
>>><br>
>>> On Thu, Mar 13, 2014 at 1:30 AM, Renat Akhmerov <<a href="mailto:rakhmerov@mirantis.com">rakhmerov@mirantis.com</a>> wrote:<br>
>>><br>
>>> On 13 Mar 2014, at 10:40, W Chan <<a href="mailto:m4d.coder@gmail.com">m4d.coder@gmail.com</a>> wrote:<br>
>>><br>
>>>> • I can write a method in base test to start local executor. I will do that as a separate bp.<br>
>>> Ok.<br>
>>><br>
>>>> • After the engine is made standalone, the API will communicate to the engine and the engine to the executor via the oslo.messaging transport. This means that for the "local" option, we need to start all three components (API, engine, and executor) on the same process. If the long term goal as you stated above is to use separate launchers for these components, this means that the API launcher needs to duplicate all the logic to launch the engine and the executor. Hence, my proposal here is to move the logic to launch the components into a common module and either have a single generic launch script that launch specific components based on the CLI options or have separate launch scripts that reference the appropriate launch function from the common module.<br>
>>> Ok, I see your point. Then I would suggest we have one script which we could use to run all the components (any subset of of them). So for those components we specified when launching the script we use this local transport. Btw, scheduler eventually should become a standalone component too, so we have 4 components.<br>
>>><br>
>>>> • The RPC client/server in oslo.messaging do not determine the transport. The transport is determine via oslo.config and then given explicitly to the RPC client/server. <a href="https://github.com/stackforge/mistral/blob/master/mistral/engine/scalable/engine.py#L31" target="_blank">https://github.com/stackforge/mistral/blob/master/mistral/engine/scalable/engine.py#L31</a> and <a href="https://github.com/stackforge/mistral/blob/master/mistral/cmd/task_executor.py#L63" target="_blank">https://github.com/stackforge/mistral/blob/master/mistral/cmd/task_executor.py#L63</a> are examples for the client and server respectively. The in process Queue is instantiated within this transport object from the fake driver. For the "local" option, all three components need to share the same transport in order to have the Queue in scope. Thus, we will need some method to have this transport object visible to all three components and hence my proposal to use a global variable and a factory method.<br>
>>> I’m still not sure I follow your point here.. Looking at the links you provided I see this:<br>
>>><br>
>>> transport = messaging.get_transport(cfg.CONF)<br>
>>><br>
>>> So my point here is we can make this call once in the launching script and pass it to engine/executor (and now API too if we want it to be launched by the same script). Of course, we’ll have to change the way how we initialize these components, but I believe we can do it. So it’s just a dependency injection. And in this case we wouldn’t need to use a global variable. Am I still missing something?<br>
>>><br>
>>><br>
>>> Renat Akhmerov<br>
>>> @ Mirantis Inc.<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> OpenStack-dev mailing list<br>
>>> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
>>> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> OpenStack-dev mailing list<br>
>>> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
>>> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
>><br>
>> _______________________________________________<br>
>> OpenStack-dev mailing list<br>
>> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
>> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>
_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev<br></blockquote></div><br></div></body></html>