We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Parallel agents for TeamCity
Right now, TeamCity is taking >5 hours to complete. We should create parallel agents for non-dependent builds to run concurrently. The breakdown should be as follows:

1.	`MODIN_ENGINE=ray`, `MODIN_ENGINE=dask`, `MODIN_ENGINE=python`
a.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameReduction_A`
b.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameReduction_B`
c.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameBinary`
d.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameMapMetadata`
e.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameUDF`
f.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameDefault`
g.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameWindow`
h.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameIndexing`
i.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameIter`
j.	`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameJoinSort`
k.	`python -m pytest modin/pandas/test/test_groupby.py`
l.	`python -m pytest modin/pandas/test/test_series.py modin/pandas/test/test_concat.py modin/pandas/test/test_reshape.py modin/pandas/test/test_general.py modin/pandas/test/test_io.py modin/pandas/test/test_io_exp.py`
2.	`MODIN_ENGINE=ray MODIN_EXPERIMENTAL=True MODIN_BACKEND=pyarrow python -m pytest modin/pandas/test/test_io.py::test_from_csv`

In total, 37 agents. This does not include agents we will need for Windows and MacOS.  


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `modin/pandas/__init__.py`
Content:
```
1 import pandas
2 
3 __pandas_version__ = "1.0.1"
4 
5 if pandas.__version__ != __pandas_version__:
6     import warnings
7 
8     warnings.warn(
9         "The pandas version installed does not match the required pandas version in "
10         "Modin. This may cause undesired side effects!".format(__pandas_version__)
11     )
12 
13 from pandas import (
14     eval,
15     unique,
16     value_counts,
17     cut,
18     to_numeric,
19     factorize,
20     test,
21     qcut,
22     date_range,
23     period_range,
24     Index,
25     MultiIndex,
26     CategoricalIndex,
27     bdate_range,
28     DatetimeIndex,
29     Timedelta,
30     Timestamp,
31     to_timedelta,
32     set_eng_float_format,
33     options,
34     set_option,
35     NaT,
36     PeriodIndex,
37     Categorical,
38     Interval,
39     UInt8Dtype,
40     UInt16Dtype,
41     UInt32Dtype,
42     UInt64Dtype,
43     SparseDtype,
44     Int8Dtype,
45     Int16Dtype,
46     Int32Dtype,
47     Int64Dtype,
48     StringDtype,
49     BooleanDtype,
50     CategoricalDtype,
51     DatetimeTZDtype,
52     IntervalDtype,
53     PeriodDtype,
54     RangeIndex,
55     Int64Index,
56     UInt64Index,
57     Float64Index,
58     TimedeltaIndex,
59     IntervalIndex,
60     IndexSlice,
61     Grouper,
62     array,
63     Period,
64     show_versions,
65     DateOffset,
66     timedelta_range,
67     infer_freq,
68     interval_range,
69     ExcelWriter,
70     datetime,
71     NamedAgg,
72     NA,
73 )
74 import threading
75 import os
76 import types
77 import sys
78 
79 from .. import __version__
80 from .concat import concat
81 from .dataframe import DataFrame
82 from .datetimes import to_datetime
83 from .io import (
84     read_csv,
85     read_parquet,
86     read_json,
87     read_html,
88     read_clipboard,
89     read_excel,
90     read_hdf,
91     read_feather,
92     read_stata,
93     read_sas,
94     read_pickle,
95     read_sql,
96     read_gbq,
97     read_table,
98     read_fwf,
99     read_sql_table,
100     read_sql_query,
101     read_spss,
102     ExcelFile,
103     to_pickle,
104     HDFStore,
105     json_normalize,
106     read_orc,
107 )
108 from .reshape import get_dummies, melt, crosstab, lreshape, wide_to_long
109 from .series import Series
110 from .general import (
111     isna,
112     isnull,
113     merge,
114     merge_asof,
115     merge_ordered,
116     pivot_table,
117     notnull,
118     notna,
119     pivot,
120 )
121 from .plotting import Plotting as plotting
122 from .. import __execution_engine__ as execution_engine
123 
124 # Set this so that Pandas doesn't try to multithread by itself
125 os.environ["OMP_NUM_THREADS"] = "1"
126 num_cpus = 1
127 
128 
129 def initialize_ray():
130     import ray
131 
132     """Initializes ray based on environment variables and internal defaults."""
133     if threading.current_thread().name == "MainThread":
134         import secrets
135 
136         plasma_directory = None
137         cluster = os.environ.get("MODIN_RAY_CLUSTER", None)
138         redis_address = os.environ.get("MODIN_REDIS_ADDRESS", None)
139         redis_password = secrets.token_hex(16)
140         if cluster == "True" and redis_address is not None:
141             # We only start ray in a cluster setting for the head node.
142             ray.init(
143                 include_webui=False,
144                 ignore_reinit_error=True,
145                 redis_address=redis_address,
146                 redis_password=redis_password,
147                 logging_level=100,
148             )
149         elif cluster is None:
150             object_store_memory = os.environ.get("MODIN_MEMORY", None)
151             if os.environ.get("MODIN_OUT_OF_CORE", "False").title() == "True":
152                 from tempfile import gettempdir
153 
154                 plasma_directory = gettempdir()
155                 # We may have already set the memory from the environment variable, we don't
156                 # want to overwrite that value if we have.
157                 if object_store_memory is None:
158                     # Round down to the nearest Gigabyte.
159                     mem_bytes = ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9
160                     # Default to 8x memory for out of core
161                     object_store_memory = 8 * mem_bytes
162             # In case anything failed above, we can still improve the memory for Modin.
163             if object_store_memory is None:
164                 # Round down to the nearest Gigabyte.
165                 object_store_memory = int(
166                     0.6 * ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9
167                 )
168                 # If the memory pool is smaller than 2GB, just use the default in ray.
169                 if object_store_memory == 0:
170                     object_store_memory = None
171             else:
172                 object_store_memory = int(object_store_memory)
173             ray.init(
174                 include_webui=False,
175                 ignore_reinit_error=True,
176                 plasma_directory=plasma_directory,
177                 object_store_memory=object_store_memory,
178                 redis_address=redis_address,
179                 redis_password=redis_password,
180                 logging_level=100,
181                 memory=object_store_memory,
182             )
183         # Register custom serializer for method objects to avoid warning message.
184         # We serialize `MethodType` objects when we use AxisPartition operations.
185         ray.register_custom_serializer(types.MethodType, use_pickle=True)
186 
187         # Register a fix import function to run on all_workers including the driver.
188         # This is a hack solution to fix #647, #746
189         def move_stdlib_ahead_of_site_packages(*args):
190             site_packages_path = None
191             site_packages_path_index = -1
192             for i, path in enumerate(sys.path):
193                 if sys.exec_prefix in path and path.endswith("site-packages"):
194                     site_packages_path = path
195                     site_packages_path_index = i
196                     # break on first found
197                     break
198 
199             if site_packages_path is not None:
200                 # stdlib packages layout as follows:
201                 # - python3.x
202                 #   - typing.py
203                 #   - site-packages/
204                 #     - pandas
205                 # So extracting the dirname of the site_packages can point us
206                 # to the directory containing standard libraries.
207                 sys.path.insert(
208                     site_packages_path_index, os.path.dirname(site_packages_path)
209                 )
210 
211         move_stdlib_ahead_of_site_packages()
212         ray.worker.global_worker.run_function_on_all_workers(
213             move_stdlib_ahead_of_site_packages
214         )
215 
216 
217 if execution_engine == "Ray":
218     import ray
219 
220     initialize_ray()
221     num_cpus = ray.cluster_resources()["CPU"]
222 elif execution_engine == "Dask":  # pragma: no cover
223     from distributed.client import get_client
224     import warnings
225 
226     if threading.current_thread().name == "MainThread":
227         warnings.warn("The Dask Engine for Modin is experimental.")
228         try:
229             client = get_client()
230         except ValueError:
231             from distributed import Client
232             import multiprocessing
233 
234             num_cpus = multiprocessing.cpu_count()
235             client = Client(n_workers=num_cpus)
236 elif execution_engine != "Python":
237     raise ImportError("Unrecognized execution engine: {}.".format(execution_engine))
238 
239 DEFAULT_NPARTITIONS = max(4, int(num_cpus))
240 
241 __all__ = [
242     "DataFrame",
243     "Series",
244     "read_csv",
245     "read_parquet",
246     "read_json",
247     "read_html",
248     "read_clipboard",
249     "read_excel",
250     "read_hdf",
251     "read_feather",
252     "read_stata",
253     "read_sas",
254     "read_pickle",
255     "read_sql",
256     "read_gbq",
257     "read_table",
258     "read_spss",
259     "read_orc",
260     "json_normalize",
261     "concat",
262     "eval",
263     "unique",
264     "value_counts",
265     "cut",
266     "to_numeric",
267     "factorize",
268     "test",
269     "qcut",
270     "to_datetime",
271     "get_dummies",
272     "isna",
273     "isnull",
274     "merge",
275     "pivot_table",
276     "date_range",
277     "Index",
278     "MultiIndex",
279     "Series",
280     "bdate_range",
281     "period_range",
282     "DatetimeIndex",
283     "to_timedelta",
284     "set_eng_float_format",
285     "options",
286     "set_option",
287     "CategoricalIndex",
288     "Timedelta",
289     "Timestamp",
290     "NaT",
291     "PeriodIndex",
292     "Categorical",
293     "__version__",
294     "melt",
295     "crosstab",
296     "plotting",
297     "Interval",
298     "UInt8Dtype",
299     "UInt16Dtype",
300     "UInt32Dtype",
301     "UInt64Dtype",
302     "SparseDtype",
303     "Int8Dtype",
304     "Int16Dtype",
305     "Int32Dtype",
306     "Int64Dtype",
307     "CategoricalDtype",
308     "DatetimeTZDtype",
309     "IntervalDtype",
310     "PeriodDtype",
311     "BooleanDtype",
312     "StringDtype",
313     "NA",
314     "RangeIndex",
315     "Int64Index",
316     "UInt64Index",
317     "Float64Index",
318     "TimedeltaIndex",
319     "IntervalIndex",
320     "IndexSlice",
321     "Grouper",
322     "array",
323     "Period",
324     "show_versions",
325     "DateOffset",
326     "timedelta_range",
327     "infer_freq",
328     "interval_range",
329     "ExcelWriter",
330     "read_fwf",
331     "read_sql_table",
332     "read_sql_query",
333     "ExcelFile",
334     "to_pickle",
335     "HDFStore",
336     "lreshape",
337     "wide_to_long",
338     "merge_asof",
339     "merge_ordered",
340     "notnull",
341     "notna",
342     "pivot",
343     "datetime",
344     "NamedAgg",
345     "DEFAULT_NPARTITIONS",
346 ]
347 
348 del pandas
349
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/modin/pandas/__init__.py b/modin/pandas/__init__.py
--- a/modin/pandas/__init__.py
+++ b/modin/pandas/__init__.py
@@ -75,6 +75,7 @@
 import os
 import types
 import sys
