mirror of https://github.com/MISP/MISP
chg: [workflows:modules] Renamed parallel tasks into concurrent tasks
parent
8909f8d793
commit
c8528a7c59
|
@ -51,14 +51,14 @@ class WorkflowShell extends AppShell {
|
|||
$for_path = $this->args[3];
|
||||
$jobId = $this->args[4];
|
||||
|
||||
$parallelErrors = [];
|
||||
$concurrentErrors = [];
|
||||
$walkResult = [];
|
||||
$executionSuccess = $this->Workflow->walkGraph(
|
||||
$workflow,
|
||||
$node_id_to_exec,
|
||||
$for_path,
|
||||
$roamingData,
|
||||
$parallelErrors,
|
||||
$concurrentErrors,
|
||||
$walkResult,
|
||||
);
|
||||
$job = $this->Job->read(null, $jobId);
|
||||
|
@ -66,9 +66,9 @@ class WorkflowShell extends AppShell {
|
|||
$job['Job']['status'] = Job::STATUS_COMPLETED;
|
||||
$job['Job']['date_modified'] = date("Y-m-d H:i:s");
|
||||
if ($executionSuccess) {
|
||||
$job['Job']['message'] = __('Workflow parallel task executed %s nodes starting from node %s.', count($walkResult['executed_nodes']), $node_id_to_exec);
|
||||
$job['Job']['message'] = __('Workflow concurrent task executed %s nodes starting from node %s.', count($walkResult['executed_nodes']), $node_id_to_exec);
|
||||
} else {
|
||||
$message = __('Error while executing workflow parallel task. %s', PHP_EOL . implode(', ', $parallelErrors));
|
||||
$message = __('Error while executing workflow concurrent task. %s', PHP_EOL . implode(', ', $concurrentErrors));
|
||||
$this->Workflow->logExecutionError($workflow, $message);
|
||||
$job['Job']['message'] = $message;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ class GraphWalker
|
|||
private function _getPathType($node_id, $path_type)
|
||||
{
|
||||
$node = $this->graph[$node_id];
|
||||
if ($node['data']['module_type'] == 'logic' && $node['data']['id'] == 'parallel-task') {
|
||||
if ($node['data']['module_type'] == 'logic' && $node['data']['id'] == 'concurrent-task') {
|
||||
return 'non-blocking';
|
||||
}
|
||||
return $path_type;
|
||||
|
@ -154,8 +154,8 @@ class GraphWalker
|
|||
if ($node['data']['id'] == 'if') {
|
||||
$useFirstOutput = $this->_evaluateIFCondition($node, $roamingData);
|
||||
return $useFirstOutput ? ['output_1' => $outputs['output_1']] : ['output_2' => $outputs['output_2']];
|
||||
} else if ($node['data']['id'] == 'parallel-task') {
|
||||
$this->_evaluateParallelTask($node, $roamingData, $outputs['output_1']);
|
||||
} else if ($node['data']['id'] == 'concurrent-task') {
|
||||
$this->_evaluateConcurrentTask($node, $roamingData, $outputs['output_1']);
|
||||
return ['output_1' => []];
|
||||
} else {
|
||||
$useFirstOutput = $this->_evaluateCustomLogicCondition($node, $roamingData);
|
||||
|
@ -176,14 +176,14 @@ class GraphWalker
|
|||
return $result;
|
||||
}
|
||||
|
||||
private function _evaluateParallelTask($parallel_node, WorkflowRoamingData $roamingData, array $connections)
|
||||
private function _evaluateConcurrentTask($concurrent_node, WorkflowRoamingData $roamingData, array $connections)
|
||||
{
|
||||
foreach ($connections['connections'] as $connection) {
|
||||
$node_id_to_exec = (int)$connection['node'];
|
||||
$data = $roamingData->getData();
|
||||
$data['__node_id_to_exec'] = $node_id_to_exec;
|
||||
$data = $roamingData->setData($data);
|
||||
$this->WorkflowModel->executeNode($parallel_node, $roamingData);
|
||||
$this->WorkflowModel->executeNode($concurrent_node, $roamingData);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
include_once APP . 'Model/WorkflowModules/WorkflowBaseModule.php';
|
||||
App::uses('BackgroundJobsTool', 'Tools');
|
||||
|
||||
class Module_parallel_task extends WorkflowBaseLogicModule
|
||||
class Module_concurrent_task extends WorkflowBaseLogicModule
|
||||
{
|
||||
public $id = 'parallel-task';
|
||||
public $name = 'Parallel Task';
|
||||
public $description = 'Allow breaking the execution process and running parallel tasks. You can connect multiple blocks the `parallel` output.';
|
||||
public $id = 'concurrent-task';
|
||||
public $name = 'Concurrent Task';
|
||||
public $description = 'Allow breaking the execution process and running concurrent tasks. You can connect multiple blocks the `concurrent` output.';
|
||||
public $icon = 'random';
|
||||
public $inputs = 1;
|
||||
public $outputs = 1;
|
||||
public $multiple_output_connection = true;
|
||||
public $html_template = 'parallel';
|
||||
public $html_template = 'concurrent';
|
||||
public $params = [];
|
||||
|
||||
private $Workflow;
|
|
@ -26,12 +26,12 @@
|
|||
<?php if (!empty($trigger['GroupedWorkflows']['non-blocking'])): ?>
|
||||
<ul class="unstyled">
|
||||
<li class="bold">
|
||||
<i class="fa-fw <?= $this->FontAwesome->getClass('random') ?>" title="<?= __('Parallel execution path') ?>"></i>
|
||||
<?= __('Parallel') ?>
|
||||
<i class="fa-fw <?= $this->FontAwesome->getClass('random') ?>" title="<?= __('Concurrent execution path') ?>"></i>
|
||||
<?= __('Concurrent') ?>
|
||||
</li>
|
||||
<?php foreach ($trigger['GroupedWorkflows']['non-blocking'] as $i => $workflow) : ?>
|
||||
<li>
|
||||
<i class="fa-fw <?= $this->FontAwesome->getClass('arrow-right') ?>" title="<?= __('Parallel execution path') ?>" style="margin-left: <?= 1 ?>em"></i>
|
||||
<i class="fa-fw <?= $this->FontAwesome->getClass('arrow-right') ?>" title="<?= __('Concurrent execution path') ?>" style="margin-left: <?= 1 ?>em"></i>
|
||||
<a
|
||||
href="<?= $baseurl . '/workflows/view/' . h($workflow['Workflow']['id']) ?>"
|
||||
title="<?= empty($workflow['Workflow']['enabled']) ? __('This workflow is disabled') : h($workflow['Workflow']['description']) ?>"
|
||||
|
|
|
@ -277,8 +277,8 @@ $data_passed_to_switch = [
|
|||
<li><?= __('The `publish` workflow is called (this workflow is a `blocking` workflow)') ?></li>
|
||||
<li><?= __('If a blocking module cancels the execution, the event will not be published') ?></li>
|
||||
</ol>
|
||||
<h3><?= __('Parallel Task') ?></h3>
|
||||
<p><?= __('Allowing breaking the execution flow into a parallel tasks to be executed later on by a background worker, thus preventing blocking module to cancel the ongoing operation.') ?></p>
|
||||
<h3><?= __('Concurrent Task') ?></h3>
|
||||
<p><?= __('Allowing breaking the execution flow into a concurrent tasks to be executed later on by a background worker, thus preventing blocking module to cancel the ongoing operation.') ?></p>
|
||||
</div>
|
||||
<div class="tab-pane" id="modal-info-usage">
|
||||
<h3><?= __('Shortcuts') ?></h3>
|
||||
|
|
|
@ -606,7 +606,7 @@
|
|||
content: "\f00d"
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output::before {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output::before {
|
||||
display: none;
|
||||
transform: translateX(calc(50% - 8px));
|
||||
right: 0;
|
||||
|
@ -616,11 +616,11 @@
|
|||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output:hover::before {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output:hover::before {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output::after {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output::after {
|
||||
font-family: 'Font Awesome 5 Free';
|
||||
font-weight: 900;
|
||||
position: absolute;
|
||||
|
@ -632,21 +632,21 @@
|
|||
transition-duration: .1s
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output:hover::after {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output:hover::after {
|
||||
font-size: larger;
|
||||
width: 18px;
|
||||
top: -1px;
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output_1 {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output_1 {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output_1::before {
|
||||
content: 'parallel tasks';
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output_1::before {
|
||||
content: 'Concurrent tasks';
|
||||
top: -26px;
|
||||
}
|
||||
|
||||
.drawflow .drawflow-node.block-type-parallel > .outputs > .output_1::after {
|
||||
.drawflow .drawflow-node.block-type-concurrent > .outputs > .output_1::after {
|
||||
content: "\f074";
|
||||
}
|
|
@ -85,7 +85,7 @@ var dotBlock_if = doT.template(' \
|
|||
</div> \
|
||||
</div>')
|
||||
|
||||
var dotBlock_parallel = doT.template(' \
|
||||
var dotBlock_concurrent = doT.template(' \
|
||||
<div class="canvas-workflow-block" data-nodeuid="{{=it.node_uid}}"> \
|
||||
<div style="width: 100%;"> \
|
||||
<div class="default-main-container"> \
|
||||
|
|
Loading…
Reference in New Issue