Running multiple instances of a Workflow

May 10, 2011 at 4:47 PM

How can I start multiple instances of my workflow ?

By using the Workflow Composer I'm not able to run mulitple instance once I've started one.

Is there a way of starting a workflow from the command line ?

My need is to run several hundreds of instances simultaneously.

Thank you,

Xavier

May 11, 2011 at 12:17 PM

Hi,

Thank you for showing interest in Trident.

You can run, schedule, and manage running jobs from Trident Management studio. You can run as many instances of a workflow as required, either on the same machine or on different nodes. It is only limited by the computer resources and the resources the workflow instances are using. In the case of limiting resources, the workflow will be in pending status in a queue waiting for other instances to free up the resources.

Refer the Trident Management Studio Guide for further details.

Please let us know if you have any further query/concern.

Regards,
Support Team

May 11, 2011 at 12:38 PM

Thank you this is useful info.

Is there a way to start a workflow instance from the command line instead of from the GUI ?

Thank, you,

Xavier

May 11, 2011 at 2:42 PM
Edited May 11, 2011 at 2:43 PM

Hi,

Yes, you can start a workflow instance from the command line.

This is done using the LightweightExecutor project that comes with the Trident solution.

LightweightExecutor is a console application that accepts the Id of the workflow to be executed and an optional input of the path to the file where the workflow inputs are specified.

This model is not very flexible and gives limited control over the execution/scheduling of a new job and management of running jobs.
Follow the steps given below to achieve the same.

1)      Download and build the Trident solution. Refer Developer On-boarding Guide in case you are finding any issue in setting up the development environment.

2)      Move the command line window where the LightweightExecutor.exe is placed. By default, it is placed under …\tridentworkflow-63690\Trident\Product\Debug\Executor folder.

3)      Now, you can run a workflow using the following command LightweightExecutor –wf (workflowid)

For further details about the command format and input file format please refer the LightweightExecutor document.

Please let us know if this helps you in resolving your query.

Regards,
Support Team

May 11, 2011 at 3:20 PM

Ok, this is interesting.
Using the Registry Manager I can see this ID, but I can't copy it, which is in this case useless.

So how can I retrieve and copy this id ?

Thanks,

Xavier

May 11, 2011 at 3:33 PM

Hi,

The esay and better way to retrieve id and other required information is the Trident Management studio. The LightweightExecutor document contains all these information.

Regards,
Support Team.

May 12, 2011 at 1:59 AM
Edited May 12, 2011 at 2:01 AM

Hi Xavier,

My team and I have nested workflows for batch executions (using the lightweight executor), and need something similar. The following code may be useful to you (assuming you program in C# or similar .NET language) to produce a e.g. command-line tool to retrieve the current workflow GUID for a workflow identified by name.

Cheers, J-M

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Workflow.ComponentModel;
using ManagementStudioServices;
using ManagementStudioServices.Interfaces;
using Microsoft.Research.DataLayer;
using Microsoft.Research.ScientificWorkflow;
using Microsoft.Research.ScientificWorkflow.TridentModel;

namespace SempleCodeNamespace
{
    class DemoGetUID
    {
        public string FindWorkflowGuid(string workflowExactName)
        {
            Connection connection = createConnection();
            IWorkflowManagerService wfMgrService = new WorkflowManagerService(connection);
            TridentWorkflowModel wfModel = getUniqueWorkflowByName(workflowExactName, wfMgrService);
            return wfModel.Id.ToString();
        }

        private Connection createConnection()
        {
            SR_Connection.Init();
            ConnectionManager connMgr = ConnectionManager.Create(ConnectionManagerBase.CancelBehavior.ThrowException);
            connMgr.UIStyle = ConnectionManagerBase.UIStyleType.Normal;
            return connMgr.PickConnection(ConnectionManagerBase.ConnectionUI.PromptIfNeeded);
        }

        private TridentWorkflowModel getUniqueWorkflowByName(string workflowExactName, IWorkflowManagerService wfMgrService)
        {
            var wfc = wfMgrService.GetAvailableWorkflows(Microsoft.Research.DataLayer.Activity.ISearch.Name(Microsoft.Research.DataLayer.StringField.Condition.Equals, workflowExactName));
            // var wfc = this.wfMgrService.GetAvailableWorkflows( Microsoft.Research.DataLayer.Activity.ISearch.Name( Microsoft.Research.DataLayer.StringField.Condition.Equals, this.WorkflowExactName ) );
            if (wfc.Count == 0)
                throw new ArgumentException("No exact match found for workflow name");
            return new TridentWorkflowModel(wfc[0], new ModelFactory(null, null));
        }

    }
}

May 12, 2011 at 10:13 AM

Thank you JM, I will try that.

Xavier