MetaWorkflow - Invoke WFA Workflows within a WFA 2.2 workflow

by Frequent Contributor on ‎2014-02-10 10:28 PM - edited on ‎2014-09-25 04:20 PM by allison Former NetApp Employee

While we're waiting for the ability to do nested workflows, here are a couple of (powershell based) commands to invoke WFA workflows via REST from a WFA 2.2RC1+ command (WFA 2.2 is required since this leverages the new workflow parameter feature). This allows nesting of workflows, parallel execution of sub-workflows, etc.

 

There are 2 commands:

  1. Invoke WFA Workflow.
    Arguments:
    • UUID: Workflow UUID (obtain from http://<WFA_IP>/rest/workflows/)
    • FriendlyName: Friendly Name of the workflow
    • Comment: Comment to place into job
    • Variable: Workflow property name (or 'prefix#') to place job identifier into. A trailing # will be replaced with a number to allow multiple jobs to be run
    • Credential: WFA Credential or Username/password to use (defaults to WFA-loopback cached credential)
    • Arg0-Arg29: Sub-Workflow argument names
    • Value0-Value29: Sub-Workflow argument values
  2. Wait for WFA Workflow
    Arguments:
    • Variable: Workflow property name (or 'prefix#') containing jobID
    • MaxJobs: Wait until less than this number of jobs are running
    • AbortOnJobFailure: Fail the command if any sub-workflows fail
    • Credential: WFA Credential or Username/password to use (defaults to WFA-loopback cached credentials)

 

To avoid WFA credentials being visible in the WFA logs, add an "OTHER" credential for "WFA-loopback" with the username/password of a WFA user.

 

Update: April 17, 2014:

  • Increased number of sub-workflow arguments to 30

 

Update: September 24, 2014

  • Allow use of workflow name in the UUID parameter

 

- Tim

Comments
Frequent Contributor

Great stuff Tim!  Thanks for sharing!!!

Frequent Contributor

This sounds like it could be perfect for a use-case I'm considering. As a learning exercise I tried to use 'Invoke WFA Workflow' to invoke an existing workflow. I basically hardcoded the 6 or 7 UserInput parameters of the workflow I'm invoking, setup a WFA-loopback credential and then run my test workflow (attached: SWA9810). About 7 seconds after it says it is invoking the workflow it returns the error "[Invoke WFA Workflow] Request failed: Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request.". I'm probably missing something basic but no ideas on this end. Any ideas?

17:56:33.557 INFO  [Invoke WFA Workflow] ### Command 'Invoke WFA Workflow' ###

17:56:34.664 INFO  [Invoke WFA Workflow] Executing command: ./Invoke_WFA_Workflow2236814184547863972.ps1 -Arg0 'TicketNumber' -Arg1 'arrayOrVfiler' -Arg2 'BackupFlag' -Arg3 'controllerName' -Arg4 'vfilerName' -Arg5 'aggrName' -Arg6 'volumeName' -Arg7 'volumeSize' -Comment 'This is amazing!' -Credential 'WFA-loopback' -FriendlyName 'SWA110 Create New Volume' -UUID '4e0d1c36-0622-46a3-8f97-a8f7cf810ba8' -Value0 'SR1234567' -Value1 'Filer Management' -Value2 'true' -Value3 'hq-stor-7m-1.acme.com' -Value5 'hq_fcal01' -Value6 'SWA9810_volume' -Value7 '1024' -Variable 'jobID'

17:56:34.758 INFO  [Invoke WFA Workflow] Arguments: <userInputEntry key="TicketNumber" value="SR1234567"/>

<userInputEntry key="arrayOrVfiler" value="Filer Management"/>

<userInputEntry key="BackupFlag" value="true"/>

<userInputEntry key="controllerName" value="hq-stor-7m-1.acme.com"/>

<userInputEntry key="vfilerName" value=""/>

<userInputEntry key="aggrName" value="hq_fcal01"/>

<userInputEntry key="volumeName" value="SWA9810_volume"/>

<userInputEntry key="volumeSize" value="1024"/>

17:56:37.129 INFO  [Invoke WFA Workflow] Credentials successfully provided for 'WFA-loopback'

17:56:37.207 INFO  [Invoke WFA Workflow] Invoking URL: http://localhost:80/rest/workflows/4e0d1c36-0622-46a3-8f97-a8f7cf810ba8/jobs with user admin

17:56:44.461 ERROR  [Invoke WFA Workflow] Request failed: Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request."

17:56:45.397 ERROR  [Invoke WFA Workflow] Command failed for Workflow 'SWA9810 Create Volume using SWA110' with error : Request failed: Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (400) Bad Request."

17:56:45.412 INFO  [Invoke WFA Workflow] ***** Workflow Execution Failed *****

Frequent Contributor

Hi David,

WFA is pretty fussy about the parameters. I would double check that you have all required parameters with correct case. Also check the WFA log to see if that provides any hints as to what is going on (although logging is generally rather cryptic on the server side).

Regards,

Tim

Frequent Contributor

Found it. One of the UserInputs I passed didn't meet the regex expression for it. That was buried in server.log of the 'calling' workflow.

2014-07-15 17:56:37,410 ERROR [com.netapp.wfa.engine.exec.TabularWorkflowExecutionPlannerImpl] (http-executor-threads - 34) InvalidInputException: The value SWA9810_volume for input $volumeName  must match the regular expression ^(prd|sat|dev|lab)_[a-zA-Z0-9_]{1,32}$ for 'SWA110 Create New Volume'

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.