Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
beat
beat.web
Commits
a6edb816
Commit
a6edb816
authored
4 years ago
by
Flavio TARSETTI
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_parallel_testing_on_ci' into 'master'
Fix parallel testing on ci See merge request
!330
parents
498bb740
facb5d83
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!330
Fix parallel testing on ci
Pipeline
#39737
passed
4 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
beat/web/settings/__init__.py
+54
-0
54 additions, 0 deletions
beat/web/settings/__init__.py
beat/web/settings/ci.py
+15
-0
15 additions, 0 deletions
beat/web/settings/ci.py
beat/web/settings/test.py
+4
-17
4 additions, 17 deletions
beat/web/settings/test.py
with
73 additions
and
17 deletions
beat/web/settings/__init__.py
+
54
−
0
View file @
a6edb816
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
###############################################################################
# #
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.web 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/. #
# #
###############################################################################
import
os
import
platform
SHM_PATH
=
"
/dev/shm/beatweb
"
# nosec
def
get_test_db_path
(
is_on_ci
):
database_name
=
"
test.sqlite3
"
database_path
=
os
.
path
.
realpath
(
"
./
"
)
if
not
is_on_ci
:
if
platform
.
system
()
==
"
Linux
"
:
database_path
=
SHM_PATH
if
not
os
.
path
.
exists
(
database_path
):
os
.
makedirs
(
database_path
)
return
os
.
path
.
join
(
database_path
,
database_name
)
def
get_test_prefix_path
(
is_on_ci
):
prefix_path
=
os
.
path
.
realpath
(
"
./test_prefix
"
)
if
not
is_on_ci
:
if
platform
.
system
()
==
"
Linux
"
:
prefix_path
=
os
.
path
.
join
(
SHM_PATH
,
"
test_prefix
"
)
# nosec
return
prefix_path
This diff is collapsed.
Click to expand it.
beat/web/settings/ci.py
+
15
−
0
View file @
a6edb816
...
...
@@ -26,8 +26,23 @@
###############################################################################
# Django settings for tests on the CI server
import
os
from
.test
import
*
# noqa
from
.
import
get_test_db_path
from
.
import
get_test_prefix_path
RUNNING_ON_CI
=
True
DATABASES
[
"
default
"
][
"
OPTIONS
"
][
"
timeout
"
]
=
60
# noqa
DATABASES
[
"
default
"
][
"
NAME
"
]
=
get_test_db_path
(
RUNNING_ON_CI
)
# noqa
DATABASES
[
"
default
"
][
"
TEST
"
]
=
{
"
NAME
"
:
DATABASES
[
"
default
"
][
"
NAME
"
]}
# noqa
PREFIX
=
os
.
environ
.
get
(
"
BEAT_TEST_PREFIX
"
,
get_test_prefix_path
(
RUNNING_ON_CI
))
ALGORITHMS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
algorithms
"
)
PLOTTERS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
plotters
"
)
LIBRARIES_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
libraries
"
)
DATABASES_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
databases
"
)
DATAFORMATS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
dataformats
"
)
TOOLCHAINS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
toolchains
"
)
EXPERIMENTS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
experiments
"
)
CACHE_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
cache
"
)
This diff is collapsed.
Click to expand it.
beat/web/settings/test.py
+
4
−
17
View file @
a6edb816
...
...
@@ -27,9 +27,10 @@
# Django settings for tests
import
os
import
platform
from
.settings
import
*
# noqa
from
.
import
get_test_db_path
from
.
import
get_test_prefix_path
URL_PREFIX
=
""
...
...
@@ -41,17 +42,7 @@ TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG # noqa
ALLOWED_HOSTS
=
[
"
testserver
"
]
if
platform
.
system
()
==
"
Linux
"
:
shm_path
=
"
/dev/shm/beatweb
"
# nosec
if
not
os
.
path
.
exists
(
shm_path
):
os
.
makedirs
(
shm_path
)
database_name
=
os
.
path
.
join
(
shm_path
,
"
test.sqlite3
"
)
else
:
here
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
database_name
=
os
.
path
.
join
(
here
,
"
test.sqlite3
"
)
DATABASES
[
"
default
"
][
"
NAME
"
]
=
database_name
# noqa
DATABASES
[
"
default
"
][
"
NAME
"
]
=
get_test_db_path
(
RUNNING_ON_CI
)
# noqa
DATABASES
[
"
default
"
][
"
TEST
"
]
=
{
"
NAME
"
:
DATABASES
[
"
default
"
][
"
NAME
"
]}
# noqa
DATABASES
[
"
default
"
][
"
OPTIONS
"
][
"
timeout
"
]
=
30
# noqa
DATABASES
[
"
default
"
][
"
ATOMIC_REQUESTS
"
]
=
True
# noqa
...
...
@@ -67,11 +58,7 @@ LOGGING["loggers"]["beat.web.utils.management.commands"]["handlers"] = [ # noqa
]
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__name__
))
if
platform
.
system
()
==
"
Linux
"
:
default_prefix
=
os
.
path
.
join
(
shm_path
,
"
test_prefix
"
)
# nosec
else
:
default_prefix
=
os
.
path
.
realpath
(
"
./test_prefix
"
)
PREFIX
=
os
.
environ
.
get
(
"
BEAT_TEST_PREFIX
"
,
default_prefix
)
PREFIX
=
os
.
environ
.
get
(
"
BEAT_TEST_PREFIX
"
,
get_test_prefix_path
(
RUNNING_ON_CI
))
ALGORITHMS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
algorithms
"
)
PLOTTERS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
plotters
"
)
LIBRARIES_ROOT
=
os
.
path
.
join
(
PREFIX
,
"
libraries
"
)
...
...
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