Skip to content
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

[SW-1681] Change sw version to include also patch within one h2o version #1585

Merged
merged 7 commits into from Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions doc/build.gradle
Expand Up @@ -25,17 +25,11 @@ task substitute() {
doLast {
def siteDir = "${buildDir}/site"

def swOnlyVersion = version.tokenize("-")[0]
def (first, second, minorVersion) = swOnlyVersion.tokenize(".")
def majorVersion = "${first}.${second}"

new File(siteDir).eachFileRecurse(FILES) {
if (it.name.endsWith('.html')) {
def contents = file(it).getText('UTF-8')
contents = contents
.replaceAll("SUBST_SW_VERSION", version)
.replaceAll("SUBST_SW_MAJOR_VERSION", majorVersion)
jakubhava marked this conversation as resolved.
Show resolved Hide resolved
.replaceAll("SUBST_SW_MINOR_VERSION", minorVersion)
.replaceAll("SUBST_SPARK_VERSION", sparkVersion)
.replaceAll("SUBST_SPARK_MAJOR_VERSION", sparkMajorVersion)
.replaceAll("SUBST_H2O_VERSION", h2oVersion)
Expand Down
2 changes: 1 addition & 1 deletion doc/src/site/sphinx/deployment/sw_azure_dbc.rst
Expand Up @@ -19,7 +19,7 @@ To start Sparkling Water ``H2OContext`` on Databricks Azure, the steps are:

3. Add Sparkling Water dependency

In order to create the Java library in Databricks, go to **Libraries**, select **Maven** as the library source and type the following into the coordinates field: ``sparkling-water-package_2.11:SUBST_SW_MINOR_VERSION``.
jakubhava marked this conversation as resolved.
Show resolved Hide resolved
In order to create the Java library in Databricks, go to **Libraries**, select **Maven** as the library source and type the following into the coordinates field: ``ai.h2o:sparkling-water-package_2.11:SUBST_SW_VERSION``.

.. figure:: ../images/databricks_sw_maven.png
:alt: Uploading Sparkling Water assembly JAR
Expand Down
13 changes: 12 additions & 1 deletion doc/src/site/sphinx/migration_guide.rst
Expand Up @@ -80,4 +80,15 @@ Removal of Deprecated Methods and Classes
- On PySparkling ``H2OGLM`` API, we removed deprecated parameter ``alpha`` in favor of ``alphaValue`` and ``lambda_`` in favor of
``lambdaValue``. On Both PySparkling and Sparkling Water ``H2OGLM`` API, we removed methods ``getAlpha`` in favor of
``getAlphaValue``, ``getLambda`` in favor of ``getLambdaValue``, ``setAlpha`` in favor of ``setAlphaValue`` and
``setLambda`` in favor of ``setLambdaValue``. These changes ensure the consistency across Python and Scala APIs.
``setLambda`` in favor of ``setLambdaValue``. These changes ensure the consistency across Python and Scala APIs.

Change of Versioning Scheme
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Version of Sparkling Water is changed to the following pattern: ``H2OVersion-SWPatchVersion-SparkVersion``, where:
``H2OVersion`` is full H2O Version which is integrated to Sparkling Water. ``SWPatchVersion`` is used to specify
a patch version and ``SparkVersion`` is a Spark version. This change of scheme allows us to do releases of Sparkling Water
without the need of releasing H2O if there is only change on the Sparkling Water side. In that case, we just increment the
``SWPatchVersion``. The new version therefore looks, for example, like ``3.26.0.9-2-2.4``. This version tells us this
Sparkling Water is integrating H2O ``3.26.0.9``, it is the second release with ``3.26.0.9`` version and is for Spark ``2.4``.

2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -26,4 +26,4 @@ supportedSparkVersions=2.1 2.2 2.3 2.4
# Select for which Spark version is Sparkling Water built by default
spark=2.4
# Sparkling Water Version
version=3.28.1-SNAPSHOT
version=3.28.0.1-1-SNAPSHOT
1 change: 0 additions & 1 deletion gradle/release.gradle
Expand Up @@ -8,7 +8,6 @@ apply plugin: 'net.researchgate.release'

release {
tagTemplate = 'RELEASE-$version'
// Safe point - do releases only from release branch - can be deleted in future
failOnUnversionedFiles = false
failOnCommitNeeded = false
preCommitText = ":tada: "
Expand Down
22 changes: 17 additions & 5 deletions jenkins/Jenkinsfile-release
Expand Up @@ -5,7 +5,8 @@
properties(
[
parameters(
[ booleanParam(name: 'updateChangeLog', defaultValue: true, description: "Update change log"),
[ booleanParam(name: 'wasH2OUpgraded', defaultValue: true, description: "True if H2O was upgraded in this release or not"),
booleanParam(name: 'updateChangeLog', defaultValue: true, description: "Update change log"),
string(name: 'releaseFor', defaultValue: 'all', description: "For which Spark Major version" +
" do a release. By default, do release for all supported released versions"),
booleanParam(name: 'buildConda', defaultValue: true, description: 'Build Conda'),
Expand Down Expand Up @@ -90,21 +91,32 @@ String getVersionNoSuffix() {

String getNextVersionNoSuffix(params) {
def majorVersion = getMajorVersion(params)
def minorVersion = getMinorVersion(params)
def patchVersion = getPatchVersion(params)
return "${majorVersion}.${patchVersion.toInteger() + 1}-SNAPSHOT"
if (params.wasH2OUpgraded.toBoolean()) {
return "${majorVersion}.${minorVersion.toInteger() + 1}-1-SNAPSHOT"
} else {
return "${majorVersion}.${minorVersion}-${patchVersion.toInteger() + 1}-SNAPSHOT"
}
}


String getMajorVersion(params) {
def v = getVersion(params)
def split = v.split("\\.")
return "${split[0]}.${split[1]}".toString()
def split = v.split("-")[0].split("\\.")
return "${split[0]}.${split[1]}.${split[2]}".toString()
}

String getMinorVersion(params) {
def v = getVersion(params)
def split = v.split("-")[0].split("\\.")
return "${split[3]}".toString()
}

String getPatchVersion(params) {
def v = getVersion(params)
def split = v.split("-")
return "${split[0].split("\\.")[2]}"
return "${split[1]}".toString()
}

def prepareReleaseNotes(sparkMajorVersions) {
Expand Down
37 changes: 24 additions & 13 deletions jenkins/sparklingWaterPipeline.groovy
Expand Up @@ -10,21 +10,32 @@ def getS3Path(config) {

String getNightlyVersion(config) {
def sparkMajorVersion = config.sparkMajorVersion
def versionLine = readFile("gradle.properties").split("\n").find() { line -> line.startsWith('version') }
def version = versionLine.split("=")[1]
if (config.uploadNightly.toBoolean()) {
jakubhava marked this conversation as resolved.
Show resolved Hide resolved
def buildNumber
try {
def lastVersion = "https://h2o-release.s3.amazonaws.com/sparkling-water/spark-${config.sparkMajorVersion}/${getS3Path(config)}latest".toURL().getText().toString()
def splits = lastVersion.split("-")
buildNumber = splits[1].toInteger() + 1
} catch (Exception ignored) {
buildNumber = 1
def version = readFile("gradle.properties").split("\n").find() { line -> line.startsWith("version") }.split("=")[1]
def versionParts = version.split("-")
def h2oPart = versionParts[0]
def swPatch = versionParts[1]
def swNightlyBuildNumber
try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the following piece of code going to work with the old scheme once you merge it master?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Master will be using the new scheme after we merge this. rel-3.26 will be the last one to use the old scheme

def lastVersion = "https://h2o-release.s3.amazonaws.com/sparkling-water/spark-${config.sparkMajorVersion}/${getS3Path(config)}latest".toURL().getText().toString()
def lastVersionParts = lastVersion.split("-")
def lastH2OPart = lastVersionParts[0]
def lastSWPart = lastVersionParts[1]
if (lastSWPart.contains(".")) {
def lastSWParts = lastSWPart.split("\\.")
def lastSWPatch = lastSWParts[0]
def lastSWBuild = lastSWParts[1]
if (lastH2OPart != h2oPart || lastSWPatch != swPatch) {
swNightlyBuildNumber = 1 // reset the nightly build number
} else {
swNightlyBuildNumber = lastSWBuild.toInteger() + 1
}
} else {
swNightlyBuildNumber = 1
}
return "${version.split("-")[0]}-${buildNumber}-${sparkMajorVersion}"
} else {
return version
} catch (Exception ignored) {
swNightlyBuildNumber = 1
}
return "${h2oPart}-${swPatch}.${swNightlyBuildNumber}-${sparkMajorVersion}"
}

String getSparkVersion(config) {
Expand Down
4 changes: 2 additions & 2 deletions py/build.gradle
Expand Up @@ -127,7 +127,7 @@ def copyPySetup() {
filter {
it.replaceAll("SUBST_SPARK_MAJOR_VERSION", sparkMajorVersion)
.replaceAll("SUBST_SPARK_VERSION", sparkVersion)
.replaceAll("SUBST_SW_VERSION", version.substring(0, version.lastIndexOf("-")))
.replaceAll("SUBST_SW_VERSION", version.substring(0, version.lastIndexOf("-")).replace("-", "_"))
.replaceAll("SUBST_SPARK_MAJOR_VERSION", sparkMajorVersion)
}
into pkgDir
Expand Down Expand Up @@ -166,7 +166,7 @@ def copyPySetup() {
filter {
it.replaceAll("SUBST_SPARK_MAJOR_VERSION", sparkMajorVersion)
.replaceAll("SUBST_SPARK_VERSION", sparkVersion)
.replaceAll("SUBST_SW_VERSION", version.substring(0, version.lastIndexOf("-")))
.replaceAll("SUBST_SW_VERSION", version.substring(0, version.lastIndexOf("-")).replace("-", "_"))
}
into condaDir
}
Expand Down
7 changes: 4 additions & 3 deletions py/src/ai/h2o/sparkling/VersionComponents.py
Expand Up @@ -21,14 +21,15 @@ class VersionComponents(object):

@staticmethod
def parseFromSparklingWaterVersion(version):
match = re.search(r"^((\d+\.\d+)\.(\d+))(-(\d+))?-(\d+\.\d+)$", version)
match = re.search(r"^((\d+\.\d+\.\d+)\.(\d+)-(\d+))(\.(\d+))?-(\d+\.\d+)$", version)
result = VersionComponents()
result.fullVersion = match.group(0)
result.sparklingVersion = match.group(1)
result.sparklingMajorVersion = match.group(2)
result.sparklingMinorVersion = match.group(3)
result.nightlyVersion = match.group(5)
result.sparkMajorMinorVersion = match.group(6)
result.sparklingPatchVersion = match.group(4)
result.nightlyVersion = match.group(6)
result.sparkMajorMinorVersion = match.group(7)
return result

@staticmethod
Expand Down
14 changes: 8 additions & 6 deletions py/tests/unit/simple/test_version_components.py
Expand Up @@ -19,26 +19,28 @@


def testVersionComponentsCanBeParsedFromRegularVersion():
version = "3.26.2-2.4"
version = "3.26.0.2-2-2.4"
components = VersionComponents.parseFromSparklingWaterVersion(version)

assert components.fullVersion == version
assert components.sparklingVersion == "3.26.2"
assert components.sparklingMajorVersion == "3.26"
assert components.sparklingVersion == "3.26.0.2-2"
assert components.sparklingMajorVersion == "3.26.0"
assert components.sparklingMinorVersion == "2"
assert components.sparklingPatchVersion == "2"
assert components.nightlyVersion is None
assert components.sparkMajorMinorVersion == "2.4"


def testVersionComponentsCanBeParsedFromNightlyVersion():
version = "3.28.1-14-2.3"
version = "3.28.0.1-1.14-2.3"

components = VersionComponents.parseFromSparklingWaterVersion(version)

assert components.fullVersion == version
assert components.sparklingVersion == "3.28.1"
assert components.sparklingMajorVersion == "3.28"
assert components.sparklingVersion == "3.28.0.1-1"
assert components.sparklingMajorVersion == "3.28.0"
assert components.sparklingMinorVersion == "1"
assert components.sparklingPatchVersion == "1"
assert components.nightlyVersion == "14"
assert components.sparkMajorMinorVersion == "2.3"

Expand Down