Test for BlueYonder to demonstrate programming knowledge
This tool works as an image relay, downloading a specified list of Images from any valid URL into a local folder
and keeping it in sync by repeated re-downloading every 5 Minutes.
The output folder is
static/images and will contain all successful downloads.
Every image will be renamed to contain its original source to prevent images with the same name from different source to overwrite each other.
The tool works as a daemon and can run indefinitely. To exit it, send any character to its STDIN.
This project is written in Python and needs a Python environment to be functional.
Python 3.3 or above is required.
Depending packages are listed in
requirements.txt and can be installed using pythons
pip tool like so:
pip install -r requirements
This tool can additionally be deployed via Docker, which requires a working Docker environment and access to it.
If this deployment is chosen no further requirements are necessary.
The only configuration parameter available is the list of URLs to be downloaded.
conf folder contains a list of example URLs, some working, some not to show the possibilities.
Each image to be downloaded has to be specified on a new line separated by either
\n (Unix/Linux) or
Two methods of deployment are supported:
- local Python
To run the tool using your local Python interpreter, either install the dependencies in the global scope (will probably need superuser permission)
or facilitate a virtual environment tool of your choice,
virtualenv will work as an example.
A valid startup using
virtualenv looks like this:
virtualenv env source env/bin/activate python bin/main.py deactivate
Either build the Docker image yourself or use the provided image from dockerhub:
For the application to be useful, at least the image folder has to be exposed to the environment, this can be achieved using this run command:
docker run -v $YOURIMAGEDIR:/app/static/images joesane/blueyonder-test
To have a look at the log files produced, you can expose the log folder as well:
docker run -v $YOURIMAGEDIR:/app/static/images -v $YOURLOGDIR:/app/logs joesane/blueyonder-test