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
62426ce2
Commit
62426ce2
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Readapted Core driver to handle MCO bundles
parent
0c554e0a
No related branches found
No related tags found
1 merge request
!5
Introducing bundles
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
force_bdss/core_mco_driver.py
+17
-14
17 additions, 14 deletions
force_bdss/core_mco_driver.py
with
17 additions
and
14 deletions
force_bdss/core_mco_driver.py
+
17
−
14
View file @
62426ce2
...
@@ -3,9 +3,10 @@ from envisage.plugin import Plugin
...
@@ -3,9 +3,10 @@ from envisage.plugin import Plugin
from
traits.has_traits
import
on_trait_change
from
traits.has_traits
import
on_trait_change
from
traits.trait_types
import
List
from
traits.trait_types
import
List
from
force_bdss.data_sources.i_data_source
import
(
from
force_bdss.data_sources.i_data_source_bundle
import
(
IDataSource
)
IDataSourceBundle
)
from
force_bdss.mco.i_multi_criteria_optimizers
import
IMultiCriteriaOptimizer
from
force_bdss.mco.i_multi_criteria_optimizer_bundle
import
(
IMultiCriteriaOptimizerBundle
)
class
CoreMCODriver
(
Plugin
):
class
CoreMCODriver
(
Plugin
):
...
@@ -20,15 +21,15 @@ class CoreMCODriver(Plugin):
...
@@ -20,15 +21,15 @@ class CoreMCODriver(Plugin):
#: A List of the available Multi Criteria Optimizers.
#: A List of the available Multi Criteria Optimizers.
#: This will be populated by MCO plugins.
#: This will be populated by MCO plugins.
m
ulti_criteria_optimizer
s
=
ExtensionPoint
(
m
co_bundle
s
=
ExtensionPoint
(
List
(
IMultiCriteriaOptimizer
),
List
(
IMultiCriteriaOptimizer
Bundle
),
id
=
'
force
_
bdss.m
ulti_criteria_optimizer
s
'
)
id
=
'
force
.
bdss.m
co.bundle
s
'
)
#: A list of the available Key Performance Indicator calculators.
#: A list of the available Key Performance Indicator calculators.
#: It will be populated by plugins.
#: It will be populated by plugins.
data_sources
=
ExtensionPoint
(
data_source
_bundle
s
=
ExtensionPoint
(
List
(
IDataSource
),
List
(
IDataSource
Bundle
),
id
=
'
force
_
bdss.data_sources
'
)
id
=
'
force
.
bdss.data_sources
.bundles
'
)
@on_trait_change
(
"
application:started
"
)
@on_trait_change
(
"
application:started
"
)
def
application_started
(
self
):
def
application_started
(
self
):
...
@@ -42,13 +43,15 @@ class CoreMCODriver(Plugin):
...
@@ -42,13 +43,15 @@ class CoreMCODriver(Plugin):
raise
Exception
(
"
Requested data source {} but don
'
t know
"
raise
Exception
(
"
Requested data source {} but don
'
t know
"
"
to find it.
"
.
format
(
requested_ds
))
"
to find it.
"
.
format
(
requested_ds
))
else
:
else
:
mco_name
=
workflow
.
multi_criteria_optimization
.
name
mco_data
=
workflow
.
multi_criteria_optimizer
mco
=
self
.
_find_mco_by_name
(
mco_name
)
mco_bundle
=
self
.
_find_mco_bundle_by_name
(
mco_data
.
name
)
if
mco
:
if
mco_bundle
:
mco
.
run
(
self
.
application
)
mco_model
=
mco_bundle
.
create_model
(
mco_data
.
model_data
)
mco
=
mco_bundle
.
create_optimizer
(
self
,
mco_model
)
mco
.
run
()
else
:
else
:
raise
Exception
(
"
Requested MCO {} but it
'
s not available
"
raise
Exception
(
"
Requested MCO {} but it
'
s not available
"
"
to compute it.
"
.
format
(
mco_name
))
"
to compute it.
"
.
format
(
mco_
data
.
name
))
def
_find_data_source_by_computes
(
self
,
computes
):
def
_find_data_source_by_computes
(
self
,
computes
):
for
ds
in
self
.
data_sources
:
for
ds
in
self
.
data_sources
:
...
...
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