Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.core
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.core
Commits
86049b9d
Commit
86049b9d
authored
6 years ago
by
André Anjos
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-docker-pull' into 'master'
Fix docker-pull implementation See merge request
!57
parents
0936a76d
6e744310
No related branches found
No related tags found
1 merge request
!57
Fix docker-pull implementation
Pipeline
#27520
passed
6 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
beat/core/test/test_docker.py
+9
-3
9 additions, 3 deletions
beat/core/test/test_docker.py
beat/core/test/test_docker_execution.py
+3
-1
3 additions, 1 deletion
beat/core/test/test_docker_execution.py
beat/core/test/utils.py
+4
-3
4 additions, 3 deletions
beat/core/test/utils.py
with
16 additions
and
7 deletions
beat/core/test/test_docker.py
+
9
−
3
View file @
86049b9d
...
...
@@ -269,14 +269,20 @@ class AsyncWithEnvironmentTest(unittest.TestCase):
cmd
=
[
'
python
'
,
'
-c
'
,
'
;
'
.
join
([
"
print(
'
Before
'
)
"
,
"
import sys; sys.stdout.flush()
"
,
"
d =
'
0
'
* (
1
0 * 1024 * 1024)
"
,
"
d =
'
0
'
* (
4
0 * 1024 * 1024)
"
,
"
import time; time.sleep(5)
"
,
"
print(
'
After
'
)
"
,
])
]
container
=
self
.
host
.
create_container
(
self
.
test_environment
,
cmd
)
self
.
host
.
start
(
container
,
virtual_memory_in_megabytes
=
4
)
# The amount of memory in megabytes should be greater than whatever
# the docker process is started with (see:
# https://unix.stackexchange.com/questions/412040/cgroups-memory-limit-write-error-device-or-resource-busy)
# If you start seeing EBUSY (device or resource busy errors) from
# docker, then try increasing a bit this value such that it still
# triggers the memory allocation error for the array defined above.
self
.
host
.
start
(
container
,
virtual_memory_in_megabytes
=
20
)
time
.
sleep
(
2
)
...
...
@@ -313,7 +319,7 @@ class AsyncWithEnvironmentTest(unittest.TestCase):
assert
stats
[
'
memory
'
][
'
percent
'
]
>
10
,
'
Memory check failed,
'
\
'
%d%% <= 10%%
'
%
stats
[
'
memory
'
][
'
percent
'
]
assert
stats
[
'
memory
'
][
'
percent
'
]
<
15
,
'
Memory check failed,
'
\
assert
stats
[
'
memory
'
][
'
percent
'
]
<
20
,
'
Memory check failed,
'
\
'
%d%% >= 15%%
'
%
stats
[
'
memory
'
][
'
percent
'
]
self
.
assertEqual
(
self
.
host
.
status
(
container
),
'
exited
'
)
...
...
This diff is collapsed.
Click to expand it.
beat/core/test/test_docker_execution.py
+
3
−
1
View file @
86049b9d
...
...
@@ -44,7 +44,9 @@ from . import network_name
from
.
import
prefix_folder
from
.
import
DOCKER_NETWORK_TEST_ENABLED
BUILDER_IMAGE
=
"
docker.idiap.ch/beat/beat.env.client:2.0.0r0
"
from
.utils
import
DOCKER_TEST_IMAGES
BUILDER_CONTAINER_NAME
=
"
docker.idiap.ch/beat/beat.env.client
"
BUILDER_IMAGE
=
BUILDER_CONTAINER_NAME
+
'
:
'
+
DOCKER_TEST_IMAGES
[
BUILDER_CONTAINER_NAME
]
#----------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
beat/core/test/utils.py
+
4
−
3
View file @
86049b9d
...
...
@@ -70,11 +70,12 @@ def pull_docker_test_images():
if
not
has_image
:
#must pull (network connection required)
token
=
os
.
environ
.
get
(
'
CI_BUILD_TOKEN
'
)
params
=
(
image
,
tag
)
args
=
(
image
,
tag
)
kwargs
=
{}
if
token
is
not
None
:
#running on CI, setup
auth_config
=
dict
(
username
=
'
gitlab-ci-token
'
,
password
=
token
)
params
+
=
(
auth_config
,)
client
.
images
.
pull
(
*
p
ar
am
s
)
kwargs
[
'
auth_config
'
]
=
auth_config
client
.
images
.
pull
(
*
ar
gs
,
**
kwarg
s
)
#----------------------------------------------------------
...
...
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