def compute
        before_start

        # Load split index
        @split_index = socket.read_int

        # Load files
        SparkFiles.root_directory = socket.read_string

        # Load broadcast
        count = socket.read_int
        count.times do
          Spark::Broadcast.register(socket.read_long, socket.read_string)
        end

        # Load command
        @command = socket.read_data

        # Load iterator
        @iterator = @command.deserializer.load_from_io(socket).lazy

        # Compute
        @iterator = @command.execute(@iterator, @split_index)

        # Result is not iterable
        @iterator = [@iterator] unless @iterator.respond_to?(:each)

        # Send result
        @command.serializer.dump_to_io(@iterator, socket)
      end
def compute
        before_start

        # Load split index
        @split_index = socket.read_int

        # Load files
        SparkFiles.root_directory = socket.read_string

        # Load broadcast
        count = socket.read_int
        count.times do
          Spark::Broadcast.register(socket.read_long, socket.read_string)
        end

        # Load command
        @command = socket.read_data

        # Load iterator
        @iterator = @command.deserializer.load_from_io(socket).lazy

        # Compute
        @iterator = @command.execute(@iterator, @split_index)

        # Result is not iterable
        @iterator = [@iterator] unless @iterator.respond_to?(:each)

        # Send result
        @command.serializer.dump_to_io(@iterator, socket)
      end
These methods must be on one method because iterator is Lazy
 which mean that exception can be raised at `serializer` or `compute`