parsa-epfl / qflex

Quick & Flexible Rack-Scale Computer Architecture Simulator
http://qflex.epfl.ch/
31 stars 10 forks source link

Captain script is not compatible with python3 #28

Closed Hnefi closed 10 months ago

Hnefi commented 3 years ago

The set of scripts in /path/to/qflex/scripts/captain uses statements and features that are specific to python 2. At some point, we should go over this and make it portable so that it can work no matter the host OS.

An example error (when running on Ubuntu 20.04LTS, with default system python 3.8) is:

./captain -p /path/to/captain/system.ini

Traceback (most recent call last):
  File "/home/hnefi/parsa/qflex_clean/scripts/captain/qfsystem.py", line 257, in exit
    self.cleanup()
  File "/home/hnefi/parsa/qflex_clean/scripts/captain/qfsystem.py", line 276, in cleanup
    i.cleanup()
  File "/home/hnefi/parsa/qflex_clean/scripts/captain/qfinstance.py", line 349, in cleanup
    if psutil.pid_exists(self.__pid):
  File "/usr/local/lib/python3.8/dist-packages/psutil/__init__.py", line 1395, in pid_exists
    if pid < 0:
TypeError: '<' not supported between instances of 'NoneType' and 'int'

For now this can be low priority because it is a trivial workaround to install python2 and invoke the script as follows:

python2 captain -p /path/to/captain/system.ini