Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
51bd6ba1
Commit
51bd6ba1
authored
3 years ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
added profiling command
parent
3e1136a0
Branches
master
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+20
-2
20 additions, 2 deletions
README.md
scodoc.py
+24
-0
24 additions, 0 deletions
scodoc.py
with
44 additions
and
2 deletions
README.md
+
20
−
2
View file @
51bd6ba1
...
...
@@ -107,7 +107,7 @@ Ou avec couverture (`pip install pytest-cov`)
#### Utilisation des tests unitaires pour initialiser la base de dev
On peut aussi utiliser les tests unitaires pour mettre la base
de données de développement dans un état connu, par exemple pour éviter de
recréer à la main étudian
s
t et semestres quand on développe.
recréer à la main étudiant
s
et semestres quand on développe.
Il suffit de positionner une variable d'environnement indiquant la BD utilisée par les tests:
...
...
@@ -151,7 +151,25 @@ Si la base utilisée pour les dev n'est plus en phase avec les scripts de
migration, utiliser les commandes
`flask db history`
et
`flask db stamp`
pour se
positionner à la bonne étape.
# Paquet debian 11
### Profiling
Sur une machine de DEV, lancer
flask profile --host 0.0.0.0 --length 32 --profile-dir /opt/scodoc-data
le fichier
`.prof`
sera alors écrit dans
`/opt/scoidoc-data`
(on peut aussi utiliser
`/tmp`
).
Pour la visualisation,
[
snakeviz
](
https://jiffyclub.github.io/snakeviz/
)
est bien:
pip install snakeviz
puis
snakeviz -s --hostname 0.0.0.0 -p 5555 /opt/scodoc-data/GET.ScoDoc......prof
# Paquet Debian 11
Les scripts associés au paquet Debian (.deb) sont dans
`tools/debian`
. Le plus
important est
`postinst`
qui se charge de configurer le système (install ou
...
...
This diff is collapsed.
Click to expand it.
scodoc.py
+
24
−
0
View file @
51bd6ba1
...
...
@@ -329,3 +329,27 @@ def recursive_help(cmd, parent=None):
@app.cli.command
()
def
dumphelp
():
recursive_help
(
app
.
cli
)
@app.cli.command
()
@click.option
(
"
-h
"
,
"
--host
"
,
default
=
"
127.0.0.1
"
,
help
=
"
The interface to bind to.
"
)
@click.option
(
"
-p
"
,
"
--port
"
,
default
=
5000
,
help
=
"
The port to bind to.
"
)
@click.option
(
"
--length
"
,
default
=
25
,
help
=
"
Number of functions to include in the profiler report.
"
,
)
@click.option
(
"
--profile-dir
"
,
default
=
None
,
help
=
"
Directory where profiler data files are saved.
"
)
def
profile
(
host
,
port
,
length
,
profile_dir
):
"""
Start the application under the code profiler.
"""
from
werkzeug.middleware.profiler
import
ProfilerMiddleware
from
werkzeug.serving
import
run_simple
app
.
wsgi_app
=
ProfilerMiddleware
(
app
.
wsgi_app
,
restrictions
=
[
length
],
profile_dir
=
profile_dir
)
run_simple
(
host
,
port
,
app
,
use_debugger
=
False
)
# use run_simple instead of app.run()
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