-
Notifications
You must be signed in to change notification settings - Fork 819
/
DatabricksTests.scala
45 lines (34 loc) · 1.42 KB
/
DatabricksTests.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (C) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in project root for information.
package com.microsoft.azure.synapse.ml.nbtest
import com.microsoft.azure.synapse.ml.nbtest.DatabricksUtilities._
import java.util.concurrent.TimeUnit
import scala.collection.mutable.ListBuffer
import scala.concurrent.Await
import scala.concurrent.duration.Duration
import scala.language.existentials
class DatabricksTests extends DatabricksTestHelper {
val clusterId: String = createClusterInPool(ClusterName, AdbRuntime, NumWorkers, PoolId, "[]")
val jobIdsToCancel: ListBuffer[Int] = databricksTestHelper(clusterId, Libraries, CPUNotebooks)
println(s"Submitting nonparallelizable job...")
NonParallelizableNotebooks.toIterator.foreach(notebook => {
val run: DatabricksNotebookRun = uploadAndSubmitNotebook(clusterId, notebook)
jobIdsToCancel.append(run.runId)
test(run.notebookName) {
val result = Await.ready(
run.monitor(logLevel = 0),
Duration(TimeoutInMillis.toLong, TimeUnit.MILLISECONDS)).value.get
if (!result.isSuccess){
throw result.failed.get
}
}
})
protected override def afterAll(): Unit = {
afterAllHelper(jobIdsToCancel, clusterId, ClusterName)
super.afterAll()
}
ignore("list running jobs for convenience") {
val obj = databricksGet("jobs/runs/list?active_only=true&limit=1000")
println(obj)
}
}