Skip to content

Commit

Permalink
FIX-modin-project#2465: Disable open files tracking on Windows due to…
Browse files Browse the repository at this point in the history
… psutil limitation

Signed-off-by: Vasilij Litvinov <vasilij.n.litvinov@intel.com>
  • Loading branch information
vnlitvinov committed Dec 7, 2020
1 parent 5b9b9a7 commit a17901a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions modin/config/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# governing permissions and limitations under the License.

import os
import sys
from textwrap import dedent
import warnings
from packaging import version
Expand Down Expand Up @@ -208,6 +209,18 @@ class TestDatasetSize(EnvironmentVariable, type=str):
choices = ("Small", "Normal", "Big")


class TrackFileLeaks(EnvironmentVariable, type=bool):
"""
Whether to track for open file handles leakage during testing
"""

varname = "MODIN_TEST_TRACK_FILE_LEAKS"
# Turn off tracking on Windows by default because
# psutil's open_files() can be extremely slow on Windows (up to adding a few hours).
# see https://github.com/giampaolo/psutil/pull/597
default = sys.platform != "win32"


def _check_vars():
"""
Look out for any environment variables that start with "MODIN_" prefix
Expand Down
4 changes: 3 additions & 1 deletion modin/pandas/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
import modin.pandas as pd
from modin.utils import to_pandas
from modin.config import TestDatasetSize
from modin.config import TestDatasetSize, TrackFileLeaks
from io import BytesIO
import os
from string import ascii_letters
Expand Down Expand Up @@ -1018,6 +1018,8 @@ def check_file_leaks(func):
A decorator that ensures that no *newly* opened file handles are left
after decorated function is finished.
"""
if not TrackFileLeaks.get():
return func

@functools.wraps(func)
def check(*a, **kw):
Expand Down

0 comments on commit a17901a

Please sign in to comment.