esmf-org/esmf-profiler

Docker run fails

Closed this issue · 2 comments

Describe the bug

After manually fixing the docker build issue (removing the -b argument to git clone), the docker run command fails:

(venv) rocky@rocky-Latitude-E5570:~/esmfdev/esmf-profiler.v1/tests/fixtures/test-traces$ docker run -it -v $(pwd):/home/traces esmf-profiler-image esmf-profiler -t /home/traces/atm-ocn -n 'atm-ocn-test' -o /home/traces/output
Traceback (most recent call last):
  File "/usr/local/bin/esmf-profiler", line 33, in <module>
    sys.exit(load_entry_point('profiler', 'console_scripts', 'esmf-profiler')())
  File "/usr/local/bin/esmf-profiler", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/esmf-profiler/src/profiler/main.py", line 16, in <module>
    from profiler.analyses import LoadBalance
  File "/home/esmf-profiler/src/profiler/analyses.py", line 1, in <module>
    from profiler.event import TraceEvent, DefineRegion, RegionProfile
  File "/home/esmf-profiler/src/profiler/event.py", line 3, in <module>
    import bt2
ModuleNotFoundError: No module named 'bt2'

To Reproduce
Run the "docker run" command in the quick start.

Expected behavior
The "docker run" should succeed.

The issue seems to be that in the Dockerfile this path is hardcoded:

# TODO 
# Set envs for Python and LD_Library
ENV PYTHONPATH="/home/esmf-profiler/dependencies/INSTALL/babeltrace2-2.0.4/lib/python3.9/site-packages:$PYTHONPATH"

However, in the container itself, the real path is under python 3.8:

root@8a171f26a81f:/home/esmf-profiler# ls /home/esmf-profiler/dependencies/INSTALL/babeltrace2-2.0.4/lib/python3.9/site-packages
ls: cannot access '/home/esmf-profiler/dependencies/INSTALL/babeltrace2-2.0.4/lib/python3.9/site-packages': No such file or directory
root@8a171f26a81f:/home/esmf-profiler# ls /home/esmf-profiler/dependencies/INSTALL/babeltrace2-2.0.4/lib/python3.8/site-packages    
bt2  bt2-2.0.4-py3.8.egg-info

If the version of python3 is not exactly specified in the docker build, then it could evolve as the Ubuntu base image evolves. Therefore we should probably use the find command to locate the installation directory. Either that or force the container to always install Python3.X so we can use it reliably in the path.

I see where the Dockerfile has python3.9 specified.

This goes hand in hand with #55 where we need to control the version of Python that is installed.