gurudesh/pytracebugs huggingface dataset:
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    if len(self._inputs) == 2:
        self._lhs = self._inputs[0]
        self._rhs = self._inputs[1]
    else:
        if isinstance(self._lhs, (DATAFRAME_TYPE, SERIES_TYPE)):
            self._lhs = self._inputs[0]
        elif pd.api.types.is_scalar(self._lhs):
            self._rhs = self._inputs[0]


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    if len(self._inputs) == 2:
        self._lhs = self._inputs[0]
        self._rhs = self._inputs[1]
    else:
        if isinstance(self._lhs, (Base, Entity)):
            self._lhs = self._inputs[0]
        elif pd.api.types.is_scalar(self._lhs):
            self._rhs = self._inputs[0]
# Buggy code
def execute(cls, ctx, op: "GroupByCumReductionOperand"):
    in_data = ctx[op.inputs[0].key]
    out_df = op.outputs[0]

    if not in_data or in_data.empty:
        ctx[out_df.key] = (
            build_empty_df(out_df.dtypes)
            if op.output_types[0] == OutputType.dataframe
            else build_empty_series(out_df.dtype)
        )
        return

    func_name = getattr(op, "_func_name")
    if func_name == "cumcount":
        ctx[out_df.key] = in_data.cumcount(ascending=op.ascending)
    else:
        result = getattr(in_data, func_name)(axis=op.axis)
        if result.ndim == 2:
            ctx[out_df.key] = result.astype(out_df.dtypes, copy=False)
        else:
            ctx[out_df.key] = result.astype(out_df.dtype, copy=False)


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def execute(cls, ctx, op: "GroupByCumReductionOperand"):
    in_data = ctx[op.inputs[0].key]
    out_chunk = op.outputs[0]

    if not in_data or in_data.empty:
        ctx[out_chunk.key] = (
            build_empty_df(out_chunk.dtypes)
            if op.output_types[0] == OutputType.dataframe
            else build_empty_series(out_chunk.dtype, name=out_chunk.name)
        )
        return

    func_name = getattr(op, "_func_name")
    if func_name == "cumcount":
        ctx[out_chunk.key] = in_data.cumcount(ascending=op.ascending)
    else:
        result = getattr(in_data, func_name)(axis=op.axis)
        if result.ndim == 2:
            ctx[out_chunk.key] = result.astype(out_chunk.dtypes, copy=False)
        else:
            ctx[out_chunk.key] = result.astype(out_chunk.dtype, copy=False)
