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
a5fcda35
Commit
a5fcda35
authored
7 years ago
by
martinRenou
Browse files
Options
Downloads
Patches
Plain Diff
Reviews
parent
873fa3fa
No related branches found
No related tags found
1 merge request
!27
Add file version handling for workflow file.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
force_bdss/core_mco_driver.py
+2
-5
2 additions, 5 deletions
force_bdss/core_mco_driver.py
force_bdss/workspecs/workflow.py
+4
-4
4 additions, 4 deletions
force_bdss/workspecs/workflow.py
with
6 additions
and
9 deletions
force_bdss/core_mco_driver.py
+
2
−
5
View file @
a5fcda35
...
@@ -6,7 +6,7 @@ from traits.api import on_trait_change
...
@@ -6,7 +6,7 @@ from traits.api import on_trait_change
from
force_bdss.base_core_driver
import
BaseCoreDriver
from
force_bdss.base_core_driver
import
BaseCoreDriver
from
force_bdss.workspecs.workflow
import
(
InvalidVersionException
,
from
force_bdss.workspecs.workflow
import
(
InvalidVersionException
,
CorruptedInputFile
)
InvalidFileException
)
class
CoreMCODriver
(
BaseCoreDriver
):
class
CoreMCODriver
(
BaseCoreDriver
):
...
@@ -18,10 +18,7 @@ class CoreMCODriver(BaseCoreDriver):
...
@@ -18,10 +18,7 @@ class CoreMCODriver(BaseCoreDriver):
def
application_started
(
self
):
def
application_started
(
self
):
try
:
try
:
workflow
=
self
.
application
.
workflow
workflow
=
self
.
application
.
workflow
except
InvalidVersionException
as
e
:
except
(
InvalidVersionException
,
InvalidFileException
)
as
e
:
print
(
str
(
e
),
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
except
CorruptedInputFile
as
e
:
print
(
str
(
e
),
file
=
sys
.
stderr
)
print
(
str
(
e
),
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
...
This diff is collapsed.
Click to expand it.
force_bdss/workspecs/workflow.py
+
4
−
4
View file @
a5fcda35
...
@@ -7,11 +7,11 @@ from .multi_criteria_optimizer import MultiCriteriaOptimizer
...
@@ -7,11 +7,11 @@ from .multi_criteria_optimizer import MultiCriteriaOptimizer
SUPPORTED_FILE_VERSIONS
=
[
"
1
"
]
SUPPORTED_FILE_VERSIONS
=
[
"
1
"
]
class
Invalid
Version
Exception
(
Exception
):
class
Invalid
File
Exception
(
Exception
):
pass
pass
class
CorruptedInput
File
(
Exception
):
class
InvalidVersionException
(
Invalid
FileException
):
pass
pass
...
@@ -26,8 +26,8 @@ class Workflow(HasStrictTraits):
...
@@ -26,8 +26,8 @@ class Workflow(HasStrictTraits):
try
:
try
:
version
=
json_data
[
"
version
"
]
version
=
json_data
[
"
version
"
]
except
KeyError
:
except
KeyError
:
raise
CorruptedInputFile
(
"
Corrupted input file, no version
"
raise
InvalidFileException
(
"
Corrupted input file, no version
"
"
specified
"
)
"
specified
"
)
if
version
not
in
SUPPORTED_FILE_VERSIONS
:
if
version
not
in
SUPPORTED_FILE_VERSIONS
:
raise
InvalidVersionException
(
raise
InvalidVersionException
(
...
...
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