Skip to content

Commit

Permalink
update build/test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
hpratt committed May 20, 2023
1 parent 4d10c0a commit ad6fab6
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 47 deletions.
73 changes: 39 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import com.jfrog.bintray.gradle.BintrayExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.kotlin.dsl.registering
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get

plugins {
kotlin("jvm") version "1.3.41"
kotlin("jvm") version "1.7.0"
id("maven-publish")
id("com.jfrog.bintray") version "1.8.1"
}
Expand All @@ -11,35 +16,35 @@ group = "io.krews"
version = "0.14.0"

repositories {
maven { setUrl("http://dl.bintray.com/kotlin/kotlin-eap") }
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
mavenCentral()
jcenter()
}

dependencies {
compile(kotlin("stdlib-jdk8"))
compile(kotlin("reflect"))
compile("io.github.microutils","kotlin-logging","1.6.10")
compile("ch.qos.logback", "logback-classic","1.2.3")
compile("io.projectreactor", "reactor-core", "3.2.6.RELEASE")
compile("com.github.docker-java", "docker-java", "3.1.5")
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("io.github.microutils","kotlin-logging","1.6.10")
implementation("ch.qos.logback", "logback-classic","1.2.3")
implementation("io.projectreactor", "reactor-core", "3.2.6.RELEASE")
implementation("com.github.docker-java", "docker-java", "3.3.0")
// This one is needed to fix a warning from docker-java
compile("javax.activation", "activation", "1.1.1")
compile( "org.apache.commons", "commons-lang3", "3.8.1")
compile("com.typesafe", "config", "1.2.1")
compile("com.fasterxml.jackson.module", "jackson-module-kotlin", "2.9.7")
compile("org.jetbrains.exposed", "exposed", "0.10.5")
compile("org.xerial", "sqlite-jdbc", "3.25.2")
compile("org.flywaydb", "flyway-core", "5.2.0")
compile("com.zaxxer", "HikariCP", "3.1.0")
compile("com.google.apis", "google-api-services-lifesciences", "v2beta-rev20200220-1.30.9")
compile("com.google.apis", "google-api-services-storage", "v1-rev20200326-1.30.9")
compile("com.google.auth", "google-auth-library-oauth2-http", "0.20.0")
compile("com.github.ajalt","clikt", "1.5.0")
compile( "org.jetbrains.kotlinx", "kotlinx-html-jvm", "0.6.11")
compile( "org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.1.1")
implementation("javax.activation", "activation", "1.1.1")
implementation( "org.apache.commons", "commons-lang3", "3.8.1")
implementation("com.typesafe", "config", "1.2.1")
implementation("com.fasterxml.jackson.module", "jackson-module-kotlin", "2.9.7")
implementation("org.jetbrains.exposed", "exposed", "0.10.5")
implementation("org.xerial", "sqlite-jdbc", "3.25.2")
implementation("org.flywaydb", "flyway-core", "5.2.0")
implementation("com.zaxxer", "HikariCP", "3.1.0")
implementation("com.google.apis", "google-api-services-lifesciences", "v2beta-rev20200220-1.30.9")
implementation("com.google.apis", "google-api-services-storage", "v1-rev20200326-1.30.9")
implementation("com.google.auth", "google-auth-library-oauth2-http", "0.20.0")
implementation("com.github.ajalt","clikt", "1.5.0")
implementation( "org.jetbrains.kotlinx", "kotlinx-html-jvm", "0.6.11")
implementation( "org.jetbrains.kotlinx", "kotlinx-coroutines-core", "1.1.1")
testImplementation("org.junit.jupiter", "junit-jupiter", "5.4.0")
testCompile("org.assertj", "assertj-core", "3.11.1")
testImplementation("org.assertj", "assertj-core", "3.11.1")
testImplementation("io.mockk", "mockk", "1.9.3")
}

Expand All @@ -54,28 +59,28 @@ tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

val sourcesJar by tasks.creating(Jar::class) {
classifier = "sources"
from(java.sourceSets["main"].allSource)
val sourcesJar = tasks.register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}

