We have some workflow controls on a node form that would need to get updated once a user executes an interactive task. After digging through the MaestroEngine and MaestroEngineVersion1 code, the best way to get process, user and node-related data out of an executed interactive task seems to be the introduction of a new hook in MaestroEngineVersion1.

I propose to call the new hook hook_maestro_post_interactive_task. It should take in as parameters both the Maestro engine and the task that has just been executed. It would get fired in the cleanQueue() method, within the if statement that checks for completed interactive tasks, just before nextStep() is called.

Patch to follow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larskleiner’s picture

Attached the proposed hook.

_randy’s picture

This patch adds an execute of the task for interactive tasks. This is not something the engine currently does.

Can't add this patch until we understand why we would add this to the interactive tasks

if ($queueRecord->status > 0 AND $queueRecord->is_interactive == MaestroInteractiveFlag::IS_INTERACTIVE AND $queueRecord->archived == 0) {
+	    $task = $this->executeTask(new $queueRecord->task_class_name($queueRecord));
_randy’s picture

I think its better to have a post completion hook in the completeTask method where we can send off the task information and a flag denoting whether or not the task is interactive. Patch to follow.

 //post task completion hook
    module_invoke_all('maestro_post_task_completion', $this, $task, $is_interactive);
larskleiner’s picture

We needed the executeTask() to get the interactive task but I'm not sure about the side effects.

It might be better as you suggest to add a similar hook to completeTask(). We can easily load all the task information we need from $qid then.

_randy’s picture

Status: Active » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.