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
28a92855
Unverified
Commit
28a92855
authored
6 years ago
by
Stefano Borini
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #111 from force-h2020/add-more-logging
Added more logging
parents
ffd6d256
79de86ab
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
force_bdss/cli/force_bdss.py
+2
-0
2 additions, 0 deletions
force_bdss/cli/force_bdss.py
force_bdss/cli/tests/test_execution.py
+6
-3
6 additions, 3 deletions
force_bdss/cli/tests/test_execution.py
force_bdss/core_evaluation_driver.py
+13
-1
13 additions, 1 deletion
force_bdss/core_evaluation_driver.py
with
21 additions
and
4 deletions
force_bdss/cli/force_bdss.py
+
2
−
0
View file @
28a92855
...
@@ -19,6 +19,8 @@ push_exception_handler(reraise_exceptions=True)
...
@@ -19,6 +19,8 @@ push_exception_handler(reraise_exceptions=True)
def
run
(
evaluate
,
logfile
,
workflow_filepath
):
def
run
(
evaluate
,
logfile
,
workflow_filepath
):
logging_config
=
{}
logging_config
=
{}
logging_config
[
"
level
"
]
=
logging
.
INFO
if
logfile
is
not
None
:
if
logfile
is
not
None
:
logging_config
[
"
filename
"
]
=
logfile
logging_config
[
"
filename
"
]
=
logfile
...
...
This diff is collapsed.
Click to expand it.
force_bdss/cli/tests/test_execution.py
+
6
−
3
View file @
28a92855
...
@@ -26,16 +26,19 @@ class TestExecution(unittest.TestCase):
...
@@ -26,16 +26,19 @@ class TestExecution(unittest.TestCase):
def
test_plain_invocation_mco
(
self
):
def
test_plain_invocation_mco
(
self
):
with
cd
(
fixtures
.
dirpath
()):
with
cd
(
fixtures
.
dirpath
()):
try
:
try
:
subprocess
.
check_output
([
"
force_bdss
"
,
"
test_empty.json
"
])
subprocess
.
check_output
([
"
force_bdss
"
,
"
test_empty.json
"
],
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
:
except
subprocess
.
CalledProcessError
:
self
.
fail
(
"
force_bdss returned error at plain invocation.
"
)
self
.
fail
(
"
force_bdss returned error at plain invocation.
"
)
def
test_plain_invocation_evaluate
(
self
):
def
test_plain_invocation_evaluate
(
self
):
with
cd
(
fixtures
.
dirpath
()):
with
cd
(
fixtures
.
dirpath
()),
\
open
(
os
.
devnull
,
"
wb
"
)
as
devnull
:
proc
=
subprocess
.
Popen
([
proc
=
subprocess
.
Popen
([
"
force_bdss
"
,
"
--evaluate
"
,
"
test_empty.json
"
],
"
force_bdss
"
,
"
--evaluate
"
,
"
test_empty.json
"
],
stdin
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stderr
=
devnull
)
proc
.
communicate
(
b
"
1
"
)
proc
.
communicate
(
b
"
1
"
)
retcode
=
proc
.
wait
()
retcode
=
proc
.
wait
()
self
.
assertEqual
(
retcode
,
0
)
self
.
assertEqual
(
retcode
,
0
)
...
...
This diff is collapsed.
Click to expand it.
force_bdss/core_evaluation_driver.py
+
13
−
1
View file @
28a92855
...
@@ -35,17 +35,20 @@ class CoreEvaluationDriver(BaseCoreDriver):
...
@@ -35,17 +35,20 @@ class CoreEvaluationDriver(BaseCoreDriver):
sys
.
exit
(
0
)
sys
.
exit
(
0
)
mco_factory
=
mco_model
.
factory
mco_factory
=
mco_model
.
factory
log
.
info
(
"
Creating communicator
"
)
mco_communicator
=
mco_factory
.
create_communicator
()
mco_communicator
=
mco_factory
.
create_communicator
()
mco_data_values
=
_get_data_values_from_mco
(
mco_data_values
=
_get_data_values_from_mco
(
mco_model
,
mco_communicator
)
mco_model
,
mco_communicator
)
log
.
info
(
"
Computing data layer 1
"
)
ds_results
=
_compute_layer_results
(
ds_results
=
_compute_layer_results
(
mco_data_values
,
mco_data_values
,
workflow
.
data_sources
,
workflow
.
data_sources
,
"
create_data_source
"
"
create_data_source
"
)
)
log
.
info
(
"
Computing data layer 2
"
)
kpi_results
=
_compute_layer_results
(
kpi_results
=
_compute_layer_results
(
ds_results
+
mco_data_values
,
ds_results
+
mco_data_values
,
workflow
.
kpi_calculators
,
workflow
.
kpi_calculators
,
...
@@ -107,7 +110,13 @@ def _compute_layer_results(environment_data_values,
...
@@ -107,7 +110,13 @@ def _compute_layer_results(environment_data_values,
# execute data source, passing only relevant data values.
# execute data source, passing only relevant data values.
log
.
info
(
"
Evaluating for Data Source {}
"
.
format
(
log
.
info
(
"
Evaluating for Data Source {}
"
.
format
(
factory
.
name
))
factory
.
name
))
res
=
evaluator
.
run
(
model
,
passed_data_values
)
try
:
res
=
evaluator
.
run
(
model
,
passed_data_values
)
except
Exception
:
log
.
error
(
"
Evaluation could not be performed. Run method raised
"
"
exception
"
,
exc_info
=
True
)
raise
if
len
(
res
)
!=
len
(
out_slots
):
if
len
(
res
)
!=
len
(
out_slots
):
error_txt
=
(
error_txt
=
(
...
@@ -165,6 +174,9 @@ def _get_data_values_from_mco(model, communicator):
...
@@ -165,6 +174,9 @@ def _get_data_values_from_mco(model, communicator):
"""
"""
mco_data_values
=
communicator
.
receive_from_mco
(
model
)
mco_data_values
=
communicator
.
receive_from_mco
(
model
)
log
.
info
(
"
Received data from MCO:
\n
{}
"
.
format
(
"
\n
"
.
join
([
str
(
x
)
for
x
in
mco_data_values
])))
if
len
(
mco_data_values
)
!=
len
(
model
.
parameters
):
if
len
(
mco_data_values
)
!=
len
(
model
.
parameters
):
error_txt
=
(
"
The number of data values returned by
"
error_txt
=
(
"
The number of data values returned by
"
"
the MCO ({} values) does not match the
"
"
the MCO ({} values) does not match the
"
...
...
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