You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/05 13:46:08 UTC

[GitHub] tardieu commented on a change in pull request #3202: Support action continuations in the controller

tardieu commented on a change in pull request #3202: Support action continuations in the controller
URL: https://github.com/apache/incubator-openwhisk/pull/3202#discussion_r165975020
 
 

 ##########
 File path: core/controller/src/main/scala/whisk/core/controller/actions/PrimitiveActions.scala
 ##########
 @@ -65,18 +76,67 @@ protected[actions] trait PrimitiveActions {
   /** Database service to get activations. */
   protected val activationStore: ActivationStore
 
+  /** A method that knows how to invoke a sequence of actions. */
+  protected[actions] def invokeSequence(
+    user: Identity,
+    action: WhiskActionMetaData,
+    components: Vector[FullyQualifiedEntityName],
+    payload: Option[JsObject],
+    waitForOutermostResponse: Option[FiniteDuration],
+    cause: Option[ActivationId],
+    topmost: Boolean,
+    atomicActionsCount: Int)(implicit transid: TransactionId): Future[(Either[ActivationId, WhiskActivation], Int)]
+
   /**
+   * A method that knows how to invoke a single primitive action or a composition.
+   *
+   * A composition is a kind of sequence of actions that is dynamically computed.
+   * The execution of a composition is triggered by the invocation of a conductor action.
+   * A conductor action is an executable action with a defined "conductor" annotation (the value does not matter).
+   * Sequences cannot be compositions: the "conductor" annotation on a sequence has no effect.
+   *
+   * A conductor action may either return a final result or a triplet { action, params, state }.
+   * In the latter case, the specified component action is invoked on the specified params object.
+   * Upon completion of this action the conductor action is reinvoked with a payload that combines
+   * the output of the action with the state returned by the previous conductor invocation.
+   * The composition result is the result of the final conductor invocation in the chain of invocations.
+   *
+   * The trace of a composition obeys the grammar: conductorInvocation(componentInvocation conductorInvocation)*
+   *
+   * The activation records for a composition and its components mimic the activation records of sequences.
+   * They include the same "topmost", "kind", and "causedBy" annotations with the same semantics.
+   * The activation record for a composition also includes a specific annotation "conductor" with value true.
+   */
+  protected[actions] def invokeSingleAction(
+    user: Identity,
+    action: ExecutableWhiskActionMetaData,
+    payload: Option[JsObject],
+    waitForResponse: Option[FiniteDuration],
+    cause: Option[ActivationId])(implicit transid: TransactionId): Future[Either[ActivationId, WhiskActivation]] = {
+
+    if (action.annotations.get(WhiskActivation.conductorAnnotation).isDefined) {
 
 Review comment:
   In practice, I use the `conductor` annotation to annotate the action with the json object encoding the composition, so it is not a Boolean value. I could check that the annotation value is thruthy (not null, zero, '', or undefined).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services