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
976a1f88
Commit
976a1f88
authored
7 years ago
by
Stefano Borini
Browse files
Options
Downloads
Patches
Plain Diff
Reintroduced execution and fixed a bug when no MCO is defined
parent
5cd52acd
No related branches found
No related tags found
1 merge request
!101
Create probe classes for tests
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
force_bdss/cli/tests/test_execution.py
+54
-0
54 additions, 0 deletions
force_bdss/cli/tests/test_execution.py
force_bdss/core_evaluation_driver.py
+4
-0
4 additions, 0 deletions
force_bdss/core_evaluation_driver.py
force_bdss/core_mco_driver.py
+4
-0
4 additions, 0 deletions
force_bdss/core_mco_driver.py
with
62 additions
and
0 deletions
force_bdss/cli/tests/test_execution.py
0 → 100644
+
54
−
0
View file @
976a1f88
import
unittest
import
subprocess
import
os
from
contextlib
import
contextmanager
from
force_bdss.tests
import
fixtures
@contextmanager
def
cd
(
dir
):
cwd
=
os
.
getcwd
()
os
.
chdir
(
dir
)
try
:
yield
finally
:
os
.
chdir
(
cwd
)
def
fixture_dir
():
return
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"
fixtures
"
)
class
TestExecution
(
unittest
.
TestCase
):
def
test_plain_invocation_mco
(
self
):
with
cd
(
fixtures
.
dirpath
()):
out
=
subprocess
.
check_call
([
"
force_bdss
"
,
"
test_empty.json
"
])
self
.
assertEqual
(
out
,
0
)
def
test_plain_invocation_evaluate
(
self
):
with
cd
(
fixtures
.
dirpath
()):
proc
=
subprocess
.
Popen
([
"
force_bdss
"
,
"
--evaluate
"
,
"
test_empty.json
"
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
proc
.
communicate
(
b
"
1
"
)
retcode
=
proc
.
wait
()
self
.
assertEqual
(
retcode
,
0
)
def
test_unsupported_file_input
(
self
):
with
cd
(
fixtures
.
dirpath
()):
with
self
.
assertRaises
(
subprocess
.
CalledProcessError
):
subprocess
.
check_call
([
"
force_bdss
"
,
"
test_csv_v2.json
"
])
def
test_corrupted_file_input
(
self
):
with
cd
(
fixtures
.
dirpath
()):
with
self
.
assertRaises
(
subprocess
.
CalledProcessError
):
subprocess
.
check_call
([
"
force_bdss
"
,
"
test_csv_corrupted.json
"
])
if
__name__
==
'
__main__
'
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
force_bdss/core_evaluation_driver.py
+
4
−
0
View file @
976a1f88
...
...
@@ -30,6 +30,10 @@ class CoreEvaluationDriver(BaseCoreDriver):
sys
.
exit
(
1
)
mco_model
=
workflow
.
mco
if
mco_model
is
None
:
print
(
"
No MCO defined. Nothing to do. Exiting.
"
)
sys
.
exit
(
0
)
mco_factory
=
mco_model
.
factory
mco_communicator
=
mco_factory
.
create_communicator
()
...
...
This diff is collapsed.
Click to expand it.
force_bdss/core_mco_driver.py
+
4
−
0
View file @
976a1f88
...
...
@@ -48,6 +48,10 @@ class CoreMCODriver(BaseCoreDriver):
sys
.
exit
(
1
)
mco_model
=
workflow
.
mco
if
mco_model
is
None
:
print
(
"
No MCO defined. Nothing to do. Exiting.
"
)
sys
.
exit
(
0
)
mco_factory
=
mco_model
.
factory
return
mco_factory
.
create_optimizer
()
...
...
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