This is primarily used to parse system property specified user - so in case
of errors : default to node_local after flagging a warning.




On Sun, Jun 9, 2013 at 6:57 AM, Matei Zaharia <notifications@github.com>wrote:

> In core/src/main/scala/spark/scheduler/cluster/ClusterTaskSetManager.scala:
>
> > +  def parse(str: String): TaskLocality = {
> > +    // better way to do this ?
> > +    try {
> > +      val retval = TaskLocality.withName(str)
> > +      // Must not specify PROCESS_LOCAL !
> > +      assert (retval != TaskLocality.PROCESS_LOCAL)
> > +
> > +      retval
> > +    } catch {
> > +      case nEx: NoSuchElementException => {
> > +        logWarning("Invalid task locality specified '" + str + "', defaulting to NODE_LOCAL");
> > +        // default to preserve earlier behavior
> > +        NODE_LOCAL
> > +      }
> > +    }
> > +  }
>
> Why do we need to allow invalid locality strings? I'd rather not allow
> them and set various config options, etc to have good defaults. Printing a
> warning in this case is too risky, users might miss it.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mesos/spark/pull/632/files#r4603105>
> .
>