score:0

the findmean method is a method of the object motitordetection. the object motitordetection has a sparkcontext on-board, which is not serializable. thus, the task used in rdd.map is not serializable.

move all the matrix-related functions into a separate serializable object, matrixutils, say:

object matrixutils {
  def findmean(a: bdm[double]): bdv[double] = {
    var c = mean(a(*, ::))
    c
  }

  def tomatrix(x: bdv[double], y: bdv[double], c: int): bdm[double]={
    val m = bdm.zeros[double](c,2)
    m(::, 0) := x
    m(::, 1) := y
    m
  }

  ...
}

and then use only those methods from rdd.map(...):

object motitordetection {
  val sc = ...

  def safezones(stream: dstream[(int, bdm[double])]){
    import matrixutils._

    ... = rdd.map( ... )

  }
}

Related Query

More Query from same tag