<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; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>So this design is starting to look pretty familiar to a what we have in taskflow.</div>
<div><br>
</div>
<div>Any reason why it can't just be used instead?</div>
<div><br>
</div>
<div><a href="https://etherpad.openstack.org/p/TaskFlowWorkerBasedEngine">https://etherpad.openstack.org/p/TaskFlowWorkerBasedEngine</a></div>
<div><br>
</div>
<div>This code is in a functional state right now, using kombu (for the moment, until oslo.messaging becomes py3 compliant).</div>
<div><br>
</div>
<div>The concept of a engine which puts messages on a queue for a remote executor is in-fact exactly the case taskflow is doing (the remote exeuctor/worker will then respond when it is done and the engine will then initiate the next piece of work to do) in
 the above listed etherpad (and which is implemented).</div>
<div><br>
</div>
<div>Is it the case that in mistral the engine will be maintaining the 'orchestration' of the workflow during the lifetime of that workflow? In the case of mistral what is an engine server? Is this a server that has engines in it (where each engine is 'orchestrating'
 the remote/local workflows and monitoring and recording the state transitions and data flow that is occurring)? The details @ <a href="https://blueprints.launchpad.net/mistral/+spec/mistral-engine-standalone-process">https://blueprints.launchpad.net/mistral/+spec/mistral-engine-standalone-process</a> seems
 to be already what taskflow provides via its engine object, creating a application which runs engines and those engines initiate workflows is made to be dead simple.</div>
<div><br>
</div>
<div>From previous discussions with the mistral folks it seems like the overlap here is getting more and more, which seems to be bad (and means something is broken/wrong). In fact most of the concepts that u have blueprints for have already been completed in
 taskflow (data-flow, engine being disconnected from the rest api…) and ones u don't have listed (resumption, reversion…). </div>
<div><br>
</div>
<div>What can we do to fix this situation?</div>
<div><br>
</div>
<div>-Josh</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Nikolay Makhotkin <<a href="mailto:nmakhotkin@mirantis.com">nmakhotkin@mirantis.com</a>><br>
<span style="font-weight:bold">Reply-To: </span>"OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, February 25, 2014 at 11:30 PM<br>
<span style="font-weight:bold">To: </span>"OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [openstack-dev] [Mistral] Porting executor and engine to oslo.messaging<br>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div>
<div dir="ltr">Looks good. Thanks, Winson! 
<div><br>
</div>
<div>Renat, What do you think?</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Feb 26, 2014 at 10:00 AM, W Chan <span dir="ltr">
<<a href="mailto:m4d.coder@gmail.com" target="_blank">m4d.coder@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">The following link is the google doc of the proposed engine/executor message flow architecture.  <a href="https://drive.google.com/file/d/0B4TqA9lkW12PZ2dJVFRsS0pGdEU/edit?usp=sharing" target="_blank">https://drive.google.com/file/d/0B4TqA9lkW12PZ2dJVFRsS0pGdEU/edit?usp=sharing</a>
  
<div><br>
</div>
<div>The diagram on the right is the scalable engine where one or more engine sends requests over a transport to one or more executors.  The executor client, transport, and executor server follows the
<a href="https://github.com/openstack/oslo.messaging/tree/master/oslo/messaging/rpc" target="_blank">
RPC client/server design pattern</a> in oslo.messaging.</div>
<div><br>
</div>
<div>The diagram represents the local engine.  In reality, it's following the same RPC client/server design pattern.  The only difference is that it'll be configured to use a
<a href="https://github.com/openstack/oslo.messaging/blob/master/oslo/messaging/_drivers/impl_fake.py" target="_blank">
fake</a> RPC backend driver.  The fake driver uses in process <a href="http://docs.python.org/2/library/queue.html#module-Queue" target="_blank">
queues</a> shared between a pair of engine and executor.</div>
<div><br>
</div>
<div>The following are the stepwise changes I will make.</div>
<div>1) Keep the local and scalable engine structure intact.  Create the Executor Client at ./mistral/engine/scalable/executor/client.py.  Create the Executor Server at ./mistral/engine/scalable/executor/service.py and implement the task operations under ./mistral/engine/scalable/executor/executor.py.
  Delete ./mistral/engine/scalable/executor/executor.py.  Modify the launcher ./mistral/cmd/task_executor.py.  Modify ./mistral/engine/scalable/engine.py to use the Executor Client instead of sending the message directly to rabbit via pika.  The sum of this
 is the atomic change that keeps existing structure and without breaking the code.</div>
