Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
force-bdss
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adham Hashibon
force-bdss
Commits
cfb39de8
Commit
cfb39de8
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Added notification listeners to workflow, and associated IO
parent
1894de29
No related branches found
No related tags found
1 merge request
!79
Deliver notification info
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
force_bdss/core/workflow.py
+5
-0
5 additions, 0 deletions
force_bdss/core/workflow.py
force_bdss/io/workflow_reader.py
+13
-0
13 additions, 0 deletions
force_bdss/io/workflow_reader.py
force_bdss/io/workflow_writer.py
+6
-4
6 additions, 4 deletions
force_bdss/io/workflow_writer.py
with
24 additions
and
4 deletions
force_bdss/core/workflow.py
+
5
−
0
View file @
cfb39de8
...
@@ -3,6 +3,8 @@ from traits.api import HasStrictTraits, Instance, List
...
@@ -3,6 +3,8 @@ from traits.api import HasStrictTraits, Instance, List
from
force_bdss.data_sources.base_data_source_model
import
BaseDataSourceModel
from
force_bdss.data_sources.base_data_source_model
import
BaseDataSourceModel
from
force_bdss.kpi.base_kpi_calculator_model
import
BaseKPICalculatorModel
from
force_bdss.kpi.base_kpi_calculator_model
import
BaseKPICalculatorModel
from
force_bdss.mco.base_mco_model
import
BaseMCOModel
from
force_bdss.mco.base_mco_model
import
BaseMCOModel
from
force_bdss.notification_listeners.base_notification_listener_model
\
import
BaseNotificationListenerModel
class
Workflow
(
HasStrictTraits
):
class
Workflow
(
HasStrictTraits
):
...
@@ -18,3 +20,6 @@ class Workflow(HasStrictTraits):
...
@@ -18,3 +20,6 @@ class Workflow(HasStrictTraits):
#: Contains the factory-specific KPI Calculator Model objects.
#: Contains the factory-specific KPI Calculator Model objects.
#: The list can be empty
#: The list can be empty
kpi_calculators
=
List
(
BaseKPICalculatorModel
)
kpi_calculators
=
List
(
BaseKPICalculatorModel
)
#: Contains information about the listeners to be setup
notification_listeners
=
List
(
BaseNotificationListenerModel
)
This diff is collapsed.
Click to expand it.
force_bdss/io/workflow_reader.py
+
13
−
0
View file @
cfb39de8
...
@@ -89,6 +89,7 @@ class WorkflowReader(HasStrictTraits):
...
@@ -89,6 +89,7 @@ class WorkflowReader(HasStrictTraits):
wf
.
mco
=
self
.
_extract_mco
(
wf_data
)
wf
.
mco
=
self
.
_extract_mco
(
wf_data
)
wf
.
data_sources
[:]
=
self
.
_extract_data_sources
(
wf_data
)
wf
.
data_sources
[:]
=
self
.
_extract_data_sources
(
wf_data
)
wf
.
kpi_calculators
[:]
=
self
.
_extract_kpi_calculators
(
wf_data
)
wf
.
kpi_calculators
[:]
=
self
.
_extract_kpi_calculators
(
wf_data
)
wf
.
notification_listeners
[:]
=
self
.
_extract_listeners
(
wf_data
)
except
KeyError
as
e
:
except
KeyError
as
e
:
logging
.
exception
(
"
Could not read file
"
)
logging
.
exception
(
"
Could not read file
"
)
raise
InvalidFileException
(
"
Could not read file.
"
raise
InvalidFileException
(
"
Could not read file.
"
...
@@ -211,3 +212,15 @@ class WorkflowReader(HasStrictTraits):
...
@@ -211,3 +212,15 @@ class WorkflowReader(HasStrictTraits):
def
_extract_input_slot_maps
(
self
,
maps_data
):
def
_extract_input_slot_maps
(
self
,
maps_data
):
return
[
InputSlotMap
(
**
d
)
for
d
in
maps_data
]
return
[
InputSlotMap
(
**
d
)
for
d
in
maps_data
]
def
_extract_notification_listeners
(
self
,
wf_data
):
registry
=
self
.
factory_registry
listeners
=
[]
for
nl_entry
in
wf_data
[
"
notification_listeners
"
]:
nl_id
=
nl_entry
[
"
id
"
]
nl_factory
=
registry
.
notification_listener_factory_by_id
(
nl_id
)
model_data
=
nl_entry
[
"
model_data
"
]
listeners
.
append
(
nl_factory
.
create_model
(
model_data
))
return
listeners
This diff is collapsed.
Click to expand it.
force_bdss/io/workflow_writer.py
+
6
−
4
View file @
cfb39de8
...
@@ -17,9 +17,7 @@ class WorkflowWriter(HasStrictTraits):
...
@@ -17,9 +17,7 @@ class WorkflowWriter(HasStrictTraits):
A file object on which to write the workflow, properly serialized
A file object on which to write the workflow, properly serialized
into JSON.
into JSON.
"""
"""
data
=
{
data
=
dict
(
version
=
1
)
"
version
"
:
"
1
"
,
}
data
[
"
workflow
"
]
=
self
.
_workflow_data
(
workflow
)
data
[
"
workflow
"
]
=
self
.
_workflow_data
(
workflow
)
json
.
dump
(
data
,
f
)
json
.
dump
(
data
,
f
)
...
@@ -32,7 +30,11 @@ class WorkflowWriter(HasStrictTraits):
...
@@ -32,7 +30,11 @@ class WorkflowWriter(HasStrictTraits):
for
kpic
in
workflow
.
kpi_calculators
],
for
kpic
in
workflow
.
kpi_calculators
],
"
data_sources
"
:
[
"
data_sources
"
:
[
self
.
_model_data
(
ds
)
self
.
_model_data
(
ds
)
for
ds
in
workflow
.
data_sources
]
for
ds
in
workflow
.
data_sources
],
"
notification_listeners
"
:
[
self
.
_model_data
(
nl
)
for
nl
in
workflow
.
notification_listeners
]
}
}
return
workflow_data
return
workflow_data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment