nkanderson / ECE585-llc

Simulation of a last level cache (LLC) for ECE 585 final project
1 stars 0 forks source link

Docker Container Python Module Import Issues #26

Open reecewayt opened 10 hours ago

reecewayt commented 10 hours ago

@nkanderson I'm curious what you think the best solution is for an issue I'm running into.

The current Docker container setup is causing Python module import issues when trying to run the file_parser. When attempting to run modules from within the container, I get import errors:

llcsim@315fe12212d7:~$ python -m utils.trace_parser
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/llcsim/utils/trace_parser.py", line 6, in <module>
    from src.config.project_config import ROOT_DIR, DEFAULT_TRACE_FILE
ModuleNotFoundError: No module named 'src'

The current Dockerfile only copies the src directory contents to /home/llcsim/ so the complete project structure is not maintained. The easy fix of course would be for me to change the library import from src.config.project_config -> config.project_config but I'm curious what you think is the best practice here since I'm new to docker.

nkanderson commented 7 hours ago

Yeah, I think probably removing src. makes the most sense. That would mean it's still fine to run on the host machine as long as you're running from inside the src directory, I believe.

We should also decide if we want to create a separate data directory for trace.txt and rwins.din, and add that to the Docker image as well or add it inside the src directory (which would mean it would end up in the image), or some other option.