diff options
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/Utils.scala | 4 | ||||
-rw-r--r-- | docs/configuration.md | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala index 53458b6660..ac376fc403 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -278,6 +278,10 @@ private[spark] object Utils extends Logging { uc = new URL(url).openConnection() } + val timeout = conf.getInt("spark.files.fetchTimeout", 60) * 1000 + uc.setConnectTimeout(timeout) + uc.setReadTimeout(timeout) + uc.connect() val in = uc.getInputStream(); val out = new FileOutputStream(tempFile) Utils.copyStream(in, out, true) diff --git a/docs/configuration.md b/docs/configuration.md index 913c653b0d..8f6cb02911 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -523,6 +523,15 @@ Apart from these, the following properties are also available, and may be useful <td> Whether to overwrite files added through SparkContext.addFile() when the target file exists and its contents do not match those of the source. </td> +</tr> +<tr> + <td>spark.files.fetchTimeout</td> + <td>false</td> + <td> + Communication timeout to use when fetching files added through SparkContext.addFile() from + the driver. + </td> +</tr> <tr> <td>spark.authenticate</td> <td>false</td> |