Il y a 389 articles et 19 utilisateurs inscrits (ce bandeau est défini dans MediaWiki:Sitenotice)
Migration des scripts de pré-traitement (eole2 → eole3)
Migration des scripts de pré-traitement (eole2 → eole3)
Objectif
Adapter les scripts historiques pour fonctionner sur :
- Ubuntu 24
- Python 3
- Java 17
- stockage ZFS
---
1. Installation des dépendances
apt update
apt install -y openjdk-17-jdk-headless python3 imagemagick libvips-tools 2to3
---
2. Migration Python
Sauvegarde
cp pretraitement_images_plus.py pretraitement_images_plus.py.py2
cp pretraitement_images.py pretraitement_images.py.py2
Conversion
2to3 -w pretraitement_images_plus.py
2to3 -w pretraitement_images.py
Validation
python3 -m py_compile pretraitement_images_plus.py
python3 -m py_compile pretraitement_images.py
---
3. Mise en place des wrappers
Wrapper Java
/home/ajlsm/bin/java-pretraitement
Contenu :
#!/usr/bin/env bash
exec /usr/bin/java "$@"
---
Wrapper Python
/home/ajlsm/bin/python
Contenu :
#!/usr/bin/env bash
exec /usr/bin/python3 "$@"
---
4. Configuration PATH
export PATH=/home/ajlsm/bin:/usr/local/bin:/usr/bin:/bin
Cron :
SHELL=/bin/bash
PATH=/home/ajlsm/bin:/usr/local/bin:/usr/bin:/bin
---
5. Migration des chemins (ZFS)
Changement majeur
Avant (eole2) :
/var/data/<client>-data/pleade/images
Après (eole3) :
/var/data/<client>-data/data/pleade/images
---
6. Tests de fonctionnement
Vérification des binaires
which java
which python
which convert
which identify
which vips
---
Test Python
python pretraitement_images_plus.py --help
---
Test Java
java-pretraitement -jar ImagePretraitement.jar
---
7. Exécution complète
java-pretraitement -jar ImagePretraitement.jar \
pretraitement_images_plus.py \
'<SOURCE>' \
<DESTINATION> \
'hidef' \
true \
true \
<LOGFILE> \
10
---
8. Validation
- Code retour : 0
- Logs générés
- Images produites
---
9. Problèmes connus
Images illisibles
Erreur :
identify: unable to open image
Cause :
- fichier absent
- mauvais format
- extension incorrecte
---
Faux JPEG
Erreur :
Not a JPEG file: starts with 0xd0 0xcf
Cause :
- fichier non image (souvent PDF ou DOC renommé)
---
10. Points d’attention
- Ne pas installer :
apt install python-is-python3
- Ne pas utiliser Java 7
- Conserver les scripts Python 2 originaux
---
Conclusion
La chaîne complète fonctionne désormais sur eole3 :
- Java 17 ✔
- Python 3 ✔
- ImageMagick ✔
- VIPS ✔
- ZFS ✔