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

Bazel builds enabled along with sbt #893

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

krisnaru
Copy link

@krisnaru krisnaru commented Dec 31, 2024

Summary

  • Enabled bazel builds for sources, tests
  • Sbt works as is
  • Supported scala versions: 2.12 and 2.13
  • Supported spark versions 3.1, 3.2,3.5

Why / Goal

Goal is to improve the build environment(by sandboxing) and provide multiple spark versions

Test Plan

Unit testing green
quick start steps green https://chronon.ai/getting_started/Tutorial.html

Build commands

  • bazel build //service
  • bazel build //online
  • bazel build //api/...
  • Uber jar: bazel build //spark:spark-assembly_deploy.jar
  • Build for scala version and spark version
    bazel build --config scala_2.12 --define spark_version=3.2 //spark/...

Checklist

  • Readme updates
  • Publish maven artifacts

Reviewers

@nikhilsimha @piyush-zlai

jvm/spark_2_4_repo.bzl Outdated Show resolved Hide resolved
jvm/spark_2_4_repo.bzl Outdated Show resolved Hide resolved
jvm/spark_2_4_repo.bzl Outdated Show resolved Hide resolved
jvm/spark_2_4_repo.bzl Outdated Show resolved Hide resolved
def _safe_name(coord):
return coord.replace(":", "_").replace(".", "_").replace("-", "_")

def maven_artifact(coord, repository_name = "maven"):

Choose a reason for hiding this comment

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

is there anything here that could be substituted with an existing bazel integration? eg.. https://github.com/bazel-contrib/rules_jvm_external?tab=readme-ov-file

import org.apache.spark.sql.types.StructType
import org.apache.spark.sql.{Encoder, Row}

object EncoderUtil {

Choose a reason for hiding this comment

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

ooc what's the reason behind this class?

WORKSPACE Show resolved Hide resolved
Copy link

@nikhil-zlai nikhil-zlai left a comment

Choose a reason for hiding this comment

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

LGTM! This is massively impactful Krish! Thanks for putting this up.

jvm/spark_3_1_repo.bzl Outdated Show resolved Hide resolved
jvm/spark_3_5_repo.bzl Outdated Show resolved Hide resolved
jvm/spark_3_5_repo.bzl Outdated Show resolved Hide resolved
@krisnaru krisnaru changed the title Bazel builds enabled for all java scala sources Bazel builds enabled along with sbt Jan 2, 2025
Copy link
Contributor

@piyush-zlai piyush-zlai left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to make this PR. Swapping over to bazel would be great for chronon!
Couple of comments / qs:

  • Lets also add some notes on how devs can use build / add deps etc using bazel in the devnotes
  • While we're keeping sbt & bazel around in the transitionary period, is there anything we need to call out for folks to take care of while updating deps / such?

## Disable remote cache completely when --config=local is passed
build:local --remote_cache=

# Scala version config flags:
Copy link
Contributor

Choose a reason for hiding this comment

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

wdyt about moving this to devnotes?

@@ -144,6 +157,18 @@ val VersionMatrix: Map[String, VersionDependency] = Map(
Some(spark3_1_1),
Some(spark3_2_1)
),
"spark-all-3-5" -> VersionDependency(
Copy link
Contributor

Choose a reason for hiding this comment

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

is this spark 3.5 stuff needed for the bazel changes? If not, I'd propose splitting out to a different PR

)

scala_test_suite(
name = "test",
Copy link
Contributor

Choose a reason for hiding this comment

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

in a follow up it would be nice to split this into a test invocation we test suite rather than triggering all at once. Bazel has better rails for this iiuc compared to sbt and breaking this out would help CI a fair bit

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.

5 participants