<div>2) Remove the local engine. <a href="https://blueprints.launchpad.net/mistral/+spec/mistral-inproc-executor" target="_blank">
https://blueprints.launchpad.net/mistral/+spec/mistral-inproc-executor</a></div>
<div>3) Implement versioning for the engine.  <a href="https://blueprints.launchpad.net/mistral/+spec/mistral-engine-versioning" target="_blank">https://blueprints.launchpad.net/mistral/+spec/mistral-engine-versioning</a></div>
<div>4) Port abstract engine to use oslo.messaging and implement the engine client, engine server, and modify the API layer to consume the engine client.
<a href="https://blueprints.launchpad.net/mistral/+spec/mistral-engine-standalone-process" target="_blank">
https://blueprints.launchpad.net/mistral/+spec/mistral-engine-standalone-process</a>.</div>
<div><br>
</div>
<div>Winson</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>
<div class="h5">On Mon, Feb 24, 2014 at 8:07 PM, Renat Akhmerov <span dir="ltr"><<a href="mailto:rakhmerov@mirantis.com" target="_blank">rakhmerov@mirantis.com</a>></span> wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="h5">
<div style="word-wrap:break-word">
<div>
<div><br>
</div>
</div>
<div>
<div>
<div>On 25 Feb 2014, at 02:21, W Chan <<a href="mailto:m4d.coder@gmail.com" target="_blank">m4d.coder@gmail.com</a>> wrote:</div>
<br>
<blockquote type="cite">
<div dir="ltr">Renat,
<div><br>
</div>
<div>Regarding your comments on change <a href="https://review.openstack.org/#/c/75609/" target="_blank">https://review.openstack.org/#/c/75609/</a>, I don't think the port to oslo.messaging is just a swap from pika to oslo.messaging.  OpenStack services as
 I understand is usually implemented as an RPC client/server over a messaging transport.  Sync vs async calls are done via the RPC client call and cast respectively.  The messaging transport is abstracted and concrete implementation is done via drivers/plugins.
  So the architecture of the executor if ported to oslo.messaging needs to include a client, a server, and a transport.  The consumer (in this case the mistral engine) instantiates an instance of the client for the executor, makes the method call to handle
 task, the client then sends the request over the transport to the server.  The server picks up the request from the exchange and processes the request.  If cast (async), the client side returns immediately.  If call (sync), the client side waits for a response
 from the server over a reply_q (a unique queue for the session in the transport).  Also, oslo.messaging allows versioning in the message. Major version change indicates API contract changes.  Minor version indicates backend changes but with API compatibility.
  </div>
</div>
</blockquote>
<div><br>
</div>
</div>
<div>My main concern about this patch is not related with messaging infrastructure. I believe you know better than me how it should look like. I’m mostly concerned with the way of making changes you chose. From my perspective, it’s much better to make atomic
 changes where every changes doesn’t affect too much in existing architecture. So the first step could be to change pika to oslo.messaging with minimal structural changes without introducing versioning (could be just TODO comment saying that the framework allows
 it and we may want to use it in the future, to be decide), without getting rid of the current engine structure (local, scalable). Some of the things in the file structure and architecture came from the decisions made by many people and we need to be careful
 about changing them.</div>
<div>
<div><br>
</div>
<br>
<blockquote type="cite">
<div dir="ltr">
<div>So, where I'm headed with this change...  I'm implementing the basic structure/scaffolding for the new executor service using oslo.messaging (default transport with rabbit).  Since the whole change will take a few rounds, I don't want to disrupt any changes
 that the team is making at the moment and so I'm building the structure separately.  I'm also adding versioning (v1) in the module structure to anticipate any versioning changes in the future.   I expect the change request will lead to some discussion as we
 are doing here.  I will migrate the core operations of the executor (handle_task, handle_task_error, do_task_action) to the server component when we agree on the architecture and switch the consumer (engine) to use the new RPC client for the executor instead
 of sending the message to the queue over pika.  Also, the launcher for ./mistral/cmd/task_executor.py will change as well in subsequent round.  An example launcher is here <a href="https://github.com/uhobawuhot/interceptor/blob/master/bin/interceptor-engine" target="_blank">https://github.com/uhobawuhot/interceptor/blob/master/bin/interceptor-engine</a>.
  The interceptor project here is what I use to research how oslo.messaging works.  I hope this is clear. The blueprint only changes how the request and response are being transported.  It shouldn't change how the executor currently works.</div>
</div>
</blockquote>
<div><br>
</div>
</div>
<div>Please create a document describing the approach you’re pursuing here. I would expect to see the main goals you want to achieve upon completion.</div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div>Finally, can you clarify the difference between local vs scalable engine?  I personally do not prefer to explicitly name the engine scalable because this requirement should be in the engine by default and we do not need to explicitly state/separate that.
  But if this is a roadblock for the change, I can put the scalable structure back in the change to move this forward.</div>
</div>
</blockquote>
</div>
</div>
<br>
<div>Separation for local and scalable implementations appeared for historical reasons because from the beginning we didn’t see how it all would look like and hence we tried different approaches to implement the engine. At some point we got 2 working versions:
 the one that didn’t distribute anything (local) and another one that could distribute tasks over task executors via asynchronous HA transport (scalable). Later on we decided to leave them both since scalable is needed by the requirements and local might be
 useful for demonstration purposes and testing since it doesn’t require RabbitMQ to be installed. So we decided to refactor both and make them work similarly except the way they run tasks.</div>
<div><br>
</div>
<div>Thanks.</div>
<span><font color="#888888">
<div><br>
</div>
<div>Renat Akhmerov</div>
<div>@Mirantis Inc.</div>
</font></span></div>
<br>
</div>
</div>
<div class="">_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org" target="_blank">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>
</div>
</blockquote>
</div>
<br>
</div>
<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>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div><font>Best Regards,</font></div>
<div><font>Nikolay</font></div>
</div>
</div>
</div>
</div>
</blockquote>
</span>
</body>
</html>