Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
c29a0cc3
Unverified
Commit
c29a0cc3
authored
Mar 25, 2019
by
SparkSnail
Committed by
GitHub
Mar 25, 2019
Browse files
Fix remote integration test pipeline (#914)
parent
8fd18a5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
test/pipelines-it-remote.yml
test/pipelines-it-remote.yml
+9
-10
test/remote_docker.py
test/remote_docker.py
+14
-3
No files found.
test/pipelines-it-remote.yml
View file @
c29a0cc3
...
@@ -4,6 +4,12 @@ jobs:
...
@@ -4,6 +4,12 @@ jobs:
steps
:
steps
:
-
script
:
python3 -m pip install --upgrade pip setuptools --user
-
script
:
python3 -m pip install --upgrade pip setuptools --user
displayName
:
'
Install
python
tools'
displayName
:
'
Install
python
tools'
-
script
:
|
cd deployment/pypi
echo 'building prerelease package...'
make build
ls $(Build.SourcesDirectory)/deployment/pypi/dist/
displayName
:
'
build
nni
bdsit_wheel'
-
script
:
|
-
script
:
|
source install.sh
source install.sh
displayName
:
'
Install
nni
toolkit
via
source
code'
displayName
:
'
Install
nni
toolkit
via
source
code'
...
@@ -14,17 +20,10 @@ jobs:
...
@@ -14,17 +20,10 @@ jobs:
-
task
:
CopyFilesOverSSH@0
-
task
:
CopyFilesOverSSH@0
inputs
:
inputs
:
sshEndpoint
:
remote_nni-ci-gpu-01
sshEndpoint
:
remote_nni-ci-gpu-01
sourceFolder
:
src/sdk/pynni
sourceFolder
:
deployment/pypi/dist/
targetFolder
:
/tmp/nnitest/$(Build.BuildId)/pynni
targetFolder
:
/tmp/nnitest/$(Build.BuildId)/dist
overwrite
:
true
displayName
:
'
Copy
sdk
files
to
remote
machine'
-
task
:
CopyFilesOverSSH@0
inputs
:
sshEndpoint
:
remote_nni-ci-gpu-01
sourceFolder
:
tools
targetFolder
:
/tmp/nnitest/$(Build.BuildId)/tools
overwrite
:
true
overwrite
:
true
displayName
:
'
Copy
tool
files
to
remote
machine'
displayName
:
'
Copy
dist
files
to
remote
machine'
-
task
:
CopyFilesOverSSH@0
-
task
:
CopyFilesOverSSH@0
inputs
:
inputs
:
sshEndpoint
:
remote_nni-ci-gpu-01
sshEndpoint
:
remote_nni-ci-gpu-01
...
...
test/remote_docker.py
View file @
c29a0cc3
...
@@ -3,6 +3,7 @@ import argparse
...
@@ -3,6 +3,7 @@ import argparse
from
subprocess
import
check_output
,
check_call
from
subprocess
import
check_output
,
check_call
import
socket
import
socket
import
random
import
random
import
re
def
detect_port
(
port
):
def
detect_port
(
port
):
'''Detect if the port is used, return True if the port is used'''
'''Detect if the port is used, return True if the port is used'''
...
@@ -21,6 +22,14 @@ def find_port():
...
@@ -21,6 +22,14 @@ def find_port():
port
=
random
.
randint
(
10000
,
20000
)
port
=
random
.
randint
(
10000
,
20000
)
return
port
return
port
def
find_wheel_package
(
dir
):
'''Find the wheel package uploaded to this machine'''
regular
=
re
.
compile
(
'^nni-.*\.whl$'
)
for
file_name
in
os
.
listdir
(
dir
):
if
regular
.
search
(
file_name
):
return
file_name
return
None
def
start_container
(
image
,
name
):
def
start_container
(
image
,
name
):
'''Start docker container, generate a port in /tmp/nnitest/{name}/port file'''
'''Start docker container, generate a port in /tmp/nnitest/{name}/port file'''
port
=
find_port
()
port
=
find_port
()
...
@@ -28,10 +37,12 @@ def start_container(image, name):
...
@@ -28,10 +37,12 @@ def start_container(image, name):
run_cmds
=
[
'docker'
,
'run'
,
'-d'
,
'-p'
,
str
(
port
)
+
':22'
,
'--name'
,
name
,
'--mount'
,
'type=bind,source='
+
source_dir
+
',target=/tmp/nni'
,
image
]
run_cmds
=
[
'docker'
,
'run'
,
'-d'
,
'-p'
,
str
(
port
)
+
':22'
,
'--name'
,
name
,
'--mount'
,
'type=bind,source='
+
source_dir
+
',target=/tmp/nni'
,
image
]
output
=
check_output
(
run_cmds
)
output
=
check_output
(
run_cmds
)
commit_id
=
output
.
decode
(
'utf-8'
)
commit_id
=
output
.
decode
(
'utf-8'
)
sdk_cmds
=
[
'docker'
,
'exec'
,
name
,
'python3'
,
'-m'
,
'pip'
,
'install'
,
'--user'
,
'--no-cache-dir'
,
'/tmp/nni/pynni/'
]
wheel_name
=
find_wheel_package
(
os
.
path
.
join
(
source_dir
,
'dist'
))
if
not
wheel_name
:
print
(
'Error: could not find wheel package in {0}'
.
format
(
source_dir
))
exit
(
1
)
sdk_cmds
=
[
'docker'
,
'exec'
,
name
,
'python3'
,
'-m'
,
'pip'
,
'install'
,
'/tmp/nni/dist/{0}'
.
format
(
wheel_name
)]
check_call
(
sdk_cmds
)
check_call
(
sdk_cmds
)
tools_cmds
=
[
'docker'
,
'exec'
,
name
,
'python3'
,
'-m'
,
'pip'
,
'install'
,
'--user'
,
'--no-cache-dir'
,
'/tmp/nni/tools'
]
check_call
(
tools_cmds
)
with
open
(
source_dir
+
'/port'
,
'w'
)
as
file
:
with
open
(
source_dir
+
'/port'
,
'w'
)
as
file
:
file
.
write
(
str
(
port
))
file
.
write
(
str
(
port
))
...
...
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