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
9e5426d1
Commit
9e5426d1
authored
7 years ago
by
martinRenou
Browse files
Options
Downloads
Patches
Plain Diff
Add probe mco classes
parent
cce1ab66
No related branches found
No related tags found
1 merge request
!101
Create probe classes for tests
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
force_bdss/tests/probe_classes/factory_registry_plugin.py
+4
-0
4 additions, 0 deletions
force_bdss/tests/probe_classes/factory_registry_plugin.py
force_bdss/tests/probe_classes/mco.py
+70
-0
70 additions, 0 deletions
force_bdss/tests/probe_classes/mco.py
with
74 additions
and
0 deletions
force_bdss/tests/probe_classes/factory_registry_plugin.py
+
4
−
0
View file @
9e5426d1
...
@@ -2,6 +2,7 @@ from traits.api import List
...
@@ -2,6 +2,7 @@ from traits.api import List
from
force_bdss.factory_registry_plugin
import
FactoryRegistryPlugin
from
force_bdss.factory_registry_plugin
import
FactoryRegistryPlugin
from
.mco
import
ProbeMCOFactory
from
.kpi_calculator
import
ProbeKPICalculatorFactory
from
.kpi_calculator
import
ProbeKPICalculatorFactory
from
.data_source
import
ProbeDataSourceFactory
from
.data_source
import
ProbeDataSourceFactory
...
@@ -12,6 +13,9 @@ class ProbeFactoryRegistryPlugin(FactoryRegistryPlugin):
...
@@ -12,6 +13,9 @@ class ProbeFactoryRegistryPlugin(FactoryRegistryPlugin):
data_source_factories
=
List
()
data_source_factories
=
List
()
notification_listener_factories
=
List
()
notification_listener_factories
=
List
()
def
_mco_factories_default
(
self
):
return
[
ProbeMCOFactory
(
self
)]
def
_kpi_calculator_factories_default
(
self
):
def
_kpi_calculator_factories_default
(
self
):
return
[
ProbeKPICalculatorFactory
(
self
)]
return
[
ProbeKPICalculatorFactory
(
self
)]
...
...
This diff is collapsed.
Click to expand it.
force_bdss/tests/probe_classes/mco.py
0 → 100644
+
70
−
0
View file @
9e5426d1
from
traits.api
import
Str
,
Type
,
Bool
,
Int
from
force_bdss.core.data_value
import
DataValue
from
force_bdss.api
import
(
BaseMCOModel
,
BaseMCO
,
BaseMCOFactory
,
BaseMCOParameter
,
BaseMCOParameterFactory
,
BaseMCOCommunicator
)
class
ProbeMCOModel
(
BaseMCOModel
):
pass
class
ProbeMCO
(
BaseMCO
):
run_called
=
Bool
(
False
)
def
run
(
self
,
model
):
self
.
run_called
=
True
class
ProbeParameter
(
BaseMCOParameter
):
pass
class
RangedParameterFactory
(
BaseMCOParameterFactory
):
id
=
Str
(
"
enthought.test.mco_parameter
"
)
model_class
=
Type
(
ProbeParameter
)
class
ProbeMCOCommunicator
(
BaseMCOCommunicator
):
send_called
=
Bool
(
False
)
receive_called
=
Bool
(
False
)
nb_output_data_values
=
Int
(
0
)
def
send_to_mco
(
self
,
model
,
kpi_results
):
self
.
send_called
=
True
def
receive_from_mco
(
self
,
model
):
self
.
receive_called
=
True
return
[
DataValue
()
for
_
in
range
(
self
.
nb_output_data_values
)
]
class
ProbeMCOFactory
(
BaseMCOFactory
):
id
=
Str
(
"
enthought.test.mco
"
)
model_class
=
Type
(
ProbeMCOModel
)
communicator_class
=
Type
(
ProbeMCOCommunicator
)
mco_class
=
Type
(
ProbeMCO
)
def
create_model
(
self
,
model_data
=
None
):
return
self
.
model_class
(
self
,
**
model_data
)
def
create_communicator
(
self
):
return
self
.
communicator_class
(
self
)
def
create_optimizer
(
self
):
return
self
.
mco_class
(
self
)
def
parameter_factories
(
self
):
return
[]
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