Skip to content

Commit b7ff377

Browse files
authored
Est res (#13)
add dockerfile
1 parent 8229bc5 commit b7ff377

File tree

5 files changed

+229
-1
lines changed

5 files changed

+229
-1
lines changed

.github/workflows/cicd.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CICD
2+
3+
# on:
4+
# pull_request:
5+
# branches: [main]
6+
7+
on: push
8+
9+
jobs:
10+
lidar_on_docker:
11+
runs-on: self-hosted
12+
13+
steps:
14+
15+
- name: Checkout branch
16+
uses: actions/checkout@v2
17+
18+
- name: build docker image
19+
run: docker build -t lidar_deep_im .
20+
21+
- name: Check code neatness (linter)
22+
run: docker run lidar_deep_im flake8
23+
24+
# - name: unit testing
25+
# run: docker run lidar_deep_im pytest --ignore=actions-runner --ignore="notebooks"
26+
27+
- name: Full module run on LAS subset
28+
run: docker run -v /var/data/CICD_github_assets:/CICD_github_assets lidar_deep_im
29+
# sudo mount -v -t cifs -o user=mdaab,domain=IGN,uid=24213,gid=10550 //store.ign.fr/store-lidarhd/projet-LHD/IA/Validation_Module/CICD_github_assets/B2V0.5 /var/data/CICD_github_assets
30+
31+
# - name: Evaluate decisions using optimization code on a single, corrected LAS
32+
# run: >
33+
# docker run -v /var/data/cicd/CICD_github_assets:/CICD_github_assets lidar_deep_im
34+
# python lidar_prod/run.py print_config=true +task='optimize'
35+
# +building_validation.optimization.debug=true
36+
# building_validation.optimization.todo='prepare+evaluate+update'
37+
# building_validation.optimization.paths.input_las_dir=/CICD_github_assets/M8.0/20220204_building_val_V0.0_model/20211001_buiding_val_val/
38+
# building_validation.optimization.paths.results_output_dir=/CICD_github_assets/opti/
39+
# building_validation.optimization.paths.building_validation_thresholds_pickle=/CICD_github_assets/M8.3B2V0.0/optimized_thresholds.pickle
40+
41+
- name: chekc the user
42+
run: whoami
43+
44+
- name: save the docker image because everything worked
45+
run: docker save lidar_deep_im > /var/data/CICD_github_assets/lidar_deep_im.tar # need writing right
46+
47+
- name: clean the server for further uses
48+
if: always() # always do it, even if something failed
49+
run: docker system prune # remove obsolete docker images (take a HUGE amount of space)
50+
51+
52+

.github/workflows/gh-pages

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Workflow name
2+
name: "Documentation Build"
3+
4+
# Event that must trigger the workflow
5+
on:
6+
push: # <- trigger when we call push
7+
branches:
8+
- main # <- but only on main branch
9+
- FixDocAPI # <- also on this branch until documentation is up and running.
10+
11+
jobs:
12+
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
16+
# Task to do when launching the workflow
17+
steps:
18+
19+
# 1. First get the repository source
20+
21+
- name: "Checkout"
22+
uses: actions/checkout@v2
23+
24+
# 2. Sphinx part : install tool and dependencies
25+
26+
- name: "Set up Python"
27+
uses: actions/setup-python@v1
28+
with:
29+
python-version: 3.9.12
30+
31+
# Packages that depend on torch need need to be installed afterwards,
32+
# hence the "requirements_torch_deps.txt file.
33+
- name: "Install Python dependencies"
34+
working-directory: ./docs/
35+
run: |
36+
python3 -m pip install --upgrade pip
37+
pip3 install -r requirements.txt
38+
pip3 install -r requirements_torch_deps.txt
39+
40+
41+
- name: "Build Sphinx Doc"
42+
working-directory: ./docs/
43+
run: |
44+
make html
45+
46+
# 3. Déploiement sur les Github Pages
47+
48+
- name: "Deploy Github Pages"
49+
uses: JamesIves/github-pages-deploy-action@3.7.1
50+
with:
51+
BRANCH: gh-pages # <- Branch where generated doc files will be commited
52+
FOLDER: docs/build/html/ # <- Dir where .nojekyll is created and from which to deploy github pages.

dockerfile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
FROM nvidia/cuda:10.1-devel-ubuntu18.04
2+
# An nvidia image seems to be necessary for torch-points-kernel. Also, a "devel" image seems required for the same library
3+
4+
# set the IGN proxy, otherwise apt-get and other applications don't work
5+
ENV http_proxy 'http://192.168.4.9:3128/'
6+
ENV https_proxy 'http://192.168.4.9:3128/'
7+
8+
# set the timezone, otherwise it asks for it... and freezes
9+
ENV TZ=Europe/Paris
10+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
11+
12+
# all the apt-get installs
13+
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
14+
software-properties-common \
15+
wget \
16+
git \
17+
libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 # package needed for anaconda
18+
19+
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
20+
&& /bin/bash ~/miniconda.sh -b -p /opt/conda \
21+
&& rm ~/miniconda.sh
22+
23+
ENV PATH /opt/conda/bin:$PATH
24+
25+
WORKDIR /lidar
26+
27+
# copy all the data now (because the requirements files are needed for anaconda)
28+
COPY . .
29+
30+
# install the python packages via anaconda
31+
RUN conda env create -f bash/setup_environment/requirements.yml
32+
33+
# Make RUN commands use the new environment:
34+
SHELL ["conda", "run", "-n", "lidar_multiclass", "/bin/bash", "-c"]
35+
36+
# install all the dependencies
37+
RUN conda install -y pytorch=="1.10.1" torchvision=="0.11.2" -c pytorch -c conda-forge \
38+
&& conda install pytorch-lightning==1.5.9 -c conda-forge \
39+
&& pip install torch-scatter -f https://data.pyg.org/whl/torch-1.10.1+cpu.html torch-sparse -f https://data.pyg.org/whl/torch-1.10.1+cpu.html torch-geometric \
40+
&& pip install torch-points-kernels --no-cache \
41+
&& pip install torch torchvision \
42+
&& conda install -y pyg==2.0.3 -c pytorch -c pyg -c conda-forge
43+
44+
# the entrypoint garanty that all command will be runned in the conda environment
45+
ENTRYPOINT ["conda", \
46+
"run", \
47+
"-n", \
48+
"lidar_multiclass"]
49+
50+
CMD ["python", \
51+
"-m", \
52+
"lidar_multiclass.predict", \
53+
"--config-path", \
54+
"/CICD_github_assets/parametres_etape1/.hydra", \
55+
"--config-name", \
56+
"predict_config_V1.6.3.yaml", \
57+
"predict.src_las=/CICD_github_assets/parametres_etape1/test/792000_6272000_subset_buildings.las", \
58+
"predict.output_dir=/CICD_github_assets/output_etape1", \
59+
"predict.resume_from_checkpoint=/CICD_github_assets/parametres_etape1/checkpoints/epoch_033.ckpt", \
60+
"predict.gpus=0", \
61+
"datamodule.batch_size=10", \
62+
"datamodule.subtile_overlap=0", \
63+
"hydra.run.dir=/lidar"]
64+

lidar_multiclass/predict.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def predict(config: DictConfig) -> str:
6262

6363
@hydra.main(config_path="../configs/", config_name="config.yaml")
6464
def main(config: DictConfig):
65-
f"""See function {predict.__name__}.
65+
"""See function predict
6666
6767
:meta private:
6868

setup.cfg

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[metadata]
2+
project_name = "Segmentation Validation Model"
3+
author = "Charles GAYDON"
4+
contact = "charles.gaydon@gmail.com"
5+
license_file = LICENSE
6+
description_file = README.md
7+
8+
9+
[isort]
10+
line_length = 99
11+
profile = black
12+
filter_files = True
13+
14+
15+
[flake8]
16+
max_line_length = 99
17+
show_source = True
18+
format = pylint
19+
ignore =
20+
F401 # Module imported but unused
21+
W504 # Line break occurred after a binary operator
22+
F841 # Local variable name is assigned to but never used
23+
F403 # from module import *
24+
E501 # Line too long
25+
E741 # temp ignore
26+
F405 # temp ignore
27+
W503 # temp ignore
28+
F811 # temp ignore
29+
E266 # temp ignore
30+
E262 # temp ignore
31+
W605 # temp ignore
32+
E722 # temp ignore
33+
F541 # temp ignore
34+
W291 # temp ignore
35+
E401 # temp ignore
36+
E402 # temp ignore
37+
W293 # temp ignore
38+
39+
exclude =
40+
.git
41+
__pycache__
42+
data/*
43+
tests/*
44+
notebooks/*
45+
logs/*
46+
/home/MDaab/.local/lib/python3.9/
47+
/home/MDaab/anaconda3/
48+
49+
[tool:pytest]
50+
python_files = tests/*
51+
log_cli = True
52+
markers =
53+
slow
54+
addopts =
55+
--durations=0
56+
--strict-markers
57+
--doctest-modules
58+
filterwarnings =
59+
ignore::DeprecationWarning
60+
ignore::UserWarning

0 commit comments

Comments
 (0)