Skip to content

Commit 86f30c3

Browse files
committed
better fix for amplab-extras/SparkR-pkg#53
Merge branch 'namespace-fix' Conflicts: pkg/inst/worker/worker.R
2 parents f323e97 + b3c318d commit 86f30c3

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

pkg/inst/worker/worker.R

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,26 @@ sink(stderr())
3939
# read function dependencies
4040
depsLen <- readInt(inputCon)
4141
if (depsLen > 0) {
42-
execFunctionDeps <- readRawLen(inputCon, depsLen)
42+
execFunctionDeps <- readRawLen(inputCon, depsLen)
43+
44+
# load the dependencies into current environment
45+
depsFileName <- tempfile(pattern="spark-exec", fileext=".deps")
46+
depsFile <- file(depsFileName, open="wb")
47+
writeBin(execFunctionDeps, depsFile, endian="big")
48+
close(depsFile)
4349
}
50+
4451
# Include packages as required
4552
packageNames <- unserialize(readRaw(inputCon))
4653
for (pkg in packageNames) {
47-
suppressPackageStartupMessages(require(as.character(pkg), character.only=TRUE))
54+
suppressPackageStartupMessages(require(as.character(pkg), character.only=TRUE))
4855
}
56+
4957
if (depsLen > 0) {
50-
# load the dependencies into current environment
51-
depsFileName <- tempfile(pattern="spark-exec", fileext=".deps")
52-
depsFile <- file(depsFileName, open="wb")
53-
writeBin(execFunctionDeps, depsFile, endian="big")
54-
close(depsFile)
55-
5658
load(depsFileName)
5759
unlink(depsFileName)
5860
}
5961

60-
# Include packages as required
61-
packageNames <- unserialize(readRaw(inputCon))
62-
for (pkg in packageNames) {
63-
suppressPackageStartupMessages(require(as.character(pkg), character.only=TRUE))
64-
}
65-
6662
# Read and set broadcast variables
6763
numBroadcastVars <- readInt(inputCon)
6864
if (numBroadcastVars > 0) {

0 commit comments

Comments
 (0)