+import multiprocessing
 
 from .. import __version__
 from .concat import concat
@@ -134,12 +135,14 @@
         import secrets
 
         plasma_directory = None
+        num_cpus = os.environ.get("MODIN_CPUS", None) or multiprocessing.cpu_count()
         cluster = os.environ.get("MODIN_RAY_CLUSTER", None)
         redis_address = os.environ.get("MODIN_REDIS_ADDRESS", None)
         redis_password = secrets.token_hex(16)
         if cluster == "True" and redis_address is not None:
             # We only start ray in a cluster setting for the head node.
             ray.init(
+                num_cpus=int(num_cpus),
                 include_webui=False,
                 ignore_reinit_error=True,
                 redis_address=redis_address,
@@ -171,6 +174,7 @@
             else:
                 object_store_memory = int(object_store_memory)
             ray.init(
+                num_cpus=int(num_cpus),
                 include_webui=False,
                 ignore_reinit_error=True,
                 plasma_directory=plasma_directory,
@@ -229,10 +233,9 @@
             client = get_client()
         except ValueError:
             from distributed import Client
-            import multiprocessing
 
-            num_cpus = multiprocessing.cpu_count()
-            client = Client(n_workers=num_cpus)
+            num_cpus = os.environ.get("MODIN_CPUS", None) or multiprocessing.cpu_count()
+            client = Client(n_workers=int(num_cpus))
 elif execution_engine != "Python":
     raise ImportError("Unrecognized execution engine: {}.".format(execution_engine))

{"golden_diff": "diff --git a/modin/pandas/__init__.py b/modin/pandas/__init__.py\n--- a/modin/pandas/__init__.py\n+++ b/modin/pandas/__init__.py\n@@ -75,6 +75,7 @@\n import os\n import types\n import sys\n+import multiprocessing\n \n from .. import __version__\n from .concat import concat\n@@ -134,12 +135,14 @@\n         import secrets\n \n         plasma_directory = None\n+        num_cpus = os.environ.get(\"MODIN_CPUS\", None) or multiprocessing.cpu_count()\n         cluster = os.environ.get(\"MODIN_RAY_CLUSTER\", None)\n         redis_address = os.environ.get(\"MODIN_REDIS_ADDRESS\", None)\n         redis_password = secrets.token_hex(16)\n         if cluster == \"True\" and redis_address is not None:\n             # We only start ray in a cluster setting for the head node.\n             ray.init(\n+                num_cpus=int(num_cpus),\n                 include_webui=False,\n                 ignore_reinit_error=True,\n                 redis_address=redis_address,\n@@ -171,6 +174,7 @@\n             else:\n                 object_store_memory = int(object_store_memory)\n             ray.init(\n+                num_cpus=int(num_cpus),\n                 include_webui=False,\n                 ignore_reinit_error=True,\n                 plasma_directory=plasma_directory,\n@@ -229,10 +233,9 @@\n             client = get_client()\n         except ValueError:\n             from distributed import Client\n-            import multiprocessing\n \n-            num_cpus = multiprocessing.cpu_count()\n-            client = Client(n_workers=num_cpus)\n+            num_cpus = os.environ.get(\"MODIN_CPUS\", None) or multiprocessing.cpu_count()\n+            client = Client(n_workers=int(num_cpus))\n elif execution_engine != \"Python\":\n     raise ImportError(\"Unrecognized execution engine: {}.\".format(execution_engine))\n", "issue": "Parallel agents for TeamCity\nRight now, TeamCity is taking >5 hours to complete. We should create parallel agents for non-dependent builds to run concurrently. The breakdown should be as follows:\r\n\r\n1.\t`MODIN_ENGINE=ray`, `MODIN_ENGINE=dask`, `MODIN_ENGINE=python`\r\na.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameReduction_A`\r\nb.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameReduction_B`\r\nc.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameBinary`\r\nd.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameMapMetadata`\r\ne.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameUDF`\r\nf.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameDefault`\r\ng.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameWindow`\r\nh.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameIndexing`\r\ni.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameIter`\r\nj.\t`python -m pytest modin/pandas/test/test_dataframe.py::TestDataFrameJoinSort`\r\nk.\t`python -m pytest modin/pandas/test/test_groupby.py`\r\nl.\t`python -m pytest modin/pandas/test/test_series.py modin/pandas/test/test_concat.py modin/pandas/test/test_reshape.py modin/pandas/test/test_general.py modin/pandas/test/test_io.py modin/pandas/test/test_io_exp.py`\r\n2.\t`MODIN_ENGINE=ray MODIN_EXPERIMENTAL=True MODIN_BACKEND=pyarrow python -m pytest modin/pandas/test/test_io.py::test_from_csv`\r\n\r\nIn total, 37 agents. This does not include agents we will need for Windows and MacOS.  \r\n\n", "before_files": [{"content": "import pandas\n\n__pandas_version__ = \"1.0.1\"\n\nif pandas.__version__ != __pandas_version__:\n    import warnings\n\n    warnings.warn(\n        \"The pandas version installed does not match the required pandas version in \"\n        \"Modin. This may cause undesired side effects!\".format(__pandas_version__)\n    )\n\nfrom pandas import (\n    eval,\n    unique,\n    value_counts,\n    cut,\n    to_numeric,\n    factorize,\n    test,\n    qcut,\n    date_range,\n    period_range,\n    Index,\n    MultiIndex,\n    CategoricalIndex,\n    bdate_range,\n    DatetimeIndex,\n    Timedelta,\n    Timestamp,\n    to_timedelta,\n    set_eng_float_format,\n    options,\n    set_option,\n    NaT,\n    PeriodIndex,\n    Categorical,\n    Interval,\n    UInt8Dtype,\n    UInt16Dtype,\n    UInt32Dtype,\n    UInt64Dtype,\n    SparseDtype,\n    Int8Dtype,\n    Int16Dtype,\n    Int32Dtype,\n    Int64Dtype,\n    StringDtype,\n    BooleanDtype,\n    CategoricalDtype,\n    DatetimeTZDtype,\n    IntervalDtype,\n    PeriodDtype,\n    RangeIndex,\n    Int64Index,\n    UInt64Index,\n    Float64Index,\n    TimedeltaIndex,\n    IntervalIndex,\n    IndexSlice,\n    Grouper,\n    array,\n    Period,\n    show_versions,\n    DateOffset,\n    timedelta_range,\n    infer_freq,\n    interval_range,\n    ExcelWriter,\n    datetime,\n    NamedAgg,\n    NA,\n)\nimport threading\nimport os\nimport types\nimport sys\n\nfrom .. import __version__\nfrom .concat import concat\nfrom .dataframe import DataFrame\nfrom .datetimes import to_datetime\nfrom .io import (\n    read_csv,\n    read_parquet,\n    read_json,\n    read_html,\n    read_clipboard,\n    read_excel,\n    read_hdf,\n    read_feather,\n    read_stata,\n    read_sas,\n    read_pickle,\n    read_sql,\n    read_gbq,\n    read_table,\n    read_fwf,\n    read_sql_table,\n    read_sql_query,\n    read_spss,\n    ExcelFile,\n    to_pickle,\n    HDFStore,\n    json_normalize,\n    read_orc,\n)\nfrom .reshape import get_dummies, melt, crosstab, lreshape, wide_to_long\nfrom .series import Series\nfrom .general import (\n    isna,\n    isnull,\n    merge,\n    merge_asof,\n    merge_ordered,\n    pivot_table,\n    notnull,\n    notna,\n    pivot,\n)\nfrom .plotting import Plotting as plotting\nfrom .. import __execution_engine__ as execution_engine\n\n# Set this so that Pandas doesn't try to multithread by itself\nos.environ[\"OMP_NUM_THREADS\"] = \"1\"\nnum_cpus = 1\n\n\ndef initialize_ray():\n    import ray\n\n    \"\"\"Initializes ray based on environment variables and internal defaults.\"\"\"\n    if threading.current_thread().name == \"MainThread\":\n        import secrets\n\n        plasma_directory = None\n        cluster = os.environ.get(\"MODIN_RAY_CLUSTER\", None)\n        redis_address = os.environ.get(\"MODIN_REDIS_ADDRESS\", None)\n        redis_password = secrets.token_hex(16)\n        if cluster == \"True\" and redis_address is not None:\n            # We only start ray in a cluster setting for the head node.\n            ray.init(\n                include_webui=False,\n                ignore_reinit_error=True,\n                redis_address=redis_address,\n                redis_password=redis_password,\n                logging_level=100,\n            )\n        elif cluster is None:\n            object_store_memory = os.environ.get(\"MODIN_MEMORY\", None)\n            if os.environ.get(\"MODIN_OUT_OF_CORE\", \"False\").title() == \"True\":\n                from tempfile import gettempdir\n\n                plasma_directory = gettempdir()\n                # We may have already set the memory from the environment variable, we don't\n                # want to overwrite that value if we have.\n                if object_store_memory is None:\n                    # Round down to the nearest Gigabyte.\n                    mem_bytes = ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9\n                    # Default to 8x memory for out of core\n                    object_store_memory = 8 * mem_bytes\n            # In case anything failed above, we can still improve the memory for Modin.\n            if object_store_memory is None:\n                # Round down to the nearest Gigabyte.\n                object_store_memory = int(\n                    0.6 * ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9\n                )\n                # If the memory pool is smaller than 2GB, just use the default in ray.\n                if object_store_memory == 0:\n                    object_store_memory = None\n            else:\n                object_store_memory = int(object_store_memory)\n            ray.init(\n                include_webui=False,\n                ignore_reinit_error=True,\n                plasma_directory=plasma_directory,\n                object_store_memory=object_store_memory,\n                redis_address=redis_address,\n                redis_password=redis_password,\n                logging_level=100,\n                memory=object_store_memory,\n            )\n        # Register custom serializer for method objects to avoid warning message.\n        # We serialize `MethodType` objects when we use AxisPartition operations.\n        ray.register_custom_serializer(types.MethodType, use_pickle=True)\n\n        # Register a fix import function to run on all_workers including the driver.\n        # This is a hack solution to fix #647, #746\n        def move_stdlib_ahead_of_site_packages(*args):\n            site_packages_path = None\n            site_packages_path_index = -1\n            for i, path in enumerate(sys.path):\n                if sys.exec_prefix in path and path.endswith(\"site-packages\"):\n                    site_packages_path = path\n                    site_packages_path_index = i\n                    # break on first found\n                    break\n\n            if site_packages_path is not None:\n                # stdlib packages layout as follows:\n                # - python3.x\n                #   - typing.py\n                #   - site-packages/\n                #     - pandas\n                # So extracting the dirname of the site_packages can point us\n                # to the directory containing standard libraries.\n                sys.path.insert(\n                    site_packages_path_index, os.path.dirname(site_packages_path)\n                )\n\n        move_stdlib_ahead_of_site_packages()\n        ray.worker.global_worker.run_function_on_all_workers(\n            move_stdlib_ahead_of_site_packages\n        )\n\n\nif execution_engine == \"Ray\":\n    import ray\n\n    initialize_ray()\n    num_cpus = ray.cluster_resources()[\"CPU\"]\nelif execution_engine == \"Dask\":  # pragma: no cover\n    from distributed.client import get_client\n    import warnings\n\n    if threading.current_thread().name == \"MainThread\":\n        warnings.warn(\"The Dask Engine for Modin is experimental.\")\n        try:\n            client = get_client()\n        except ValueError:\n            from distributed import Client\n            import multiprocessing\n\n            num_cpus = multiprocessing.cpu_count()\n            client = Client(n_workers=num_cpus)\nelif execution_engine != \"Python\":\n    raise ImportError(\"Unrecognized execution engine: {}.\".format(execution_engine))\n\nDEFAULT_NPARTITIONS = max(4, int(num_cpus))\n\n__all__ = [\n    \"DataFrame\",\n    \"Series\",\n    \"read_csv\",\n    \"read_parquet\",\n    \"read_json\",\n    \"read_html\",\n    \"read_clipboard\",\n    \"read_excel\",\n    \"read_hdf\",\n    \"read_feather\",\n    \"read_stata\",\n    \"read_sas\",\n    \"read_pickle\",\n    \"read_sql\",\n    \"read_gbq\",\n    \"read_table\",\n    \"read_spss\",\n    \"read_orc\",\n    \"json_normalize\",\n    \"concat\",\n    \"eval\",\n    \"unique\",\n    \"value_counts\",\n    \"cut\",\n    \"to_numeric\",\n    \"factorize\",\n    \"test\",\n    \"qcut\",\n    \"to_datetime\",\n    \"get_dummies\",\n    \"isna\",\n    \"isnull\",\n    \"merge\",\n    \"pivot_table\",\n    \"date_range\",\n    \"Index\",\n    \"MultiIndex\",\n    \"Series\",\n    \"bdate_range\",\n    \"period_range\",\n    \"DatetimeIndex\",\n    \"to_timedelta\",\n    \"set_eng_float_format\",\n    \"options\",\n    \"set_option\",\n    \"CategoricalIndex\",\n    \"Timedelta\",\n    \"Timestamp\",\n    \"NaT\",\n    \"PeriodIndex\",\n    \"Categorical\",\n    \"__version__\",\n    \"melt\",\n    \"crosstab\",\n    \"plotting\",\n    \"Interval\",\n    \"UInt8Dtype\",\n    \"UInt16Dtype\",\n    \"UInt32Dtype\",\n    \"UInt64Dtype\",\n    \"SparseDtype\",\n    \"Int8Dtype\",\n    \"Int16Dtype\",\n    \"Int32Dtype\",\n    \"Int64Dtype\",\n    \"CategoricalDtype\",\n    \"DatetimeTZDtype\",\n    \"IntervalDtype\",\n    \"PeriodDtype\",\n    \"BooleanDtype\",\n    \"StringDtype\",\n    \"NA\",\n    \"RangeIndex\",\n    \"Int64Index\",\n    \"UInt64Index\",\n    \"Float64Index\",\n    \"TimedeltaIndex\",\n    \"IntervalIndex\",\n    \"IndexSlice\",\n    \"Grouper\",\n    \"array\",\n    \"Period\",\n    \"show_versions\",\n    \"DateOffset\",\n    \"timedelta_range\",\n    \"infer_freq\",\n    \"interval_range\",\n    \"ExcelWriter\",\n    \"read_fwf\",\n    \"read_sql_table\",\n    \"read_sql_query\",\n    \"ExcelFile\",\n    \"to_pickle\",\n    \"HDFStore\",\n    \"lreshape\",\n    \"wide_to_long\",\n    \"merge_asof\",\n    \"merge_ordered\",\n    \"notnull\",\n    \"notna\",\n    \"pivot\",\n    \"datetime\",\n    \"NamedAgg\",\n    \"DEFAULT_NPARTITIONS\",\n]\n\ndel pandas\n", "path": "modin/pandas/__init__.py"}], "after_files": [{"content": "import pandas\n\n__pandas_version__ = \"1.0.1\"\n\nif pandas.__version__ != __pandas_version__:\n    import warnings\n\n    warnings.warn(\n        \"The pandas version installed does not match the required pandas version in \"\n        \"Modin. This may cause undesired side effects!\".format(__pandas_version__)\n    )\n\nfrom pandas import (\n    eval,\n    unique,\n    value_counts,\n    cut,\n    to_numeric,\n    factorize,\n    test,\n    qcut,\n    date_range,\n    period_range,\n    Index,\n    MultiIndex,\n    CategoricalIndex,\n    bdate_range,\n    DatetimeIndex,\n    Timedelta,\n    Timestamp,\n    to_timedelta,\n    set_eng_float_format,\n    options,\n    set_option,\n    NaT,\n    PeriodIndex,\n    Categorical,\n    Interval,\n    UInt8Dtype,\n    UInt16Dtype,\n    UInt32Dtype,\n    UInt64Dtype,\n    SparseDtype,\n    Int8Dtype,\n    Int16Dtype,\n    Int32Dtype,\n    Int64Dtype,\n    StringDtype,\n    BooleanDtype,\n    CategoricalDtype,\n    DatetimeTZDtype,\n    IntervalDtype,\n    PeriodDtype,\n    RangeIndex,\n    Int64Index,\n    UInt64Index,\n    Float64Index,\n    TimedeltaIndex,\n    IntervalIndex,\n    IndexSlice,\n    Grouper,\n    array,\n    Period,\n    show_versions,\n    DateOffset,\n    timedelta_range,\n    infer_freq,\n    interval_range,\n    ExcelWriter,\n    datetime,\n    NamedAgg,\n    NA,\n)\nimport threading\nimport os\nimport types\nimport sys\nimport multiprocessing\n\nfrom .. import __version__\nfrom .concat import concat\nfrom .dataframe import DataFrame\nfrom .datetimes import to_datetime\nfrom .io import (\n    read_csv,\n    read_parquet,\n    read_json,\n    read_html,\n    read_clipboard,\n    read_excel,\n    read_hdf,\n    read_feather,\n    read_stata,\n    read_sas,\n    read_pickle,\n    read_sql,\n    read_gbq,\n    read_table,\n    read_fwf,\n    read_sql_table,\n    read_sql_query,\n    read_spss,\n    ExcelFile,\n    to_pickle,\n    HDFStore,\n    json_normalize,\n    read_orc,\n)\nfrom .reshape import get_dummies, melt, crosstab, lreshape, wide_to_long\nfrom .series import Series\nfrom .general import (\n    isna,\n    isnull,\n    merge,\n    merge_asof,\n    merge_ordered,\n    pivot_table,\n    notnull,\n    notna,\n    pivot,\n)\nfrom .plotting import Plotting as plotting\nfrom .. import __execution_engine__ as execution_engine\n\n# Set this so that Pandas doesn't try to multithread by itself\nos.environ[\"OMP_NUM_THREADS\"] = \"1\"\nnum_cpus = 1\n\n\ndef initialize_ray():\n    import ray\n\n    \"\"\"Initializes ray based on environment variables and internal defaults.\"\"\"\n    if threading.current_thread().name == \"MainThread\":\n        import secrets\n\n        plasma_directory = None\n        num_cpus = os.environ.get(\"MODIN_CPUS\", None) or multiprocessing.cpu_count()\n        cluster = os.environ.get(\"MODIN_RAY_CLUSTER\", None)\n        redis_address = os.environ.get(\"MODIN_REDIS_ADDRESS\", None)\n        redis_password = secrets.token_hex(16)\n        if cluster == \"True\" and redis_address is not None:\n            # We only start ray in a cluster setting for the head node.\n            ray.init(\n                num_cpus=int(num_cpus),\n                include_webui=False,\n                ignore_reinit_error=True,\n                redis_address=redis_address,\n                redis_password=redis_password,\n                logging_level=100,\n            )\n        elif cluster is None:\n            object_store_memory = os.environ.get(\"MODIN_MEMORY\", None)\n            if os.environ.get(\"MODIN_OUT_OF_CORE\", \"False\").title() == \"True\":\n                from tempfile import gettempdir\n\n                plasma_directory = gettempdir()\n                # We may have already set the memory from the environment variable, we don't\n                # want to overwrite that value if we have.\n                if object_store_memory is None:\n                    # Round down to the nearest Gigabyte.\n                    mem_bytes = ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9\n                    # Default to 8x memory for out of core\n                    object_store_memory = 8 * mem_bytes\n            # In case anything failed above, we can still improve the memory for Modin.\n            if object_store_memory is None:\n                # Round down to the nearest Gigabyte.\n                object_store_memory = int(\n                    0.6 * ray.utils.get_system_memory() // 10 ** 9 * 10 ** 9\n                )\n                # If the memory pool is smaller than 2GB, just use the default in ray.\n                if object_store_memory == 0:\n                    object_store_memory = None\n            else:\n                object_store_memory = int(object_store_memory)\n            ray.init(\n                num_cpus=int(num_cpus),\n                include_webui=False,\n                ignore_reinit_error=True,\n                plasma_directory=plasma_directory,\n                object_store_memory=object_store_memory,\n                redis_address=redis_address,\n                redis_password=redis_password,\n                logging_level=100,\n                memory=object_store_memory,\n            )\n        # Register custom serializer for method objects to avoid warning message.\n        # We serialize `MethodType` objects when we use AxisPartition operations.\n        ray.register_custom_serializer(types.MethodType, use_pickle=True)\n\n        # Register a fix import function to run on all_workers including the driver.\n        # This is a hack solution to fix #647, #746\n        def move_stdlib_ahead_of_site_packages(*args):\n            site_packages_path = None\n            site_packages_path_index = -1\n            for i, path in enumerate(sys.path):\n                if sys.exec_prefix in path and path.endswith(\"site-packages\"):\n                    site_packages_path = path\n                    site_packages_path_index = i\n                    # break on first found\n                    break\n\n            if site_packages_path is not None:\n                # stdlib packages layout as follows:\n                # - python3.x\n                #   - typing.py\n                #   - site-packages/\n                #     - pandas\n                # So extracting the dirname of the site_packages can point us\n                # to the directory containing standard libraries.\n                sys.path.insert(\n                    site_packages_path_index, os.path.dirname(site_packages_path)\n                )\n\n        move_stdlib_ahead_of_site_packages()\n        ray.worker.global_worker.run_function_on_all_workers(\n            move_stdlib_ahead_of_site_packages\n        )\n\n\nif execution_engine == \"Ray\":\n    import ray\n\n    initialize_ray()\n    num_cpus = ray.cluster_resources()[\"CPU\"]\nelif execution_engine == \"Dask\":  # pragma: no cover\n    from distributed.client import get_client\n    import warnings\n\n    if threading.current_thread().name == \"MainThread\":\n        warnings.warn(\"The Dask Engine for Modin is experimental.\")\n        try:\n            client = get_client()\n        except ValueError:\n            from distributed import Client\n\n            num_cpus = os.environ.get(\"MODIN_CPUS\", None) or multiprocessing.cpu_count()\n            client = Client(n_workers=int(num_cpus))\nelif execution_engine != \"Python\":\n    raise ImportError(\"Unrecognized execution engine: {}.\".format(execution_engine))\n\nDEFAULT_NPARTITIONS = max(4, int(num_cpus))\n\n__all__ = [\n    \"DataFrame\",\n    \"Series\",\n    \"read_csv\",\n    \"read_parquet\",\n    \"read_json\",\n    \"read_html\",\n    \"read_clipboard\",\n    \"read_excel\",\n    \"read_hdf\",\n    \"read_feather\",\n    \"read_stata\",\n    \"read_sas\",\n    \"read_pickle\",\n    \"read_sql\",\n    \"read_gbq\",\n    \"read_table\",\n    \"read_spss\",\n    \"read_orc\",\n    \"json_normalize\",\n    \"concat\",\n    \"eval\",\n    \"unique\",\n    \"value_counts\",\n    \"cut\",\n    \"to_numeric\",\n    \"factorize\",\n    \"test\",\n    \"qcut\",\n    \"to_datetime\",\n    \"get_dummies\",\n    \"isna\",\n    \"isnull\",\n    \"merge\",\n    \"pivot_table\",\n    \"date_range\",\n    \"Index\",\n    \"MultiIndex\",\n    \"Series\",\n    \"bdate_range\",\n    \"period_range\",\n    \"DatetimeIndex\",\n    \"to_timedelta\",\n    \"set_eng_float_format\",\n    \"options\",\n    \"set_option\",\n    \"CategoricalIndex\",\n    \"Timedelta\",\n    \"Timestamp\",\n    \"NaT\",\n    \"PeriodIndex\",\n    \"Categorical\",\n    \"__version__\",\n    \"melt\",\n    \"crosstab\",\n    \"plotting\",\n    \"Interval\",\n    \"UInt8Dtype\",\n    \"UInt16Dtype\",\n    \"UInt32Dtype\",\n    \"UInt64Dtype\",\n    \"SparseDtype\",\n    \"Int8Dtype\",\n    \"Int16Dtype\",\n    \"Int32Dtype\",\n    \"Int64Dtype\",\n    \"CategoricalDtype\",\n    \"DatetimeTZDtype\",\n    \"IntervalDtype\",\n    \"PeriodDtype\",\n    \"BooleanDtype\",\n    \"StringDtype\",\n    \"NA\",\n    \"RangeIndex\",\n    \"Int64Index\",\n    \"UInt64Index\",\n    \"Float64Index\",\n    \"TimedeltaIndex\",\n    \"IntervalIndex\",\n    \"IndexSlice\",\n    \"Grouper\",\n    \"array\",\n    \"Period\",\n    \"show_versions\",\n    \"DateOffset\",\n    \"timedelta_range\",\n    \"infer_freq\",\n    \"interval_range\",\n    \"ExcelWriter\",\n    \"read_fwf\",\n    \"read_sql_table\",\n    \"read_sql_query\",\n    \"ExcelFile\",\n    \"to_pickle\",\n    \"HDFStore\",\n    \"lreshape\",\n    \"wide_to_long\",\n    \"merge_asof\",\n    \"merge_ordered\",\n    \"notnull\",\n    \"notna\",\n    \"pivot\",\n    \"datetime\",\n    \"NamedAgg\",\n    \"DEFAULT_NPARTITIONS\",\n]\n\ndel pandas\n", "path": "modin/pandas/__init__.py"}]}