OtterBots / capstone_stoqs

CSUMB Otterbots capstone project.
1 stars 0 forks source link

media-files or media? #75

Open MBARIMike opened 1 year ago

MBARIMike commented 1 year ago

Looks like a configuration issue with local.yml during test with customer:

stoqs            | FERROR 2023-07-28 02:44:06,551 plotting.py _make_image():654 Could not plot the data
stoqs            | Traceback (most recent call last):
stoqs            |   File "/srv/stoqs/loaders/../utils/Viz/plotting.py", line 651, in _make_image
stoqs            |     fig.savefig(sectionPngFileFullPath, dpi=120, transparent=True)
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/figure.py", line 3343, in savefig
stoqs            |     self.canvas.print_figure(fname, **kwargs)
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/backend_bases.py", line 2366, in print_figure
stoqs            |     result = print_method(
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/backend_bases.py", line 2232, in <lambda>
stoqs            |     print_method = functools.wraps(meth)(lambda *args, **kwargs: meth(
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/backends/backend_agg.py", line 509, in print_png
stoqs            |     self._print_pil(filename_or_obj, "png", pil_kwargs, metadata)
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/backends/backend_agg.py", line 458, in _print_pil
stoqs            |     mpl.image.imsave(
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/matplotlib/image.py", line 1689, in imsave
stoqs            |     image.save(fname, **pil_kwargs)
stoqs            |   File "/usr/local/lib/python3.10/dist-packages/PIL/Image.py", line 2429, in save
stoqs            |     fp = builtins.open(filename, "w+b")
stoqs            | FileNotFoundError: [Errno 2] No such file or directory: '/srv/stoqs/media/sections/1_None_dorado_VNCUSV4Z4I.png'
itsOwlbit commented 1 year ago

@MBARIMike

I removed some persisting folders that masked this error so that I can replicate it.

When changing in base.py media-files to media:

MEDIA_ROOT = str(APPS_DIR / "media")

The sections folder is not created due production=false in local.py (and local-ci-py)?

if [ "$PRODUCTION" == "true" ]; then
   echo "Checking for presence of ${MEDIA_ROOT}/sections..."
   if [[ ! -e ${MEDIA_ROOT}/sections ]]; then
       echo "Creating directories for image generation and serving by nginx..."
       mkdir -p ${MEDIA_ROOT}/sections ${MEDIA_ROOT}/parameterparameter
       chmod 733 ${MEDIA_ROOT}/sections ${MEDIA_ROOT}/parameterparameter
   fi
fi

Even if I get it so /srv/stoqs/media/selections directory does exist, no images are being stored in the folder. I am not sure where this happens. I don't know what we did before to have the media file created and have the images we need previously. Any hints?

MBARIMike commented 1 year ago

The local.yml file specifies media-files. Could this be the issue?

itsOwlbit commented 1 year ago

I tried changing those, but it doesn't seem to fix the problem. When production=false, even the sections folder is not made. Somewhere the images are generated and stored into the srv/media/sections (I think). It can possibly be a path issue or because we have production set to false with nginx disabled. I don't know enough about the stoqs project setup to be able to make that determination. If the team and I had more time, perhaps we could have explored and found the solution. Unfortunately, making major changes might break more than fix. I added a page under Testing documents for known issues.