Skip to content

Commit

Permalink
Install pycocotools from conda-forge (#441)
Browse files Browse the repository at this point in the history
* install pycocotools from conda-forge

* less verbose output
  • Loading branch information
Valentyn Klindukh authored Aug 4, 2020
1 parent cb9c598 commit ce21ed3
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 179 deletions.
2 changes: 1 addition & 1 deletion python-sdk/nuscenes/tests/test_lidarseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from nuscenes import NuScenes


@unittest.skip("skip until PR-440 merged")
class TestNuScenesLidarseg(unittest.TestCase):
def setUp(self):
assert 'NUSCENES' in os.environ, 'Set NUSCENES env. variable to enable tests.'
Expand Down
30 changes: 30 additions & 0 deletions setup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM continuumio/miniconda3:4.6.14
ENV PATH /opt/conda/bin:$PATH

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libsm6 \
libxext6 \
libxrender-dev \
libgl1-mesa-glx \
libglib2.0-0 \
xvfb && \
rm -rf /var/lib/apt/lists/*

WORKDIR /nuscenes-dev
# create conda nuscenes env
ARG PYTHON_VERSION
RUN bash -c "conda create -y -n nuscenes python=${PYTHON_VERSION} \
&& source activate nuscenes \
&& conda clean --yes --all"

COPY setup/requirements.txt .
COPY setup/requirements/ requirements/
# Install Python dependencies inside of the Docker image via pip & Conda.
# pycocotools installed from conda-forge
RUN bash -c "source activate nuscenes \
&& find . -name "\\*.txt" -exec sed -i -e '/pycocotools/d' {} \; \
&& pip install --no-cache -r /nuscenes-dev/requirements.txt \
&& conda config --append channels conda-forge \
&& conda install --yes pycocotools \
&& conda clean --yes --all"
24 changes: 0 additions & 24 deletions setup/Dockerfile_3.6

This file was deleted.

24 changes: 0 additions & 24 deletions setup/Dockerfile_3.7

This file was deleted.

205 changes: 101 additions & 104 deletions setup/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,86 +1,119 @@
@Library('jenkins-shared-libraries') _

// Aborts previous builds of the same PR-
if( env.BRANCH_NAME != null && env.BRANCH_NAME != "master" ) {
def buildNumber = env.BUILD_NUMBER as int
if (buildNumber > 1) milestone(buildNumber - 1)
milestone(buildNumber)
}

def update_deps() {
sh '''#!/usr/bin/env bash
set -e
source activate nuscenes
find . -name "*.txt" -exec sed -i -e '/pycocotools/d' {} \\;
pip install --no-cache -r /nuscenes-dev/requirements.txt
conda install --yes pycocotools
'''
}

def kubeagent(name, image) {
return jnlp.docker(name: name,
docker_image: image,
cpu: 7, maxcpu: 8,
memory: "8G", maxmemory: "30G",
cloud: "boston",
yaml: """spec:
containers:
- name: docker
volumeMounts:
- mountPath: /data/
name: nudeep-ci
subPath: data
volumes:
- name: nudeep-ci
persistentVolumeClaim:
claimName: nudeep-ci""")
}

pipeline {

agent {
kubernetes {
label 'nuscenes-builder-' + UUID.randomUUID().toString()
cloud 'boston'
yamlFile 'setup/docker.yaml'
}// kubernetes
kubernetes (jnlp.docker(name: "nuscenes-builder",
cpu: 2, maxcpu: 2,
memory: "2G", maxmemory: "4G",
cloud: "boston"))
} // agent

environment {
PROD_IMAGE = "nuscenes:production"
TEST_IMAGE_3_6 = "registry-local.nutonomy.team:5000/nuscenes-test:kube${UUID.nameUUIDFromBytes(new String(env.BUILD_TAG).getBytes())}"
TEST_IMAGE_3_7 = "registry-local.nutonomy.team:5000/nuscenes-test:kube${UUID.nameUUIDFromBytes(new String(env.BUILD_TAG).getBytes())}"
PROD_IMAGE = "233885420847.dkr.ecr.us-east-1.amazonaws.com/nuscenes-test:production"
TEST_IMAGE = "233885420847.dkr.ecr.us-east-1.amazonaws.com/nuscenes-test:1.0"
TEST_IMAGE_3_6 = "${env.TEST_IMAGE}-3.6"
TEST_IMAGE_3_7 = "${env.TEST_IMAGE}-3.7"
NUSCENES = "/data/sets/nuscenes"
NUIMAGES = "/data/sets/nuimages"
PYTHONPATH = "${env.WORKSPACE}/python-sdk"
PYTHONUNBUFFERED = "1"
}

parameters {
booleanParam(name: 'REBUILD_TEST_IMAGE', defaultValue: false, description: 'rebuild docker test image')
}

stages {
stage('Build'){
steps {
container('docker') {
// Build the Docker image, and then run python -m unittest inside
// an activated Conda environment inside of the container.
sh """#!/bin/bash
set -eux
docker build -t $TEST_IMAGE_3_6 -f setup/Dockerfile_3.6 .
docker push $TEST_IMAGE_3_6
docker build -t $TEST_IMAGE_3_7 -f setup/Dockerfile_3.7 .
docker push $TEST_IMAGE_3_7
"""
} // container
} // steps
} // stage
stage('Build test docker image') {
when {
expression { return params.REBUILD_TEST_IMAGE }
}
failFast true
parallel {
stage('Build 3.6') {
steps {
withAWS(credentials: 'ecr-233') {
container('docker') {
// Build the Docker image, and then run python -m unittest inside
// an activated Conda environment inside of the container.
sh """#!/bin/bash
set -eux
docker build --build-arg PYTHON_VERSION=3.6 -t $TEST_IMAGE_3_6 -f setup/Dockerfile .
`aws ecr get-login --no-include-email --region us-east-1`
docker push $TEST_IMAGE_3_6
"""
} // container
}
} // steps
} // stage
stage('Build 3.7') {
steps {
withAWS(credentials: 'ecr-233') {
container('docker') {
// Build the Docker image, and then run python -m unittest inside
// an activated Conda environment inside of the container.
sh """#!/bin/bash
set -eux
docker build --build-arg PYTHON_VERSION=3.7 -t $TEST_IMAGE_3_7 -f setup/Dockerfile .
`aws ecr get-login --no-include-email --region us-east-1`
docker push $TEST_IMAGE_3_7
"""
} // container
}
} // steps
} // stage
}
}

stage('Tests') {
failFast true
parallel {
stage('Test 3.6'){
stage('Test 3.6') {
agent {
kubernetes {
label 'nuscenes-test3.6-' + UUID.randomUUID().toString()
cloud 'boston'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
app: nuscenes
spec:
containers:
- name: jnlp
image: registry.nutonomy.com:5000/nu/jnlp-slave:3.19-1-lfs
imagePullPolicy: Always
- name: docker
image: $TEST_IMAGE_3_6
command:
- cat
tty: true
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker
- mountPath: /data/
name: nudeep-ci
subPath: data
imagePullSecrets:
- name: regcredjenkins
volumes:
- name: docker
hostPath:
path: /var/run/docker.sock
- name: nudeep-ci
persistentVolumeClaim:
claimName: nudeep-ci
env:
- name: NUSCENES
value: $NUSCENES
"""
}// kubernetes
kubernetes(kubeagent("nuscenes-test3.6",
env.TEST_IMAGE_3_6))
} // agent

steps {
container('docker') {
update_deps()
sh """#!/bin/bash
set -e
source activate nuscenes && python -m unittest discover python-sdk
Expand All @@ -90,51 +123,15 @@ pipeline {
} // steps
} // stage

stage('Test 3.7'){
stage('Test 3.7') {
agent {
kubernetes {
label 'nuscenes-test3.7-' + UUID.randomUUID().toString()
cloud 'boston'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
app: nuscenes
spec:
containers:
- name: jnlp
image: registry.nutonomy.com:5000/nu/jnlp-slave:3.19-1-lfs
imagePullPolicy: Always
- name: docker
image: $TEST_IMAGE_3_7
command:
- cat
tty: true
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker
- mountPath: /data/
name: nudeep-ci
subPath: data
imagePullSecrets:
- name: regcredjenkins
volumes:
- name: docker
hostPath:
path: /var/run/docker.sock
- name: nudeep-ci
persistentVolumeClaim:
claimName: nudeep-ci
env:
- name: NUSCENES
value: $NUSCENES
"""
}// kubernetes
kubernetes(kubeagent("nuscenes-test3.7",
env.TEST_IMAGE_3_7))
} // agent

steps {
container('docker') {
update_deps()
sh """#!/bin/bash
set -e
source activate nuscenes && python -m unittest discover python-sdk
Expand Down
24 changes: 0 additions & 24 deletions setup/docker.yaml

This file was deleted.

1 change: 0 additions & 1 deletion setup/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
-r requirements/requirements_prediction.txt
-r requirements/requirements_tracking.txt
-r requirements/requirements_nuimages.txt

2 changes: 1 addition & 1 deletion setup/test_tutorial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sed -i.bak "/get_ipython.*/d; s/\(plt.imshow.*\)/#\1/" python-sdk/tutorials/pre

# Run tutorial
xvfb-run python python-sdk/tutorials/nuscenes_tutorial.py
xvfb-run python python-sdk/tutorials/nuimages_tutorial.py
# xvfb-run python python-sdk/tutorials/nuimages_tutorial.py # skip until PR-440 merged
xvfb-run python python-sdk/tutorials/can_bus_tutorial.py
xvfb-run python python-sdk/tutorials/map_expansion_tutorial.py
xvfb-run python python-sdk/tutorials/prediction_tutorial.py

0 comments on commit ce21ed3

Please sign in to comment.