Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
2777b1eb
Commit
2777b1eb
authored
Jul 20, 2018
by
André Anjos
💬
Browse files
Merge branch 'algorithm_schema_v2' into '1.6.x'
Add algorithm v2 schema See merge request
!31
parents
9915dd15
3bc4e9ba
Pipeline
#22370
passed with stages
in 45 minutes and 59 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
beat/core/schema/algorithm/2.json
0 → 100644
View file @
2777b1eb
{
"$schema"
:
"http://json-schema.org/draft-04/schema#"
,
"title"
:
"Algorithm descriptor v2"
,
"description"
:
"This schema defines the properties of a v2 algorithm"
,
"allOf"
:
[
{
"$ref"
:
"1.json"
}
],
"definitions"
:
{
"type"
:
{
"type"
:
"string"
,
"enum"
:
[
"legacy"
,
"sequential"
,
"autonomous"
]
},
"api_version"
:
{
"type"
:
"number"
,
"exclusiveMinimum"
:
0
}
},
"required"
:
[
"type"
,
"api_version"
]
}
\ No newline at end of file
beat/core/test/prefix/algorithms/user/integers_add_v2/1.json
0 → 100644
View file @
2777b1eb
{
"schema_version"
:
2
,
"language"
:
"python"
,
"api_version"
:
2
,
"type"
:
"autonomous"
,
"splittable"
:
false
,
"parameters"
:
{
"sync"
:
{
"default"
:
"in1"
,
"type"
:
"string"
}
},
"groups"
:
[
{
"inputs"
:
{
"in1"
:
{
"type"
:
"user/single_integer/1"
},
"in2"
:
{
"type"
:
"user/single_integer/1"
}
},
"outputs"
:
{
"out"
:
{
"type"
:
"user/single_integer/1"
}
}
}
]
}
\ No newline at end of file
beat/core/test/prefix/algorithms/user/integers_add_v2/1.py
0 → 100644
View file @
2777b1eb
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.core module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
class
Algorithm
:
def
__init__
(
self
):
self
.
offset
=
1
def
setup
(
self
,
parameters
):
self
.
sync
=
parameters
[
'sync'
]
self
.
offset
=
parameters
[
'offset'
]
return
True
def
process
(
self
,
inputs
,
outputs
):
data_loader
=
data_loaders
.
loaderOf
(
'in1'
)
for
i
in
range
(
data_loader
.
count
(
self
.
sync
)):
view
=
data_loader
.
view
(
self
.
sync
,
i
)
(
data
,
start
,
end
)
=
view
[
view
.
count
()
-
1
]
outputs
[
'out'
].
write
({
'value'
:
data
[
'in1'
].
value
+
data
[
'in2'
].
value
,
},
end
)
return
True
beat/core/test/test_algorithm_loading.py
View file @
2777b1eb
...
...
@@ -67,6 +67,15 @@ def test_missing_outputs():
#----------------------------------------------------------
def
test_v2
():
algorithm
=
Algorithm
(
prefix
,
'user/integers_add_v2/1'
)
assert
algorithm
.
valid
,
'
\n
* %s'
%
'
\n
* '
.
join
(
algorithm
.
errors
)
#----------------------------------------------------------
@
nose
.
tools
.
with_setup
(
teardown
=
cleanup
)
def
test_export
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment