Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Script recalcul calque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ERASME
Script recalcul calque
Commits
27707892
Commit
27707892
authored
2 years ago
by
Pierre-Gilles Levallois
Browse files
Options
Downloads
Patches
Plain Diff
First try : launch init scripts
parent
cd38ebc4
Branches
Branches containing commit
Tags
v1.3.0
Tags containing commit
1 merge request
!3
Launch script
Pipeline
#44321
passed
2 years ago
Stage: Build Calqul
Stage: Deploy Calqul
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+3
-3
3 additions, 3 deletions
.gitlab-ci.yml
Dockerfiles/python/scripts/launch.sh
+80
-7
80 additions, 7 deletions
Dockerfiles/python/scripts/launch.sh
with
83 additions
and
10 deletions
.gitlab-ci.yml
+
3
−
3
View file @
27707892
...
@@ -92,7 +92,7 @@ Build Calqul Python:
...
@@ -92,7 +92,7 @@ Build Calqul Python:
-
*set_env
-
*set_env
-
*build_and_push_image
-
*build_and_push_image
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"
develop
"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"
launch-script
"'
changes
:
# build image only if sources have changed.
changes
:
# build image only if sources have changed.
-
Dockerfiles/python/Dockerfile
# Image definition has changed
-
Dockerfiles/python/Dockerfile
# Image definition has changed
-
Dockerfiles/python/scripts/*
# Python scripts have changed
-
Dockerfiles/python/scripts/*
# Python scripts have changed
...
@@ -115,7 +115,7 @@ Build Calqul Postgis:
...
@@ -115,7 +115,7 @@ Build Calqul Postgis:
-
cd $IMAGE_DIR
-
cd $IMAGE_DIR
-
*build_and_push_image
-
*build_and_push_image
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"
develop
"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"
launch-script
"'
changes
:
# build image only if sources have changed.
changes
:
# build image only if sources have changed.
-
Dockerfiles/db/**/*
# db scripts have changed
-
Dockerfiles/db/**/*
# db scripts have changed
-
.gitlab-ci.yml
-
.gitlab-ci.yml
...
@@ -136,7 +136,7 @@ Deploy Calqul:
...
@@ -136,7 +136,7 @@ Deploy Calqul:
script
:
script
:
-
*apply_confs
-
*apply_confs
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"
develop
"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"
launch-script
"'
tags
:
tags
:
#- ns-arb-d01 @TODO : Change after when the right namespace is available
#- ns-arb-d01 @TODO : Change after when the right namespace is available
-
ns-test-d01
# No possibility to put varaibles here :(
-
ns-test-d01
# No possibility to put varaibles here :(
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Dockerfiles/python/scripts/launch.sh
+
80
−
7
View file @
27707892
#!/bin/bash
#!/bin/bash
################################################################################
# ARB : Lancement du recalcul des indices du calque de plantabilité.
# ARB : Lancement du recalcul des indices du calque de plantabilité.
#
#
###############################################################################
# screen -dmS calque_metro python3 main.py computeAll 5
DATA_REPO
=
"https://forge.grandlyon.com/erasme/data-recalcul-calque.git"
python3 main.py initCommunes
scripts_dir
=
"/app"
data_dir
=
"/arb-data/source-files/data-recalcul-calque"
stage
=
1
line
=
"
\e
[39m-----------------------------------------------"
need_update
=
1
sleep
300
################################################################################
# functions
################################################################################
# python3 main.py initGrid
#---------------------------------------------------------------
# python3 main.py initDatas
# Functions
#---------------------------------------------------------------
# Logging
stage
()
{
echo
-e
$line
echo
-e
"
\e
[96m
$stage
.
$1
\e
[39m"
echo
-e
$line
stage
=
$((
stage+1
))
}
# Formatting log line
comment
()
{
echo
-e
"
\e
[39m
\t
->
$1
\e
[39m"
}
# Check the last command return code (must be insterted just after the commend )
check
()
{
if
[
$?
-eq
0
]
;
then
comment
"
\e
[32mOk.
\e
[39m"
else
comment
"
\e
[31mERROR !...
\e
[39m"
exit
1
fi
;
}
################################################################################
mkdir
-p
$data_dir
stage
"Check source files in
$data_dir
"
cd
$data_dir
current_commit
=
$(
git rev-parse
--short
HEAD
)
if
[
$?
-eq
128
]
;
then
comment
"Data repository is empty. Is this your first time, young Padawan ?"
comment
"Cloning repo, it can take a while..."
cd
..
git clone
$DATA_REPO
need_update
=
0
else
comment
"Current commit is
$current_commit
"
cd
$data_dir
fi
;
# Checking for update...
[
$(
git rev-parse HEAD
)
=
$(
git ls-remote
$(
git rev-parse
--abbrev-ref
@
{
u
}
|
sed
's/\// /g'
)
|
cut
-f1
)
]
&&
need_update
=
0
||
need_update
=
1
if
[
$need_update
-eq
0
]
;
then
# We are up to date
comment
"
\e
[32mData are up to date."
else
comment
"
\e
[93mNew version of source data is available !
\e
[39m"
git pull origin main
new_commit
=
$(
git rev-parse
--short
HEAD
)
comment
"New commit is :
\e
[93m'
$new_commit
'
\e
[39m"
git diff
--compact-summary
$current_commit
$new_commit
fi
;
stage
"Launch computations..."
cd
$scripts_dir
comment
"Init communes"
python main.py initCommunes
python3 main.py initGrid
python3 main.py initDatas
# Multiprocessing task
# Multiprocessing task
# python3 main.py computeFactors
# python3 main.py computeFactors
...
@@ -16,4 +86,7 @@ sleep 300
...
@@ -16,4 +86,7 @@ sleep 300
# python3 main.py computeIndices
# python3 main.py computeIndices
# Launching everything, it is possible to give a list of township
# Launching everything, it is possible to give a list of township
# python3 main.py computeAll
# python3 main.py computeAll
\ No newline at end of file
stage
"Sleeping a while for debug purpose..."
sleep
300
\ No newline at end of file
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