|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class RunWorkflow(WorkflowBlock): |
7 | | - |
8 | 7 | @classmethod |
9 | 8 | def register(cls, type: str): |
10 | 9 | super(RunWorkflow, cls).register(type) |
11 | | - register_abstract_template(type, AbstractTemplate( |
12 | | - baseType="workflows_node", |
13 | | - writer={ |
14 | | - "name": "Run workflow", |
15 | | - "description": "Executes a workflow with a given key.", |
16 | | - "category": "Logic", |
17 | | - "fields": { |
18 | | - "workflowKey": { |
19 | | - "name": "Workflow Key", |
20 | | - "type": "Workflow Key", |
21 | | - "validator": { |
22 | | - "type": "string", |
23 | | - "format": "writer#workflowKey", |
24 | | - } |
25 | | - }, |
26 | | - "payload": { |
27 | | - "name": "Payload", |
28 | | - "desc": "The value specified will be available using the template syntax i.e. @{payload}", |
29 | | - "default": "{}", |
30 | | - "type": "Text", |
31 | | - "control": "Textarea" |
32 | | - }, |
33 | | - }, |
34 | | - "outs": { |
35 | | - "success": { |
36 | | - "name": "Success", |
37 | | - "description": "The request was successful.", |
38 | | - "style": "success", |
| 10 | + register_abstract_template( |
| 11 | + type, |
| 12 | + AbstractTemplate( |
| 13 | + baseType="workflows_node", |
| 14 | + writer={ |
| 15 | + "name": "Run blueprint", |
| 16 | + "description": "Executes a workflow with a given key.", |
| 17 | + "category": "Logic", |
| 18 | + "fields": { |
| 19 | + "workflowKey": { |
| 20 | + "name": "Workflow Key", |
| 21 | + "type": "Workflow Key", |
| 22 | + "validator": { |
| 23 | + "type": "string", |
| 24 | + "format": "writer#workflowKey", |
| 25 | + }, |
| 26 | + }, |
| 27 | + "payload": { |
| 28 | + "name": "Payload", |
| 29 | + "desc": "The value specified will be available using the template syntax i.e. @{payload}", |
| 30 | + "default": "{}", |
| 31 | + "type": "Text", |
| 32 | + "control": "Textarea", |
| 33 | + }, |
39 | 34 | }, |
40 | | - "error": { |
41 | | - "name": "Error", |
42 | | - "description": "The workflow was executed successfully.", |
43 | | - "style": "error", |
| 35 | + "outs": { |
| 36 | + "success": { |
| 37 | + "name": "Success", |
| 38 | + "description": "The request was successful.", |
| 39 | + "style": "success", |
| 40 | + }, |
| 41 | + "error": { |
| 42 | + "name": "Error", |
| 43 | + "description": "The workflow was executed successfully.", |
| 44 | + "style": "error", |
| 45 | + }, |
44 | 46 | }, |
45 | 47 | }, |
46 | | - } |
47 | | - )) |
| 48 | + ), |
| 49 | + ) |
48 | 50 |
|
49 | 51 | def run(self): |
50 | 52 | try: |
51 | 53 | workflow_key = self._get_field("workflowKey") |
52 | 54 | payload = self._get_field("payload") |
53 | | - expanded_execution_environment = self.execution_environment | { "payload": payload } |
54 | | - return_value = self.runner.run_workflow_by_key(workflow_key, expanded_execution_environment) |
| 55 | + expanded_execution_environment = self.execution_environment | {"payload": payload} |
| 56 | + return_value = self.runner.run_workflow_by_key( |
| 57 | + workflow_key, expanded_execution_environment |
| 58 | + ) |
55 | 59 | self.result = return_value |
56 | 60 | self.outcome = "success" |
57 | 61 | except BaseException as e: |
|
0 commit comments