# Buggy code
def execute(cls, ctx, op):
    in_data = ctx[op.inputs[0].key]
    out_chunk = op.outputs[0]

    if not in_data:
        if op.output_types[0] == OutputType.dataframe:
            ctx[op.outputs[0].key] = build_empty_df(out_chunk.dtypes)
        else:
            ctx[op.outputs[0].key] = build_empty_series(out_chunk.dtype)
        return

    if op.call_agg:
        result = in_data.agg(op.func, *op.args, **op.kwds)
    else:
        result = in_data.transform(op.func, *op.args, **op.kwds)

    if result.ndim == 2:
        result = result.astype(op.outputs[0].dtypes, copy=False)
    else:
        result = result.astype(op.outputs[0].dtype, copy=False)
    ctx[op.outputs[0].key] = result


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def execute(cls, ctx, op):
    in_data = ctx[op.inputs[0].key]
    out_chunk = op.outputs[0]

    if not in_data:
        if op.output_types[0] == OutputType.dataframe:
            ctx[op.outputs[0].key] = build_empty_df(out_chunk.dtypes)
        else:
            ctx[op.outputs[0].key] = build_empty_series(out_chunk.dtype)
        return

    if op.call_agg:
        result = in_data.agg(op.func, *op.args, **op.kwds)
    elif in_data.shape[0] > 0:
        # cannot perform groupby-transform over empty dataframe
        result = in_data.transform(op.func, *op.args, **op.kwds)
    else:
        if out_chunk.ndim == 2:
            result = pd.DataFrame(columns=out_chunk.dtypes.index)
        else:
            result = pd.Series([], name=out_chunk.name, dtype=out_chunk.dtype)

    if result.ndim == 2:
        result = result.astype(out_chunk.dtypes, copy=False)
    else:
        result = result.astype(out_chunk.dtype, copy=False)
    ctx[op.outputs[0].key] = result
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    input_iter = iter(inputs)
    next(input_iter)
    if isinstance(self.to_replace, SERIES_TYPE):
        self._to_replace = next(input_iter)
    if isinstance(self.value, SERIES_TYPE):
        self._value = next(input_iter)
    self._fill_chunks = list(input_iter)


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    input_iter = iter(inputs)
    next(input_iter)
    if isinstance(self.to_replace, (SERIES_TYPE, SERIES_CHUNK_TYPE)):
        self._to_replace = next(input_iter)
    if isinstance(self.value, (SERIES_TYPE, SERIES_CHUNK_TYPE)):
        self._value = next(input_iter)
    self._fill_chunks = list(input_iter)
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    self._input = self._inputs[0]
    if isinstance(self._q, TENSOR_TYPE):
        self._q = self._inputs[-1]


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    self._input = self._inputs[0]
    if isinstance(self._q, (TENSOR_TYPE, TENSOR_CHUNK_TYPE)):
        self._q = self._inputs[-1]
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    self._input = self._inputs[0]
    if isinstance(self._tree, OBJECT_TYPE):
        self._tree = self._inputs[1]


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    self._input = self._inputs[0]
    if isinstance(self._tree, (OBJECT_TYPE, OBJECT_CHUNK_TYPE)):
        self._tree = self._inputs[1]
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    inputs_iter = iter(self._inputs)
    self._input = next(inputs_iter)
    if isinstance(self._bins, TENSOR_TYPE):
        self._bins = next(inputs_iter)
    if self._weights is not None:
        self._weights = next(inputs_iter)
    if self._input_min is not None:
        self._input_min = next(inputs_iter)
    if self._input_max is not None:
        self._input_max = next(inputs_iter)


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    inputs_iter = iter(self._inputs)
    self._input = next(inputs_iter)
    if isinstance(self._bins, (TENSOR_TYPE, TENSOR_CHUNK_TYPE)):
        self._bins = next(inputs_iter)
    if self._weights is not None:
        self._weights = next(inputs_iter)
    if self._input_min is not None:
        self._input_min = next(inputs_iter)
    if self._input_max is not None:
        self._input_max = next(inputs_iter)
# Buggy code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    inputs_iter = iter(self._inputs)
    self._input = next(inputs_iter)
    if isinstance(self._bins, TENSOR_TYPE):
        self._bins = next(inputs_iter)
    if self._weights is not None:
        self._weights = next(inputs_iter)


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def _set_inputs(self, inputs):
    super()._set_inputs(inputs)
    inputs_iter = iter(self._inputs)
    self._input = next(inputs_iter)
    if isinstance(self._bins, (TENSOR_TYPE, TENSOR_CHUNK_TYPE)):
        self._bins = next(inputs_iter)
    if self._weights is not None:
        self._weights = next(inputs_iter)
# Buggy code
def deserialize_graph(ser_graph, graph_cls=None):
    from google.protobuf.message import DecodeError
    from .serialize.protos.graph_pb2 import GraphDef
    from .graph import DirectedGraph

    graph_cls = graph_cls or DirectedGraph
    ser_graph_bin = to_binary(ser_graph)
    g = GraphDef()
    try:
        ser_graph = ser_graph
        g.ParseFromString(ser_graph_bin)
        return graph_cls.from_pb(g)
    except DecodeError:
        pass

    try:
        ser_graph_bin = zlib.decompress(ser_graph_bin)
        g.ParseFromString(ser_graph_bin)
        return graph_cls.from_pb(g)
    except (zlib.error, DecodeError):
        pass

    json_obj = json.loads(to_str(ser_graph))
    return graph_cls.from_json(json_obj)


