Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
representation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
workflow
representation
Commits
b34b5b22
Commit
b34b5b22
authored
Sep 24, 2019
by
Olof Svensson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Node] add ErrorHandler
parent
1ba331cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
scheme/link.py
scheme/link.py
+2
-2
scheme/node.py
scheme/node.py
+23
-1
scheme/scheme.py
scheme/scheme.py
+1
-1
No files found.
scheme/link.py
View file @
b34b5b22
...
...
@@ -61,8 +61,8 @@ class Link(object):
_JSON_SINK_NODE_ID
=
'sink_node_id'
_JSON_LINK_ID
=
'link_id'
def
__init__
(
self
,
source_node
,
sink_node
,
source_channel
,
sink_channel
,
id
=
None
):
def
__init__
(
self
,
source_node
,
sink_node
,
source_channel
=
'default'
,
sink_channel
=
'default'
,
id
=
None
):
self
.
id
=
get_next_link_free_id
()
if
id
is
None
else
id
if
isinstance
(
source_node
,
int
):
self
.
source_node_id
=
source_node
...
...
scheme/node.py
View file @
b34b5b22
...
...
@@ -86,6 +86,7 @@ class Node(object):
_JSON_PROCESS_PT
=
'process_pt'
_JSON_ID
=
'id'
_JSON_PROPERTIES
=
'properties'
_JSON_ERROR_HANDLER
=
'error_handler'
def
__init__
(
self
,
processing_pt
,
id
=
None
,
properties
=
None
,
error_handler
=
None
):
...
...
@@ -209,11 +210,19 @@ class Node(object):
:return: json description of the node
:rtype: dict
"""
re
turn
{
re
s
=
{
self
.
_JSON_PROCESS_PT
:
self
.
process_pt
,
self
.
_JSON_ID
:
self
.
id
,
self
.
_JSON_PROPERTIES
:
self
.
properties
,
}
res
.
update
(
self
.
_get_error_handler_json
())
return
res
def
_get_error_handler_json
(
self
):
error_handler_json
=
self
.
_error_handler
.
to_json
()
if
self
.
_error_handler
else
{}
return
{
self
.
_JSON_ERROR_HANDLER
:
error_handler_json
,
}
@
staticmethod
def
from_json
(
json_data
):
...
...
@@ -264,3 +273,16 @@ class WorkflowException(Exception):
self
.
errorMessage
=
msg
self
.
data
=
data
self
.
traceBack
=
traceBack
class
ErrorHandler
(
Node
):
'''
TODO
'''
def
__init__
(
self
,
processing_pt
,
id
=
None
,
properties
=
None
):
super
(
ErrorHandler
,
self
).
__init__
(
processing_pt
=
processing_pt
,
id
=
id
,
properties
=
properties
,
error_handler
=
None
)
def
_get_error_handler_json
(
self
):
return
{}
\ No newline at end of file
scheme/scheme.py
View file @
b34b5b22
...
...
@@ -123,7 +123,7 @@ class Scheme(object):
:param output_file: name of the output file.
:type: str
"""
if
output_file
.
lower
.
endswith
(
'.json'
):
if
output_file
.
lower
()
.
endswith
(
'.json'
):
self
.
save_as_json
(
output_file
)
else
:
self
.
save_as_xml
(
output_file
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment