Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blkio_ticks is not supported in solaris based system. (ret['blkio_ticks'] = fields[39] # aka 'delayacct_blkio_ticks') #2415

Open
Adel-Magebinary opened this issue May 10, 2024 · 0 comments

Comments

@Adel-Magebinary
Copy link

Summary

  • OS: SmartOs
  • Architecture:64bits
  • Psutil version: pip
  • Python version: python3
  • Type: { core}

Description

We run smartos and blkio_ticks is not supported in the OS. There should be a validation of each supported modules before adding into the object.

psutil/_pslinux.py   line 
        ret = {}
        ret['name'] = name
        ret['status'] = fields[0]
        ret['ppid'] = fields[1]
        ret['ttynr'] = fields[4]
        ret['utime'] = fields[11]
        ret['stime'] = fields[12]
        ret['children_utime'] = fields[13]
        ret['children_stime'] = fields[14]
        ret['create_time'] = fields[19]
        ret['cpu_num'] = fields[36]
        ret['blkio_ticks'] = fields[39]  # aka 'delayacct_blkio_ticks'

# Suggestions
blkio_ticks = get_list_value_by_index(fields, 39)

Problematic code above and error below:

memory = memory_info(psutil.Process(os.getpid()))

File "/usr/local/lib/python3.9/dist-packages/psutil/init.py", line 323, in init
self._init(pid)
File "/usr/local/lib/python3.9/dist-packages/psutil/init.py", line 359, in _init
self.create_time()
File "/usr/local/lib/python3.9/dist-packages/psutil/init.py", line 752, in create_time
self._create_time = self._proc.create_time()
File "/usr/local/lib/python3.9/dist-packages/psutil/_pslinux.py", line 1714, in wrapper
return fun(self, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/psutil/_pslinux.py", line 1945, in create_time
ctime = float(self._parse_stat_file()['create_time'])
File "/usr/local/lib/python3.9/dist-packages/psutil/_pslinux.py", line 1714, in wrapper
return fun(self, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/psutil/_common.py", line 497, in wrapper
raise raise_from(err, None)
File "", line 3, in raise_from
File "/usr/local/lib/python3.9/dist-packages/psutil/_common.py", line 495, in wrapper
return fun(self)
File "/usr/local/lib/python3.9/dist-packages/psutil/_pslinux.py", line 1796, in _parse_stat_file
ret['blkio_ticks'] = fields[39] # aka 'delayacct_blkio_ticks'
IndexError: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant