This could be slightly nicer preserving it as an `Option` instead of going through the empty string.

val localDirs = Option(System.getenv("YARN_LOCAL_DIRS")).orElse(Option(System.getenv("LOCAL_DIRS"))

Also - I don't know if below will compile, but a match statement could be nice also. This might not be possible though due to the return.
```
localDirs match {
  case None => throw new Exception("...")
  case Some(l) => l
}
```