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

#193: Drop support of Spark 2.4 #196

Merged
merged 7 commits into from
May 22, 2024

Conversation

benedeki
Copy link
Contributor

  • dropping Spark 2.4 support
  • strict use of sbt projectmatrix plugin, tohave cross-builds
  • basic settings moved to project/Setup.scala class
  • some move or project setup code to fall into logical areas

Closes #193

* dropping Spark 2.4 support
* strict use of sbt projectmatrix plugin, tohave cross-builds
* basic settings moved to `project/Setup.scala` class
* some move or project setup code to fall into logical areas
@benedeki benedeki added the work in progress Work on this item is not yet finished (mainly intended for PRs) label May 15, 2024
@benedeki benedeki self-assigned this May 15, 2024
Copy link

JaCoCo server module code coverage report - scala 2.13.11

Overall Project 76.61% 🍏

There is no coverage information present for the Files changed


ThisBuild / versionScheme := Some("early-semver")

Global / onChangedBuildSource := ReloadOnSourceChanges

publish / skip := true

lazy val printSparkScalaVersion = taskKey[Unit]("Print Spark and Scala versions for atum-service is being built for.")
lazy val printScalaVersion = taskKey[Unit]("Print Scala versions for atum-service is being built for.")
initialize := {
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 assignment necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest I don't know. This code block is a remnant of my tries to keep Spakr 2.4 support. And I found it interesting, so kept it for now, with the intention to ask you what you think to have that information (of the active Java version) there.
Just forgot to comment accordingly.
So what do you think, should we keep the info (with the commented out cod removed)?

Copy link
Collaborator

@salamonpavel salamonpavel May 16, 2024

Choose a reason for hiding this comment

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

I think it's useful to have a log statement with the Java version in use. See an alternative implementation below.

val checkJavaVersion = taskKey[Unit]("Check Java version")

checkJavaVersion := {
  val javaVersionUsed = VersionNumber(sys.props("java.specification.version"))
  streams.value.log.info(s"Running on Java version $javaVersionUsed")
}

// Run the task when the project is loaded
Global / onLoad := (Global / onLoad).value.andThen(state => "checkJavaVersion" :: state)
(base) AB032LP@LFGQVV4V6D atum-service % sbt compile
[info] welcome to sbt 1.9.7 (Amazon.com Inc. Java 11.0.22)
[info] loading global plugins from /Users/AB032LP/.sbt/1.0/plugins
[info] loading settings for project atum-service-build-build-build from metals.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project/project/project
[info] loading settings for project atum-service-build-build from metals.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project/project
[success] Generated .bloop/atum-service-build-build.json
[success] Total time: 1 s, completed 16 May 2024, 10:05:28
[info] loading settings for project atum-service-build from metals.sbt,plugins.sbt ...
[info] loading project definition from /Users/AB032LP/IdeaProjects/atum-service/project
[success] Generated .bloop/atum-service-build.json
[success] Total time: 1 s, completed 16 May 2024, 10:05:29
[info] loading settings for project atum-service from build.sbt,publish.sbt ...
[info] set current project to atum-service (in build file:/Users/AB032LP/IdeaProjects/atum-service/)
[info] Running on Java version 11
[success] Total time: 0 s, completed 16 May 2024, 10:05:38
[info] Executing in batch mode. For better performance use sbt's shell
[info] Building atum-database with Scala 2.13.11
[info] Building atum-model with Scala 2.12.18
[info] Building atum-server with Scala 2.13.11
[info] Building atum-model with Scala 2.13.11
[info] Building atum-agent with Spark 3.3.2, Scala 2.12.18
[info] Building atum-agent with Spark 3.3.2, Scala 2.13.11
[success] Total time: 4 s, completed 16 May 2024, 10:05:42

build.sbt Outdated
val _ = initialize.value // Ensure previous initializations are run

val requiredJavaVersion = VersionNumber("17")
val current = VersionNumber(sys.props("java.specification.version"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider renaming to something like javaVersion or javaVersionInUse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If code kept, will rename.

build.sbt Outdated
initialize := {
val _ = initialize.value // Ensure previous initializations are run

val requiredJavaVersion = VersionNumber("17")
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is currently not applied, but in general, can you explain the intended requirement for Java 17?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hope the explanation above make it cleared. This would be removed for sure (or maybe used in the information 🤔 )

val scala212 = "2.12.18"
val scala213 = "2.13.11"

val serviceScalaVersion: String = scala213
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we could align the naming as we sometimes use server and sometimes service. I would suggest to use server everywhere given it's a name of the module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, the original idea had been) (discussed bakc than with @lsulak ) that:
server = REST server
service = all parts of the running service (REST server + database)
If it's not consistent somewhere though, definitely wrong.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alright, I comprehend the logic behind it. However, without prior knowledge, it might not be immediately clear. Hence, I would suggest being more descriptive, for instance, using a name like "serverAndDatabaseScalaVersion".

)
}

def singleRow(scalaVersion: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another candidate for renaming as the method's name doesn't tell me anything about what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a brilliant idea. I was following the projectmatrix name from examples and how it is used in other examples. But I admit, it took me a while to grasp the concept. A better name would make it much easier to understand 👍

}
}

def scalasRow(scalaVersions: Seq[String],
Copy link
Collaborator

Choose a reason for hiding this comment

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

As below, not sure what the name suggests.

Copy link
Collaborator

@salamonpavel salamonpavel left a comment

Choose a reason for hiding this comment

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

The build.sbt file is definitely more readable and tidier. Apart from couple of suggested renamings I would argue that even the code in VersionAxis object could be enhanced by few comments so that one immediately knows what a given method does without looking at the implementation.

@lsulak
Copy link
Collaborator

lsulak commented May 15, 2024

The CI file, i.e. build instructions, must be also changed I assume, with the current setup.

Command sbt projects renders this

[info] agent_spark3
[info] agent_spark32_12
[info] * atum-service
[info] database
[info] model
[info] model2_12
[info] server

I.e. there is no agent (one reason why CI is currently failing) and no suffix means scala 2.13 is used - otherwise, agent and model, defines 2.12 explicitly. Shouldn't we make it mode consistent? Something like

[info] agent_spark32_13
[info] agent_spark32_12
[info] * atum-service2_13
[info] database2_13
[info] model2_13
[info] model2_12
[info] server2_13

--

I think that 2.13 is default = ThisBuild / scalaVersion := Setup.scala213 // default version
and thus is not explicitly used for the module names. I couldn't make it work yet (the explicit suffix)

@benedeki
Copy link
Contributor Author

The CI file, i.e. build instructions, must be also changed I assume, with the current setup.

Command sbt projects renders this

[info] agent_spark3 [info] agent_spark32_12 [info] * atum-service [info] database [info] model [info] model2_12 [info] server

I.e. there is no agent (one reason why CI is currently failing) and no suffix means scala 2.13 is used - otherwise, agent and model, defines 2.12 explicitly. Shouldn't we make it mode consistent? Something like

[info] agent_spark32_13 [info] agent_spark32_12 [info] * atum-service2_13 [info] database2_13 [info] model2_13 [info] model2_12 [info] server2_13

--

I think that 2.13 is default = ThisBuild / scalaVersion := Setup.scala213 // default version and thus is not explicitly used for the module names. I couldn't make it work yet (the explicit suffix)

Yes, GitHub actions still need changes. I didn't want to hold this one back on that though. I am actually considering to make it a separate PR.

// val clientScalacOptions: Seq[String] = Seq("-Ymacro-annotations")

val serverMergeStrategy = assembly / assemblyMergeStrategy := {
case PathList("META-INF", "services", xs @ _*) => MergeStrategy.filterDistinctLines
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This xs @ _* is marked by IntelliJ with warning. (I just blindly moved it from build.sbt. What does it actually means @salamonpavel, please?

Copy link
Collaborator

@salamonpavel salamonpavel May 16, 2024

Choose a reason for hiding this comment

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

xs is an alias, it's not needed here as we do not reference the alias and could be removed and the _* expands the elements of the list

* enhanced README.md to describe possible Spark 2.4 build.sbt
* increase version of sbt projectMatrix plugin
}
}

def addScalaCrossBuild(scalaVersions: Seq[String],
Copy link
Contributor

Choose a reason for hiding this comment

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

addScalaCrossBuild and addSingleScalaBuild look the same. Why not use one in the other?

benedeki added 2 commits May 16, 2024 17:36
* cleared unused an commented out code from project setup files
* moved publish related values into `publish.sbt`
* assembly plugin version upgraded
* commonSettings moved to Setup.scala
@benedeki benedeki removed the work in progress Work on this item is not yet finished (mainly intended for PRs) label May 20, 2024
Copy link
Collaborator

@lsulak lsulak left a comment

Choose a reason for hiding this comment

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

Last thing I found about the license header, otherwise it looks good to me, even the sbt assembly works! I'd prefer if CI is fixed in this step as it's not gonna be complicated, right? But up to you, good job!

@benedeki benedeki merged commit 8adf2b3 into master May 22, 2024
6 of 9 checks passed
@benedeki benedeki deleted the feature/193-drop-support-of-spark-2.4 branch May 22, 2024 10:41
@miroslavpojer miroslavpojer restored the feature/193-drop-support-of-spark-2.4 branch May 23, 2024 07:49
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.

Drop support of Spark 2.4
4 participants