Skip to content

Commit

Permalink
FIX - windows compatibility
Browse files Browse the repository at this point in the history
* makes resource module optional
  • Loading branch information
achim1 committed Nov 5, 2022
1 parent e01d368 commit cf3254e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hepbasestack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
Miscellaneous tools
"""

__version__ = '0.1.6'
__version__ = '0.1.7'
__all__ = ["visual","itools","logger", "colors", "layout"]

import resource
import sys
if sys.platform == 'linux':
import resource
import concurrent.futures as fut
import tqdm
import time
Expand Down Expand Up @@ -73,8 +75,9 @@ def wrapper(*args,**kwargs):
left_seconds = int(res_seconds)%60
Logger.info('Execution of {0} took {1} hours, {2} mins and {3} seconds'.format(func.__name__, hours, mins, left_seconds))
Logger.info('Execution of {0} took {1} seconds'.format(func.__name__,seconds))
max_mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
Logger.info('Execution might have needed {0} kB in memory (highly uncertain)!'.format(max_mem))
if sys.platform == 'linux':
max_mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
Logger.info('Execution might have needed {0} kB in memory (highly uncertain)!'.format(max_mem))
return res

return wrapper
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ numpy>=1.18.4
tqdm>=4.46
matplotlib>=3.2.1
seaborn>=0.10.1
resource>=0.2.1 and sys_platform="linux"

0 comments on commit cf3254e

Please sign in to comment.