Opened 6 years ago

Closed 6 years ago

#21805 closed enhancement (fixed)

Use psutil instead of various hacks

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-7.5
Component: misc Keywords:
Cc: Merged in:
Authors: Jeroen Demeyer Reviewers: Jean-Pierre Flori
Report Upstream: N/A Work issues:
Branch: 9f629df (Commits, GitHub, GitLab) Commit: 9f629df4f3057f9b784959eb5d5e9e5b1fee3c93
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The following modules can mostly replaced by simple calls to psutil:

  • sage.misc.getusage
  • sage.misc.memory_info
  • sage.misc.darwin_utilities

All usage of these modules is replaced by some simple wrappers around psutil. These wrappers are implemented in sage.misc.getusage.

Change History (10)

comment:1 Changed 6 years ago by jdemeyer

  • Component changed from interfaces to misc
  • Description modified (diff)

comment:2 Changed 6 years ago by jdemeyer

  • Description modified (diff)
  • Summary changed from Use psutil instead of sage.misc.memory_info to Use psutil instead of various hacks

comment:3 Changed 6 years ago by jdemeyer

  • Branch set to u/jdemeyer/use_psutil_instead_of_sage_misc_memory_info

comment:4 Changed 6 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Commit set to 46832bc1f68346268a93f5ff249dd0fdde4dc387
  • Status changed from new to needs_review

New commits:

46832bcUse psutil instead of various hacks

comment:5 Changed 6 years ago by jpflori

  • Reviewers set to Jean-Pierre Flori
  • Status changed from needs_review to positive_review

Looks goot to me.

comment:6 Changed 6 years ago by vbraun

  • Status changed from positive_review to needs_work

on OSX:

30617Traceback (most recent call last):
30618  File "/Users/buildslave-sage/slave/sage_git/build/src/bin/sage-eval", line 4, in <module>
30619    from sage.all import *
30620  File "/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/all.py", line 92, in <module>
30621    from sage.misc.all       import *         # takes a while
30622  File "/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/misc/all.py", line 89, in <module>
30623    from .functional import (additive_order,
30624  File "/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/misc/functional.py", line 32, in <module>
30625    from sage.rings.complex_double import CDF
30626  File "sage/rings/integer.pxd", line 7, in init sage.rings.complex_double (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/rings/complex_double.c:23953)
30627  File "sage/rings/rational.pxd", line 8, in init sage.rings.integer (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/rings/integer.c:50744)
30628  File "sage/rings/fast_arith.pxd", line 3, in init sage.rings.rational (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/rings/rational.c:38499)
30629  File "sage/libs/cypari2/gen.pxd", line 5, in init sage.rings.fast_arith (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/rings/fast_arith.c:8557)
30630  File "/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/libs/cypari2/__init__.py", line 1, in <module>
30631    from .pari_instance import pari
30632  File "sage/libs/cypari2/pari_instance.pyx", line 453, in init sage.libs.cypari2.pari_instance (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/libs/cypari2/pari_instance.c:17929)
30633  File "sage/libs/cypari2/pari_instance.pyx", line 517, in sage.libs.cypari2.pari_instance.PariInstance.__init__ (/Users/buildslave-sage/slave/sage_git/build/src/build/cythonized/sage/libs/cypari2/pari_instance.c:11439)
30634  File "/Users/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/misc/getusage.py", line 74, in virtual_memory_limit
30635    vmax = psutil.Process().rlimit(psutil.RLIMIT_AS)[0]
30636AttributeError: 'Process' object has no attribute 'rlimit'
30637Sage failed to start up.
30638Please email sage-devel (http://groups.google.com/group/sage-devel)
30639explaining the problem and send the log file
30640  /Users/buildslave-sage/slave/sage_git/build/logs/start.log
30641Describe your computer, operating system, etc.
30642make[2]: *** [/Users/buildslave-sage/slave/sage_git/build/local/etc/sage-started.txt] Error 1
30643make[1]: *** [start] Error 2

comment:7 Changed 6 years ago by git

  • Commit changed from 46832bc1f68346268a93f5ff249dd0fdde4dc387 to 9f629df4f3057f9b784959eb5d5e9e5b1fee3c93

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

3ffb127Use psutil instead of various hacks
9f629dfUse resource instead of psutil to determine RLIMIT_AS

comment:8 Changed 6 years ago by jdemeyer

  • Status changed from needs_work to needs_review

I reverted this to using resource.getrlimit instead of psutil.

comment:9 Changed 6 years ago by vbraun

  • Status changed from needs_review to positive_review

comment:10 Changed 6 years ago by vbraun

  • Branch changed from u/jdemeyer/use_psutil_instead_of_sage_misc_memory_info to 9f629df4f3057f9b784959eb5d5e9e5b1fee3c93
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.