mars
mars copied to clipboard
[BUG][pandas 1.4 compatibility issue] Ray executor run test_replace_execution raises KeyError
Describe the bug A clear and concise description of what the bug is.
export MARS_CI_BACKEND=ray
setup = <mars.deploy.oscar.session.SyncSession object at 0x287ba62e0>
def test_replace_execution(setup):
# dataframe cases
df_raw = pd.DataFrame(-1, index=range(0, 20), columns=list("ABCDEFGHIJ"))
for _ in range(30):
df_raw.iloc[random.randint(0, 19), random.randint(0, 9)] = random.randint(0, 99)
for rowid in range(random.randint(1, 5)):
row = random.randint(0, 19)
for idx in range(0, 10):
df_raw.iloc[row, idx] = random.randint(0, 99)
df = md.DataFrame(df_raw, chunk_size=4)
r = df.replace(-1, method="ffill")
pd.testing.assert_frame_equal(
r.execute().fetch(), df_raw.replace(-1, method="ffill")
)
r = df.replace(-1, method="bfill")
pd.testing.assert_frame_equal(
r.execute().fetch(), df_raw.replace(-1, method="bfill")
)
r = df.replace(-1, 999)
> pd.testing.assert_frame_equal(r.execute().fetch(), df_raw.replace(-1, 999))
mars/dataframe/missing/tests/test_missing_execution.py:263:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mars/core/entity/tileables.py:462: in execute
result = self.data.execute(session=session, **kw)
mars/core/entity/executable.py:144: in execute
return execute(self, session=session, **kw)
mars/deploy/oscar/session.py:1888: in execute
return session.execute(
mars/deploy/oscar/session.py:1682: in execute
execution_info: ExecutionInfo = fut.result(
../../.pyenv/versions/3.8.13/lib/python3.8/concurrent/futures/_base.py:444: in result
return self.__get_result()
../../.pyenv/versions/3.8.13/lib/python3.8/concurrent/futures/_base.py:389: in __get_result
raise self._exception
mars/deploy/oscar/session.py:1868: in _execute
await execution_info
../../.pyenv/versions/3.8.13/lib/python3.8/asyncio/tasks.py:695: in _wrap_awaitable
return (yield from awaitable.__await__())
mars/deploy/oscar/session.py:105: in wait
return await self._aio_task
mars/deploy/oscar/session.py:953: in _run_in_background
raise task_result.error.with_traceback(task_result.traceback)
mars/services/task/supervisor/processor.py:369: in run
await self._process_stage_chunk_graph(*stage_args)
mars/services/task/supervisor/processor.py:247: in _process_stage_chunk_graph
chunk_to_result = await self._executor.execute_subtask_graph(
mars/services/task/execution/ray/executor.py:551: in execute_subtask_graph
meta_list = await asyncio.gather(*output_meta_object_refs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
awaitable = ObjectRef(b58f0ee91e0a9599ffffffffffffffffffffffff0100000001000000)
@types.coroutine
def _wrap_awaitable(awaitable):
"""Helper for asyncio.ensure_future().
Wraps awaitable (an object with __await__) into a coroutine
that will later be wrapped in a Task by ensure_future().
"""
> return (yield from awaitable.__await__())
E ray.exceptions.RayTaskError(KeyError): ray::execute_subtask() (pid=20578, ip=127.0.0.1)
E File "/home/admin/Work/mars/mars/services/task/execution/ray/executor.py", line 185, in execute_subtask
E execute(context, chunk.op)
E File "/home/admin/Work/mars/mars/core/operand/core.py", line 491, in execute
E result = executor(results, op)
E File "/home/admin/Work/mars/mars/dataframe/missing/replace.py", line 266, in execute
E result = concat_data.replace(*replace_args, **replace_kwargs)
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/frame.py", line 5285, in replace
E return super().replace(
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/generic.py", line 6612, in replace
E result = self.apply(
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/frame.py", line 8848, in apply
E return op.apply().__finalize__(self, method="apply")
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/apply.py", line 733, in apply
E return self.apply_standard()
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/apply.py", line 857, in apply_standard
E results, res_index = self.apply_series_generator()
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/apply.py", line 873, in apply_series_generator
E results[i] = self.f(v)
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/apply.py", line 138, in f
E return func(x, *args, **kwargs)
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/series.py", line 5000, in _replace_single
E fill_f = missing.get_fill_func(method)
E File "/home/admin/.pyenv/versions/3.8.13/lib/python3.8/site-packages/pandas/core/missing.py", line 907, in get_fill_func
E return _fill_methods[method]
E KeyError: None
To Reproduce To help us reproducing this bug, please provide information below:
- Your Python version 3.8.13
- The version of Mars you use
- Versions of crucial packages, such as numpy, scipy and pandas pandas==1.4.4
- Full stack of the error.
- Minimized code to reproduce the error.
Expected behavior A clear and concise description of what you expected to happen.
Additional context Add any other context about the problem here.