Skip to content
This repository was archived by the owner on Sep 29, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.3
current_version = 0.1.4-b1
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
}

group = "ai.whylabs"
version = "0.1.3"
//version = "0.1.3-${project.properties.getOrDefault("versionType", "SNAPSHOT")}"
version = "0.1.4-b1"
//version = "0.1.4-b1-${project.properties.getOrDefault("versionType", "SNAPSHOT")}"
extra["isReleaseVersion"] = !version.toString().endsWith("SNAPSHOT")

allprojects {
Expand Down
1 change: 1 addition & 0 deletions spark-bundle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ shadowJar.apply {

// okio is consumed by songbird
relocate("okio", "com.shaded.whylabs.okio")
relocate("okhttp3", "com.shaded.whylabs.okhttp3")

archiveFileName.set("$artifactBaseName-${versionString}.jar")
}
8 changes: 7 additions & 1 deletion spark/src/main/scala/com/whylogs/spark/RetryUtil.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.whylogs.spark

import ai.whylabs.service.invoker.ApiException
import org.slf4j.LoggerFactory

import scala.concurrent.ExecutionContext.Implicits.global
Expand Down Expand Up @@ -31,7 +32,12 @@ object RetryUtil {
}.recoverWith {
case t: Throwable =>
if (context.retries >= config.maxTries) {
throw new PermanentFailure("Failed too many times.", context.lastCause)
val lastCause = context.lastCause
lastCause match {
case apiException: ApiException =>
throw new PermanentFailure("Failed too many times", new ApiException(s"Error code: ${apiException.getCode}. Headers: ${apiException.getResponseHeaders}. Body: ${apiException.getResponseBody}"))
case _ => throw new PermanentFailure("Failed too many times.", lastCause)
}
}
completeAfter(context.lastWaitMillis)
.flatMap { _ =>
Expand Down
9 changes: 5 additions & 4 deletions spark/src/main/scala/com/whylogs/spark/WhyLogs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory
import java.net.{HttpURLConnection, URL}
import java.nio.file.{Files, StandardOpenOption}
import java.time.Instant
import java.util.concurrent.TimeUnit
import scala.collection.JavaConverters._
import scala.concurrent.Await
import scala.concurrent.duration.Duration
Expand Down Expand Up @@ -202,13 +203,13 @@ case class WhyProfileSession(private val dataFrame: DataFrame,
Files.write(tmp, profileData, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING)

// Create the upload url
val req = new LogAsyncRequest()
req.setSegmentTags(segmentTags)
req.datasetTimestamp(timestamp)
val uploadResultFuture = RetryUtil.withRetries() {
val req = new LogAsyncRequest()
req.setSegmentTags(segmentTags)
req.datasetTimestamp(timestamp)
logApi.logAsync(orgId, modelId, req)
}
val uploadResult = Await.result(uploadResultFuture, Duration.create(10, "s"))
val uploadResult = Await.result(uploadResultFuture, Duration.create(10, TimeUnit.SECONDS))

// Write the profile to the upload url
val profileUploadResult = RetryUtil.withRetries() {
Expand Down