Skip to content

Conversation

@HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Dec 25, 2017

What changes were proposed in this pull request?

This PR adds setLocalProperty and getLocalPropertyin R.

> df <- createDataFrame(iris)
> setLocalProperty("spark.job.description", "Hello world!")
> count(df)
> setLocalProperty("spark.job.description", "Hi !!")
> count(df)

2017-12-25 4 18 07

> print(getLocalProperty("spark.job.description"))
NULL
> setLocalProperty("spark.job.description", "Hello world!")
> print(getLocalProperty("spark.job.description"))
[1] "Hello world!"
> setLocalProperty("spark.job.description", "Hi !!")
> print(getLocalProperty("spark.job.description"))
[1] "Hi !!"

How was this patch tested?

Manually tested and a test in R/pkg/tests/fulltests/test_context.R.

R/pkg/R/sparkR.R Outdated
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to make a better description for a while but then just ended up with copying Python's:

def setLocalProperty(self, key, value):
"""
Set a local property that affects jobs submitted from this thread, such as the
Spark fair scheduler pool.
"""
self._jsc.setLocalProperty(key, value)

@HyukjinKwon
Copy link
Member Author

cc @felixcheung, could you take a look please?

@SparkQA
Copy link

SparkQA commented Dec 25, 2017

Test build #85369 has finished for PR 20075 at commit c9c7aee.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@HyukjinKwon
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Dec 25, 2017

Test build #85370 has finished for PR 20075 at commit c9c7aee.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member

felixcheung commented Dec 25, 2017 via email

@HyukjinKwon
Copy link
Member Author

Yea, let me update it soon.

@HyukjinKwon HyukjinKwon changed the title [SPARK-21208][R] Adds setLocalProperty in R [SPARK-21208][R] Adds setLocalProperty and getLocalProperty in R Dec 26, 2017
@SparkQA
Copy link

SparkQA commented Dec 26, 2017

Test build #85405 has finished for PR 20075 at commit 650a486.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Dec 26, 2017

Test build #85406 has finished for PR 20075 at commit 3c49523.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member

felixcheung commented Dec 26, 2017 via email

@HyukjinKwon
Copy link
Member Author

Yup, they should be handled too. Let me update.

if (is.null(key) || is.na(key)) {
stop("key should not be NULL or NA.")
}
if (!is.null(value)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, is.na case seems fine with passing it with as.character. I added the test.

@SparkQA
Copy link

SparkQA commented Dec 27, 2017

Test build #85417 has finished for PR 20075 at commit 6366cf9.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@felixcheung
Copy link
Member

felixcheung commented Dec 27, 2017 via email

@HyukjinKwon
Copy link
Member Author

Merged to master.

Thank you @felixcheung.

@asfgit asfgit closed this in 1eebfbe Dec 28, 2017
@HyukjinKwon HyukjinKwon deleted the SPARK-21208 branch January 2, 2018 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants