Changeset 13205 for main/waeup.uniben/trunk/src
- Timestamp:
- 21 Aug 2015, 13:44:03 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/scripts.py
r13204 r13205 127 127 128 128 129 def get_mem_info(): 130 """Get current memory info. 131 132 This works only, if `psutil` is installed locally (in virtualenv). 133 Otherwise we return `None`. 134 """ 135 try: 136 # late import. We do not want to make it a waeup.uniben dependency. 137 import psutil 138 except ImportError: 139 return 140 proc = psutil.Process(os.getpid()) 141 return proc.get_memory_info().rss 142 143 129 144 def export_part(container, part_num, start, end, path): 130 import psutil # late import. Don't want to make it waeup.uniben req.131 PROC = psutil.Process(os.getpid())132 145 gc.collect() 133 mem1 = PROC.get_memory_info().rss146 mem1 = get_mem_info() 134 147 print(" Export %s-%s to %s (mem: %s)" % (start, end, path, mem1)) 135 148 tp1 = time.time() … … 137 150 exporter.export(get_all_students(container, start, end), path) 138 151 tp2 = time.time() 139 mem2 = PROC.get_memory_info().rss152 mem2 = get_mem_info() 140 153 print(" Done (%s secs, mem: %s)" % (tp2 - tp1, mem2)) 141 154
Note: See TracChangeset for help on using the changeset viewer.