Help with Workflow implementation

#1

I’m trying to create a Workflow that starts with a WorkflowMapReduceStep and am running into some issues.

When I run

var wf = Workflow.get('OrderWorkflow');
wf.start();

i see a WorkflowRun and a WorkflowMapReduceStepRun are created, but the WorkflowMapReduceStepRun status seems to be stuck in “initial” and never actually starts the MapReduce job nor creates any new entries in the MapReduce queue. I am able to start and run the same MapReduce job from console separately, so it doesn’t appear to be an issue with the job.

My Workflow and WorkflowMapReduceStep seed data look something like this:

/* Workflow */
{
  "id": "OrderWorkflow",
  "name": "OrderWorkflow",
  "startStep": "ProcessOrders"
}

/* WorkflowMapReduceStep */
{
  "id": "ProcessOrders",
  "name": "ProcessOrders",
  "nextStep": {
    "id": "SomeActionStep"
  },
  "workflow": {
    "id": "OrderWorkflow"
  },
  "mapReduceJob": {
    "type": "ProcessOrders",
    "id": "workflow_run"
  }
}

ProcessOrders is a type that mixes MapReduce and the id workflow_run is in seed data.

Am I missing something?

0 Likes

#2

Check if one of the CronJob trigger-WorkflowCoordinatorJob or cron-for-workflow-process-10s is active in your tag.

If not, update one to be active, e.g. by running

CronJob.merge({id:“cron-for-workflow-process-10s”, inactive: false});

or just test your workflow by manually run:

WorkflowCoordinator.process()

in your console.

1 Like