# Traceback (KeyError)
Attempt 1: Unexpected error KeyError occurred in executing operand bc8dccd428eb0f6261420866f7206b73 in 0.0.0.0:23252
Traceback (most recent call last):
File "/Users/wenjun.swj/Code/mars/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 383, in _wrapped
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 501, in execute_graph
graph_record = self._graph_records[(session_id, graph_key)] = GraphExecutionRecord(
File "/Users/wenjun.swj/Code/mars/mars/worker/execution.py", line 57, in __init__
graph = self.graph = deserialize_graph(graph_serialized)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 317, in deserialize_graph
return graph_cls.from_json(json_obj)
File "mars/graph.pyx", line 440, in mars.graph.DirectedGraph.from_json
return cls.deserialize(SerializableGraph.from_json(json_obj))
File "mars/serialize/core.pyx", line 718, in mars.serialize.core.Serializable.from_json
return cls.deserialize(provider, obj)
File "mars/serialize/core.pyx", line 689, in mars.serialize.core.Serializable.deserialize
[cb(key_to_instance) for cb in callbacks]
File "mars/serialize/jsonserializer.pyx", line 787, in mars.serialize.jsonserializer.JsonSerializeProvider.deserialize_field.cb
o = subs[val.key, val.id]
KeyError: ('b6888c78a929d77f42d7f3953fc813d9', '140581826655232')

# Fixed code
def deserialize_graph(ser_graph, graph_cls=None):
    from google.protobuf.message import DecodeError
    from .serialize.protos.graph_pb2 import GraphDef
    from .graph import DirectedGraph

    graph_cls = graph_cls or DirectedGraph
    ser_graph_bin = to_binary(ser_graph)
    g = GraphDef()
    try:
        g.ParseFromString(ser_graph_bin)
        return graph_cls.from_pb(g)
    except DecodeError:
        pass

    try:
        ser_graph_bin = zlib.decompress(ser_graph_bin)
        g.ParseFromString(ser_graph_bin)
        return graph_cls.from_pb(g)
    except (zlib.error, DecodeError):
        pass

    json_obj = json.loads(to_str(ser_graph))
    return graph_cls.from_json(json_obj)
# Buggy code
def __init__(
    self,
    op=None,
    shape=None,
    nsplits=None,
    dtype=None,
    name=None,
    index_value=None,
    chunks=None,
    **kw,
):
    super().__init__(
        _op=op,
        _shape=shape,
        _nsplits=nsplits,
        _dtype=dtype,
        _name=name,
        _index_value=index_value,
        _chunks=chunks,
        **kw,
    )


# Traceback (ZeroDivisionError)
Traceback (most recent call last):
File "/Users/wenjun.swj/miniconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-f86c22f8381d>", line 1, in <module>
mdf[mdf[0] != 0].sort_values(0).execute()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 646, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 642, in run
self.data.execute(session, **kw)
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 379, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 374, in run
session.run(self, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 505, in run
result = self._sess.run(*tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 111, in run
res = self._executor.execute_tileables(tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 457, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 883, in execute_tileables
self.execute_graph(chunk_graph, list(temp_result_keys),
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 698, in execute_graph
res = graph_execution.execute(retval)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 579, in execute
future.result()
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 457, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 446, in _execute_operand
self.handle_op(first_op, results, self._mock)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 378, in handle_op
return Executor.handle(*args, **kw)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 649, in handle
return runner(results, op)
File "/Users/wenjun.swj/Code/mars/mars/dataframe/sort/psrs.py", line 355, in execute
num = n // a.shape[op.axis] + 1
ZeroDivisionError: integer division or modulo by zero

# Fixed code
def __init__(
    self,
    op=None,
    shape=None,
    nsplits=None,
    dtype=None,
    name=None,
    names=None,
    index_value=None,
    chunks=None,
    **kw,
):
    super().__init__(
        _op=op,
        _shape=shape,
        _nsplits=nsplits,
        _dtype=dtype,
        _name=name,
        _names=names,
        _index_value=index_value,
        _chunks=chunks,
        **kw,
    )
# Buggy code
def from_tileable(tileable, dtype=None, name=None):
    op = IndexDataSource(gpu=tileable.op.gpu, sparse=tileable.issparse(), dtype=dtype)
    return op(inp=tileable, name=name)


# Traceback (ZeroDivisionError)
Traceback (most recent call last):
File "/Users/wenjun.swj/miniconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-f86c22f8381d>", line 1, in <module>
mdf[mdf[0] != 0].sort_values(0).execute()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 646, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 642, in run
self.data.execute(session, **kw)
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 379, in execute
return run()
File "/Users/wenjun.swj/Code/mars/mars/core.py", line 374, in run
session.run(self, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 505, in run
result = self._sess.run(*tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/session.py", line 111, in run
res = self._executor.execute_tileables(tileables, **kw)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 457, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 883, in execute_tileables
self.execute_graph(chunk_graph, list(temp_result_keys),
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 698, in execute_graph
res = graph_execution.execute(retval)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 579, in execute
future.result()
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 432, in result
return self.__get_result()
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
raise self._exception
File "/Users/wenjun.swj/miniconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/wenjun.swj/Code/mars/mars/utils.py", line 457, in _inner
return func(*args, **kwargs)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 446, in _execute_operand
self.handle_op(first_op, results, self._mock)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 378, in handle_op
return Executor.handle(*args, **kw)
File "/Users/wenjun.swj/Code/mars/mars/executor.py", line 649, in handle
return runner(results, op)
File "/Users/wenjun.swj/Code/mars/mars/dataframe/sort/psrs.py", line 355, in execute
num = n // a.shape[op.axis] + 1
ZeroDivisionError: integer division or modulo by zero

# Fixed code
def from_tileable(tileable, dtype=None, name=None, names=None):
    op = IndexDataSource(gpu=tileable.op.gpu, sparse=tileable.issparse(), dtype=dtype)
    return op(inp=tileable, name=name, names=names)
# Buggy code
def series_from_tensor(tensor, index=None, name=None, gpu=None, sparse=False):
    if tensor.ndim > 1 or tensor.ndim <= 0:
        raise TypeError(f"Not support create DataFrame from {tensor.ndim} dims tensor")
    gpu = tensor.op.gpu if gpu is None else gpu
    op = SeriesFromTensor(dtype=tensor.dtype, gpu=gpu, sparse=sparse)
    return op(tensor, index, name)


# Traceback (TypeError)
In [1]: import mars.dataframe as md

In [2]: import mars.tensor as mt

In [3]: df = md.DataFrame(mt.random.rand(10 ,3))

In [4]: df['a'] = df[0].mean()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-fdfc58da199a> in <module>
----> 1 df['a'] = df[0].mean()

~/Workspace/mars/mars/dataframe/indexing/setitem.py in dataframe_setitem(df, col, value)
172 def dataframe_setitem(df, col, value):
173     op = DataFrameSetitem(target=df, indexes=col, value=value)
--> 174     return op(df, value)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
449         def _inner(*args, **kwargs):
450             with self:
--> 451                 return func(*args, **kwargs)
452
453         return _inner

~/Workspace/mars/mars/dataframe/indexing/setitem.py in __call__(self, target, value)
69                 value_dtype = value.dtype
70             elif is_list_like(value) or isinstance(value, TENSOR_TYPE):
---> 71                 value = asseries(value, index=target.index)
72                 inputs.append(value)
73                 value_dtype = value.dtype

~/Workspace/mars/mars/dataframe/initializer.py in __init__(self, data, index, dtype, name, copy, chunk_size, gpu, sparse)
66             if chunk_size is not None:
67                 data = data.rechunk(chunk_size)
---> 68             series = series_from_tensor(data, index=index, name=name, gpu=gpu, sparse=sparse)
69         elif isinstance(index, INDEX_TYPE):
70             series = series_from_tensor(astensor(data, chunk_size=chunk_size), index=index,

~/Workspace/mars/mars/dataframe/datasource/from_tensor.py in series_from_tensor(tensor, index, name, gpu, sparse)
467 def series_from_tensor(tensor, index=None, name=None, gpu=None, sparse=False):
468     if tensor.ndim > 1 or tensor.ndim <= 0:
--> 469         raise TypeError(f'Not support create DataFrame from {tensor.ndim} dims tensor')
470     gpu = tensor.op.gpu if gpu is None else gpu
471     op = SeriesFromTensor(dtype=tensor.dtype, gpu=gpu, sparse=sparse)

TypeError: Not support create DataFrame from 0 dims tensor

# Fixed code
def series_from_tensor(tensor, index=None, name=None, gpu=None, sparse=False):
    if tensor.ndim > 1 or tensor.ndim <= 0:
        raise TypeError(f"Not support create Series from {tensor.ndim} dims tensor")
    gpu = tensor.op.gpu if gpu is None else gpu
    op = SeriesFromTensor(dtype=tensor.dtype, gpu=gpu, sparse=sparse)
    return op(tensor, index, name)
# Buggy code
def build_mock_groupby(self, **kwargs):
    in_df = self.inputs[0]
    if self.is_dataframe_obj:
        empty_df = build_df(in_df, size=2)
        obj_dtypes = in_df.dtypes[in_df.dtypes == np.dtype("O")]
        empty_df[obj_dtypes.index] = "O"
    else:
        if in_df.dtype == np.dtype("O"):
            empty_df = pd.Series(
                "O", index=pd.RangeIndex(2), name=in_df.name, dtype=np.dtype("O")
            )
        else:
            empty_df = build_series(in_df, size=2, name=in_df.name)

    new_kw = self.groupby_params
    new_kw.update(kwargs)
    if new_kw.get("level"):
        new_kw["level"] = 0
    if isinstance(new_kw["by"], list):
        new_by = []
        for v in new_kw["by"]:
            if isinstance(v, (Base, Entity)):
                new_by.append(build_series(v, size=2, name=v.name))
            else:
                new_by.append(v)
        new_kw["by"] = new_by
    return empty_df.groupby(**new_kw)


# Traceback (ValueError)
In [4]: import mars.dataframe as md

In [5]: md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-90507c117e4f> in <module>
----> 1 md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()

~/Workspace/mars/mars/dataframe/base/map.py in map_(series, arg, na_action, dtype)
155 def map_(series, arg, na_action=None, dtype=None):
156     op = DataFrameMap(arg=arg, na_action=na_action)
--> 157     return op(series, dtype=dtype)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
449         def _inner(*args, **kwargs):
450             with self:
--> 451                 return func(*args, **kwargs)
452
453         return _inner

~/Workspace/mars/mars/dataframe/base/map.py in __call__(self, series, dtype)
93
94         if dtype is None:
---> 95             raise ValueError('cannot infer dtype, '
96                              'it needs to be specified manually for `map`')
97         else:

ValueError: cannot infer dtype, it needs to be specified manually for `map`

# Fixed code
def build_mock_groupby(self, **kwargs):
    in_df = self.inputs[0]
    if self.is_dataframe_obj:
        empty_df = build_df(in_df, size=1)
        obj_dtypes = in_df.dtypes[in_df.dtypes == np.dtype("O")]
        empty_df[obj_dtypes.index] = "O"
    else:
        if in_df.dtype == np.dtype("O"):
            empty_df = pd.Series(
                "O", index=pd.RangeIndex(2), name=in_df.name, dtype=np.dtype("O")
            )
        else:
            empty_df = build_series(in_df, size=1, name=in_df.name)

    new_kw = self.groupby_params
    new_kw.update(kwargs)
    if new_kw.get("level"):
        new_kw["level"] = 0
    if isinstance(new_kw["by"], list):
        new_by = []
        for v in new_kw["by"]:
            if isinstance(v, (Base, Entity)):
                new_by.append(build_series(v, size=1, name=v.name))
            else:
                new_by.append(v)
        new_kw["by"] = new_by
    return empty_df.groupby(**new_kw)
# Buggy code
def set_index(df, keys, drop=True, append=False, verify_integrity=False, **kw):
    op = DataFrameSetIndex(
        keys=keys,
        drop=drop,
        append=append,
        verify_integrity=verify_integrity,
        output_types=[OutputType.dataframe],
        **kw,
    )
    return op(df)


# Traceback (ValueError)
In [4]: import mars.dataframe as md

In [5]: md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-90507c117e4f> in <module>
----> 1 md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()

~/Workspace/mars/mars/dataframe/base/map.py in map_(series, arg, na_action, dtype)
155 def map_(series, arg, na_action=None, dtype=None):
156     op = DataFrameMap(arg=arg, na_action=na_action)
--> 157     return op(series, dtype=dtype)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
449         def _inner(*args, **kwargs):
450             with self:
--> 451                 return func(*args, **kwargs)
452
453         return _inner

~/Workspace/mars/mars/dataframe/base/map.py in __call__(self, series, dtype)
93
94         if dtype is None:
---> 95             raise ValueError('cannot infer dtype, '
96                              'it needs to be specified manually for `map`')
97         else:

ValueError: cannot infer dtype, it needs to be specified manually for `map`

# Fixed code
def set_index(df, keys, drop=True, append=False, inplace=False, verify_integrity=False):
    op = DataFrameSetIndex(
        keys=keys,
        drop=drop,
        append=append,
        verify_integrity=verify_integrity,
        output_types=[OutputType.dataframe],
    )
    result = op(df)
    if not inplace:
        return result
    else:
        df.data = result.data
# Buggy code
def _serialize_index(index):
    tp = getattr(IndexValue, type(index).__name__)
    properties = _extract_property(index, tp, store_data)
    return tp(**properties)


# Traceback (ValueError)
In [4]: import mars.dataframe as md

In [5]: md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-90507c117e4f> in <module>
----> 1 md.Series(['1-1', '2-2']).map(lambda x: x.split('-')[0]).execute()

~/Workspace/mars/mars/dataframe/base/map.py in map_(series, arg, na_action, dtype)
155 def map_(series, arg, na_action=None, dtype=None):
156     op = DataFrameMap(arg=arg, na_action=na_action)
--> 157     return op(series, dtype=dtype)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
449         def _inner(*args, **kwargs):
450             with self:
--> 451                 return func(*args, **kwargs)
452
453         return _inner

~/Workspace/mars/mars/dataframe/base/map.py in __call__(self, series, dtype)
93
94         if dtype is None:
---> 95             raise ValueError('cannot infer dtype, '
96                              'it needs to be specified manually for `map`')
97         else:

ValueError: cannot infer dtype, it needs to be specified manually for `map`

# Fixed code
def _serialize_index(index):
    tp = getattr(IndexValue, type(index).__name__)
    properties = _extract_property(index, tp, store_data)
    properties["_name"] = index.name
    return tp(**properties)
# Buggy code
def __init__(self):
    self._store = dict()


# Traceback (AttributeError)
2020-11-17 16:48:29,349	WARNING worker.py:1157 -- Traceback (most recent call last):
File "/home/admin/.local/lib/python3.6/site-packages/ray/function_manager.py", line 445, in _load_actor_class_from_local
actor_class = getattr(module, class_name)
AttributeError: module 'mars.ray.core' has no attribute 'RemoteMetaStore'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "python/ray/_raylet.pyx", line 563, in ray._raylet.task_execution_handler
File "python/ray/_raylet.pyx", line 567, in ray._raylet.task_execution_handler
File "python/ray/_raylet.pyx", line 364, in ray._raylet.execute_task
File "/home/admin/.local/lib/python3.6/site-packages/ray/function_manager.py", line 394, in load_actor_class
job_id, actor_creation_function_descriptor)
File "/home/admin/.local/lib/python3.6/site-packages/ray/function_manager.py", line 454, in _load_actor_class_from_local
class_name))
RuntimeError: Actor RemoteMetaStore failed to be imported from local code.
An unexpected internal error occurred while the worker was executing a task.

# Fixed code
def __init__(self, meta_store=None):
    self.meta_store = meta_store or RemoteMetaStore.remote()
# Buggy code
def __init__(self, prepare_inputs=None, axis=None, output_types=None, **kwargs):
    super().__init__(
        _prepare_inputs=prepare_inputs, _axis=axis, _output_types=output_types, **kwargs
    )


# Traceback (ValueError)
2020-11-02 16:51:59,275 mars.scheduler.operands.common 143 ERROR    Attempt 1: Unexpected error ValueError occurred in executing operand 05f71b4ed53f21cea47398b40c0ec61d in 33.19.117.174:21137
Traceback (most recent call last):
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/utils.py", line 365, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 111, in request_batch_quota
make_first=all_allocated, process_quota=process_quota)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 158, in _request_quota
raise ValueError(f'Cannot allocate quota size {delta} '
ValueError: Cannot allocate quota size 22002064004 larger than total capacity 21259621171.

# Fixed code
def __init__(self, pure_depends=None, axis=None, output_types=None, **kwargs):
    super().__init__(
        _pure_depends=pure_depends, _axis=axis, _output_types=output_types, **kwargs
    )
# Buggy code
def standardize_range_index(chunks, axis=0):
    from .base.standardize_range_index import ChunkStandardizeRangeIndex

    row_chunks = dict(
        (k, next(v)) for k, v in itertools.groupby(chunks, key=lambda x: x.index[axis])
    )
    row_chunks = [row_chunks[i] for i in range(len(row_chunks))]

    out_chunks = []
    for c in chunks:
        inputs = row_chunks[: c.index[axis]] + [c]
        op = ChunkStandardizeRangeIndex(
            prepare_inputs=[False] * (len(inputs) - 1) + [True],
            axis=axis,
            output_types=c.op.output_types,
        )
        out_chunks.append(op.new_chunk(inputs, **c.params.copy()))

    return out_chunks


# Traceback (ValueError)
2020-11-02 16:51:59,275 mars.scheduler.operands.common 143 ERROR    Attempt 1: Unexpected error ValueError occurred in executing operand 05f71b4ed53f21cea47398b40c0ec61d in 33.19.117.174:21137
Traceback (most recent call last):
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/utils.py", line 365, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 111, in request_batch_quota
make_first=all_allocated, process_quota=process_quota)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 158, in _request_quota
raise ValueError(f'Cannot allocate quota size {delta} '
ValueError: Cannot allocate quota size 22002064004 larger than total capacity 21259621171.

# Fixed code
def standardize_range_index(chunks, axis=0):
    from .base.standardize_range_index import ChunkStandardizeRangeIndex

    row_chunks = dict(
        (k, next(v)) for k, v in itertools.groupby(chunks, key=lambda x: x.index[axis])
    )
    row_chunks = [row_chunks[i] for i in range(len(row_chunks))]

    out_chunks = []
    for c in chunks:
        inputs = row_chunks[: c.index[axis]] + [c]
        op = ChunkStandardizeRangeIndex(
            pure_depends=[True] * (len(inputs) - 1) + [False],
            axis=axis,
            output_types=c.op.output_types,
        )
        out_chunks.append(op.new_chunk(inputs, **c.params.copy()))

    return out_chunks
# Buggy code
def _get_keys_to_fetch(graph):
    from ..operands import Fetch, FetchShuffle

    fetch_keys = set()
    exclude_fetch_keys = set()
    for chunk in graph:
        if isinstance(chunk.op, Fetch):
            fetch_keys.add(chunk.op.to_fetch_key or chunk.key)
        elif isinstance(chunk.op, FetchShuffle):
            shuffle_key = get_chunk_shuffle_key(graph.successors(chunk)[0])
            for k in chunk.op.to_fetch_keys:
                fetch_keys.add((k, shuffle_key))
        else:
            for inp, prepare_inp in zip(chunk.inputs, chunk.op.prepare_inputs):
                if not prepare_inp:
                    exclude_fetch_keys.add(inp.key)
    return list(fetch_keys - exclude_fetch_keys)


# Traceback (ValueError)
2020-11-02 16:51:59,275 mars.scheduler.operands.common 143 ERROR    Attempt 1: Unexpected error ValueError occurred in executing operand 05f71b4ed53f21cea47398b40c0ec61d in 33.19.117.174:21137
Traceback (most recent call last):
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/utils.py", line 365, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 111, in request_batch_quota
make_first=all_allocated, process_quota=process_quota)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 158, in _request_quota
raise ValueError(f'Cannot allocate quota size {delta} '
ValueError: Cannot allocate quota size 22002064004 larger than total capacity 21259621171.

# Fixed code
def _get_keys_to_fetch(graph):
    from ..operands import Fetch, FetchShuffle

    fetch_keys = set()
    exclude_fetch_keys = set()
    for chunk in graph:
        if isinstance(chunk.op, Fetch):
            fetch_keys.add(chunk.op.to_fetch_key or chunk.key)
        elif isinstance(chunk.op, FetchShuffle):
            shuffle_key = get_chunk_shuffle_key(graph.successors(chunk)[0])
            for k in chunk.op.to_fetch_keys:
                fetch_keys.add((k, shuffle_key))
        else:
            for inp, prepare_inp, is_dep in zip(
                chunk.inputs, chunk.op.prepare_inputs, chunk.op.pure_depends
            ):
                if not prepare_inp or is_dep:
                    exclude_fetch_keys.add(inp.key)
    return list(fetch_keys - exclude_fetch_keys)
# Buggy code
def put_objects_by_keys(self, session_id, data_keys, shapes=None, pin_token=None):
    sizes = []
    for data_key in data_keys:
        buf = None
        try:
            buf = self._shared_store.get_buffer(session_id, data_key)
            size = len(buf)
            self._internal_put_object(session_id, data_key, buf, size)
        finally:
            del buf
        sizes.append(size)
    if pin_token:
        self.pin_data_keys(session_id, data_keys, pin_token)

    self.storage_client.register_data(
        session_id, data_keys, (0, self._storage_device), sizes, shapes=shapes
    )


# Traceback (ValueError)
2020-11-02 16:51:59,275 mars.scheduler.operands.common 143 ERROR    Attempt 1: Unexpected error ValueError occurred in executing operand 05f71b4ed53f21cea47398b40c0ec61d in 33.19.117.174:21137
Traceback (most recent call last):
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/promise.py", line 378, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/utils.py", line 365, in _wrapped
return func(*args, **kwargs)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 111, in request_batch_quota
make_first=all_allocated, process_quota=process_quota)
File "/home/admin/work/turing_dev-pymars-0.6.0a3.zip/mars/worker/quota.py", line 158, in _request_quota
raise ValueError(f'Cannot allocate quota size {delta} '
ValueError: Cannot allocate quota size 22002064004 larger than total capacity 21259621171.

# Fixed code
def put_objects_by_keys(self, session_id, data_keys, shapes=None, pin_token=None):
    sizes = []
    for data_key in data_keys:
        buf = None
        try:
            buf = self._shared_store.get_buffer(session_id, data_key)
            size = len(buf)
            self._internal_put_object(session_id, data_key, buf, size)
        finally:
            del buf
        sizes.append(size)
    if pin_token:
        self.pin_data_keys(session_id, data_keys, pin_token)

    self._finish_put_objects(session_id, data_keys)
    self.storage_client.register_data(
        session_id, data_keys, (0, self._storage_device), sizes, shapes=shapes
    )