-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-44195][R] Add JobTag APIs to SparkR SparkContext #41742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a5eea18 to
b394e4e
Compare
R/pkg/R/sparkR.R
Outdated
| invisible(callJMethod(sc, "getJobTags")) | ||
| # TODO: how to return the Scala Set to R?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@falaki could you help me figure out how getJobTags, which returns a Set[String] in scala, could be made to return an R collection? Or could this API be ignored from R (the main use case is to be able to addJobTag, and then be able to cancelJobsWithTag; the use cases for getting job tags are limited)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be hard to return a perfect data structure from this method. Who is calling this? The caller can convert the data type from an Array to a Set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have to be listed in pkg/NAMESPACE and pkg/pkgdown/_pkgdown_template.yml I believe. Otherwise, it should work from a cursory look. (see also 07479b3)
| * Cancel active jobs that have the specified tag. See `org.apache.spark.SparkContext.addJobTag`. | ||
| * | ||
| * @param tag The tag to be added. Cannot contain ',' (comma) character. | ||
| * @param tag The tag to be cancelled. Cannot contain ',' (comma) character. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
piggy back this typy that I noticed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind fixing JavaSparkContext.cancelJobsWithTag too since we're here? I just copied and pasted it 😂
will need to investigate how to unwrap it to an R type... |
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM.
|
CI finished with 1 unrelated flake: |
juliuszsompolski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to submit yesterday
| if (newTags.isEmpty) { | ||
| clearJobTags() | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new R test found a bug so fixed it
| Option(getLocalProperty(SparkContext.SPARK_JOB_TAGS)) | ||
| .map(_.split(SparkContext.SPARK_JOB_TAGS_SEP).toSet) | ||
| .getOrElse(Set()) | ||
| .filter(!_.isEmpty) // empty string tag should not happen, but be defensive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... defensively fix the bug twice :-)
|
Merged to master. |
What changes were proposed in this pull request?
Add APIs from #41440 to SparkR:
Additionally:
Why are the changes needed?
SparkR parity.
Does this PR introduce any user-facing change?
Yes, introduce the APIs introduced in Scala in #41440 to SparkR
How was this patch tested?
Added test.