val publicationName = "krews"
publishing {
publications.invoke {
publicationName(MavenPublication::class) {
publications {
create<MavenPublication>(publicationName) {
from(components["java"])
artifact(sourcesJar)
artifact(sourcesJar.get())
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/weng-lab/krews")
credentials {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/weng-lab/krews")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Mar 14 15:32:43 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
4 changes: 4 additions & 0 deletions src/main/kotlin/krews/config/BaseConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ data class TaskConfig (
val google: GoogleTaskConfig? = null,
// Task level Slurm executor configuration
val slurm: SlurmTaskConfig? = null,
// Task level Slurm executor configuration
val bsub: SlurmTaskConfig? = null,
// The maximum allowed parallelism for this task
val parallelism: Parallelism = UnlimitedParallelism,
// The number of tasks "executions" that will be run with the same job / vm.
Expand All @@ -26,6 +28,8 @@ data class WorkflowConfig (
val google: GoogleWorkflowConfig? = null,
// Slurm executor configuration
val slurm: SlurmWorkflowConfig? = null,
// BSUB executor configuration
val bsub: SlurmWorkflowConfig? = null,
// The maximum allowed parallelism for the system as a whole. Also see per-task parallelism
val parallelism: Parallelism = UnlimitedParallelism,
// The concurrency for task setup, status checking, and cleanup
Expand Down
24 changes: 24 additions & 0 deletions src/main/kotlin/krews/config/BsubConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package krews.config

import krews.core.Capacity

data class BsubWorkflowConfig(
// Interval in seconds between checks for pipeline job completion
val jobCompletionPollInterval: Int = 10,
// Optional ssh configuration. Will cause all slurm command to be passed through ssh.
// Only available for password-less login.
val ssh: SshConfig? = null
)

data class BsubTaskConfig(
// Number of cpus. Can be used to override the runtime value.
val cpus: Int? = null,
// Memory capacity. Can be used to override the runtime value.
val mem: Capacity? = null,
// Time limit on the run time for the job in minutes.
val time: Int? = null,
// SBatch partition to use.
val partition: String? = null,
// Additional sbatch arguments
val sbatchArgs: Map<String, String>? = null
)
2 changes: 1 addition & 1 deletion src/main/kotlin/krews/config/ConfigUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fun createTaskConfigs(rawTaskConfigs: Map<String, Map<String, Any>>, tasks: Coll
* "MySampleValue_te5t test*&test" should become "mysamplevalue-te5t-test--test"
*/
private fun kebabify(value: String): String {
return Regex("[^a-z0-9]").replace(value.toLowerCase(), "-")
return Regex("[^a-z0-9]").replace(value.lowercase(), "-")
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/krews/config/Parallelism.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ParallelismDeserializer : StdDeserializer<Parallelism>(Parallelism::class.
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Parallelism {
val mapper = p.codec as ObjectMapper
val obj = mapper.readTree<TreeNode>(p) as JsonNode
if (obj.nodeType == JsonNodeType.STRING && obj.asText().toLowerCase() == "unlimited") return UnlimitedParallelism
if (obj.nodeType == JsonNodeType.STRING && obj.asText().lowercase() == "unlimited") return UnlimitedParallelism
if (obj.nodeType == JsonNodeType.NUMBER) return LimitedParallelism(obj.asInt())
throw JsonMappingException(p, "Invalid parallelism. Must be either a number or \"unlimited\"")
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/krews/config/SlurmConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ data class SlurmTaskConfig(
val partition: String? = null,
// Additional sbatch arguments
val sbatchArgs: Map<String, String>? = null
)
)
2 changes: 1 addition & 1 deletion src/main/kotlin/krews/core/Capacity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ val Number.TB: Capacity get() = Capacity(this, CapacityType.TB)

internal fun stringToCapacity(str: String): Capacity {
val regex = """(\d+)\s*([KMGT]?B)""".toRegex()
val matchResult = regex.find(str.toUpperCase())
val matchResult = regex.find(str.uppercase())
val (value, type) = matchResult!!.destructured
return Capacity(value.toDouble(), CapacityType.valueOf(type))
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/krews/executor/bsub/BsubExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class BsubExecutor(private val workflowConfig: WorkflowConfig) : LocallyDirected
appendBsubParam(bsubScript, "W", time)
appendBsubParam(bsubScript, "q", taskConfig.bsub?.partition)
for ((argName, argVal) in taskConfig.bsub?.sbatchArgs ?: mapOf()) {
appendSbatchParam(bsubScript, argName, argVal)
appendBsubParam(bsubScript, argName, argVal)
}

bsubScript.append("\n")
Expand Down Expand Up @@ -235,7 +235,7 @@ class BsubExecutor(private val workflowConfig: WorkflowConfig) : LocallyDirected
delay(kotlin.random.Random.nextLong(0, 5000))

val bsubCommand = "echo $bsubScriptAsBase64 | base64 --decode | bsub"
val bsubResponse = commandExecutor.exec(bsubScript)
val bsubResponse = commandExecutor.exec(bsubCommand)
val jobId = "\\d+\$".toRegex().find(bsubResponse)?.value
?: throw Exception("JobID not found in response for bsub command")

Expand Down
10 changes: 5 additions & 5 deletions src/main/kotlin/krews/executor/google/GoogleLocalExecutor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ class GoogleLocalExecutor(workflowConfig: WorkflowConfig) : LocallyDirectedExecu
val maxMemory = taskRunContexts.map { it.memory }.maxBy { it?.bytes ?: -1 } ?: taskConfig.google?.mem
virtualMachine.machineType = googleMachineType(taskConfig.google, maxCpus, maxMemory)
if (taskConfig.google?.bootDiskSizeGb != null)
virtualMachine.setBootDiskSizeGb(taskConfig.google?.bootDiskSizeGb)
virtualMachine.setBootDiskSizeGb(taskConfig.google.bootDiskSizeGb)

if (taskConfig.google?.gpus != null) {
val acceleratorConfig = Accelerator()
acceleratorConfig.type = taskConfig.google?.gpus!!.gpuType
acceleratorConfig.count = taskConfig.google?.gpus!!.gpuCount
acceleratorConfig.type = taskConfig.google.gpus.gpuType
acceleratorConfig.count = taskConfig.google.gpus.gpuCount
virtualMachine.accelerators = listOf(acceleratorConfig)
if (taskConfig.google?.gpus!!.bootImage != null)
virtualMachine.bootImage = taskConfig.google?.gpus!!.bootImage
if (taskConfig.google.gpus.bootImage != null)
virtualMachine.bootImage = taskConfig.google.gpus.bootImage
}

val serviceAccount = ServiceAccount()
Expand Down

0 comments on commit ad6fab6

Please sign in to comment.