RFC • Description • Owner • Docs
Tools for OpenPecha's use of Prodigy
Instance_Name.service
file (service unit file used by systemd)Instance_Name.json
file (Prodigy configuration file)Instance_Name.conf
file (Nginx web server configuration file)Instance_Name_recipe.py
(Instance's prodigy recipe file in .py)Create Instance recipe to stream images to the Prodigy web application.
prodigy-tools/recipe/
return {
"dataset": dataset,
"stream": stream_from_s3(obj_keys),
"view_id": "image_manual",
"config": {
"labels": ["PAGE"]
}
}
dataset
: Name of the dataset (bdrc-crop
)stream
: Yield image's s3 key or image URLview_id
: image_manual
for annotating imageslabels
: List of labels to annotate on the imageCreate Prodigy configuration JSON file.
prodigy-tools/configuration/
"db_settings": {
"sqlite": {
"name": "bdrc_crop_images.sqlite",
"path": "/usr/local/prodigy"
}
}
name
: Name of the SQLite file where the annotations are savedpath
: Path to where the SQLite file should be savedCreate .service
file to be used by Systemd, a system and service manager for Linux OS.
/etc/systemd/system/
Environment=PRODIGY_CONFIG="/usr/local/prodigy/prodigy-tools/configuration/bdrc_crop_images.json"
Environment=PRODIGY_CONFIG
: Path to the Prodigy configuration JSON file
ExecStart=/usr/bin/python3.9 -m prodigy bdrc-crop-images-recipe bdrc_crop '/usr/local/prodigy/prodigy-tools/data/page_cropping.csv' -F /usr/local/prodigy/prodigy-tools/recipes/bdrc_crop_images.py
bdrc-crop-images-recipe
: Name of the recipe from the recipe.pybdrc_crop
: Name of the dataset'/usr/local/prodigy/prodigy-tools/data/page_cropping.csv'
: Path to the data input source/usr/local/prodigy/prodigy-tools/recipes/bdrc_crop_images.py
: Path to instance recipe .py fileCreate Nginx configuration .conf
.
/etc/nginx/sites-enabled/
upstream prodigyimages {
server localhost:8090 fail_timeout=20s;
keepalive 32;
}
To test niginx configuration
command : sudo nginx -t
To restart the nginx (only needs to when .conf has been updated or changed)
command : sudo service nginx restart
To start the instance with service file
command :
sudo systemctl daemon-reload
sudo systemctl restart name_of_service_file.service
To check the log of the instance
command : sudo journalctl -u name_of_service_file.service
To stop the instance from running
command : sudo systemctl stop name_of_service_file.service
To git pull the changes from the prodigy-tools to the server
command : sudo -u prodigy git pull
at /usr/local/prodigy/prodigy-tools/