File tree Expand file tree Collapse file tree 5 files changed +10
-30
lines changed Expand file tree Collapse file tree 5 files changed +10
-30
lines changed Original file line number Diff line number Diff line change 1
- import platform
2
1
import random
3
2
from functools import partial
4
3
@@ -595,7 +594,6 @@ def test_array_pickle(spec, executor):
595
594
assert_array_equal (c .compute (executor = executor ), expected )
596
595
597
596
598
- @pytest .mark .skipif (platform .system () == "Windows" , reason = "does not run on windows" )
599
597
def test_measure_reserved_mem (executor ):
600
598
pytest .importorskip ("lithops" )
601
599
Original file line number Diff line number Diff line change 1
1
import contextlib
2
2
import os
3
- import platform
4
3
import re
5
4
6
5
import fsspec
@@ -72,9 +71,6 @@ def mock_apply_blockwise(*args, **kwargs):
72
71
73
72
74
73
# see tests/runtime for more tests for retries for other executors
75
- @pytest .mark .skipif (
76
- platform .system () == "Windows" , reason = "measuring memory does not run on windows"
77
- )
78
74
def test_retries (mocker , spec ):
79
75
# Use threads executor since single-threaded executor doesn't support retries
80
76
executor = create_executor ("threads" )
@@ -91,9 +87,6 @@ def test_retries(mocker, spec):
91
87
)
92
88
93
89
94
- @pytest .mark .skipif (
95
- platform .system () == "Windows" , reason = "measuring memory does not run on windows"
96
- )
97
90
def test_callbacks (spec , executor ):
98
91
task_counter = TaskCounter ()
99
92
# test following indirectly by checking they don't cause a failure
@@ -149,9 +142,6 @@ def test_callbacks_modal(spec, modal_executor):
149
142
fs .rm (tmp_path , recursive = True )
150
143
151
144
152
- @pytest .mark .skipif (
153
- platform .system () == "Windows" , reason = "measuring memory does not run on windows"
154
- )
155
145
def test_mem_warn (tmp_path , executor ):
156
146
if executor .name not in ("processes" , "lithops" ):
157
147
pytest .skip (f"{ executor .name } executor does not support MemoryWarningCallback" )
Original file line number Diff line number Diff line change 1
1
import inspect
2
2
import itertools
3
- import platform
4
3
5
4
import numpy as np
6
5
import pytest
@@ -92,7 +91,6 @@ def test_memory_repr():
92
91
memory_repr (- 1 )
93
92
94
93
95
- @pytest .mark .skipif (platform .system () == "Windows" , reason = "does not run on windows" )
96
94
def test_peak_measured_mem ():
97
95
assert peak_measured_mem () > 0
98
96
Original file line number Diff line number Diff line change 1
- import platform
2
1
from typing import Iterable
3
2
4
3
import networkx as nx
18
17
"localhost" : {"version" : 1 },
19
18
}
20
19
21
- ALL_EXECUTORS = [create_executor ("single-threaded" )]
20
+ ALL_EXECUTORS = [
21
+ create_executor ("single-threaded" ),
22
+ create_executor ("threads" ),
23
+ create_executor ("processes" ),
24
+ ]
22
25
23
26
# don't run all tests on every executor as it's too slow, so just have a subset
24
- MAIN_EXECUTORS = [create_executor ("single-threaded" )]
25
-
26
-
27
- if platform .system () != "Windows" :
28
- # ThreadsExecutor calls `peak_measured_mem` which is not supported on Windows
29
- ALL_EXECUTORS .append (create_executor ("threads" ))
30
-
31
- ALL_EXECUTORS .append (create_executor ("processes" ))
32
- MAIN_EXECUTORS .append (create_executor ("processes" ))
27
+ MAIN_EXECUTORS = [create_executor ("single-threaded" ), create_executor ("processes" )]
33
28
34
29
try :
35
30
ALL_EXECUTORS .append (create_executor ("beam" ))
Original file line number Diff line number Diff line change @@ -112,13 +112,12 @@ def memory_repr(num: int) -> str:
112
112
113
113
114
114
def peak_measured_mem () -> int :
115
- """Measures the peak memory usage in bytes.
116
-
117
- Note: this function currently doesn't work on Windows.
118
- """
115
+ """Measures the peak memory usage in bytes."""
119
116
120
117
if platform .system () == "Windows" :
121
- raise NotImplementedError ("`peak_measured_mem` is not implemented on Windows" )
118
+ import psutil
119
+
120
+ return psutil .Process ().memory_info ().peak_wset
122
121
123
122
from resource import RUSAGE_SELF , getrusage
124
123
You can’t perform that action at this time.
0 commit comments