Skip to content

Commit

Permalink
Conf to disable docker lookup (#3119)
Browse files Browse the repository at this point in the history
* Add a conf to disable docker lookup
  • Loading branch information
Horneth committed Jan 9, 2018
1 parent 2a3662b commit 6ed1f11
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Cromwell Change Log

## 31 Release Notes

* Added a configuration option under `docker.hash-lookup.enabled` to disable docker hash lookup.
Disabling it will also disable call caching for jobs with floating docker tags.

## 30 Release Notes

### Breaking changes
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ google {

docker {
hash-lookup {
// /!\ Attention /!\
// If you disable this call caching will be disabled for jobs with floating docker tags !
enabled = true
// Set this to match your available quota against the Google Container Engine API
gcr-api-queries-per-100-seconds = 1000
// Time in minutes before an entry expires from the docker hashes cache and needs to be fetched again
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/scala/cromwell/core/DockerConfiguration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ object DockerConfiguration {
private lazy val dockerHashLookupConfig = dockerConfig.getConfig("hash-lookup")

lazy val instance: DockerConfiguration = {
val enabled = validate { dockerHashLookupConfig.as[Boolean]("enabled") }
val gcrApiQueriesPer100Seconds = validate { dockerHashLookupConfig.as[Int]("gcr-api-queries-per-100-seconds") }
val cacheEntryTtl = validate { dockerHashLookupConfig.as[FiniteDuration]("cache-entry-ttl") }
val cacheSize = validate { dockerHashLookupConfig.as[Long]("cache-size") }
Expand All @@ -24,7 +25,7 @@ object DockerConfiguration {
case other => throw new IllegalArgumentException(s"Unrecognized docker hash lookup method: $other")
}

val dockerConfiguration = (gcrApiQueriesPer100Seconds, cacheEntryTtl, cacheSize, method) mapN DockerConfiguration.apply
val dockerConfiguration = (enabled, gcrApiQueriesPer100Seconds, cacheEntryTtl, cacheSize, method) mapN DockerConfiguration.apply

dockerConfiguration match {
case Valid(conf) => conf
Expand All @@ -34,6 +35,7 @@ object DockerConfiguration {
}

case class DockerConfiguration(
enabled: Boolean,
gcrApiQueriesPer100Seconds: Int,
cacheEntryTtl: FiniteDuration,
cacheSize: Long,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import common.exception.MessageAggregation
import common.validation.ErrorOr.ErrorOr
import cromwell.backend._
import cromwell.backend.validation.DockerValidation
import cromwell.core.Dispatcher
import cromwell.core.{Dispatcher, DockerConfiguration}
import cromwell.core.Dispatcher.EngineDispatcher
import cromwell.core.callcaching._
import cromwell.core.logging.WorkflowLogging
Expand Down Expand Up @@ -121,9 +121,12 @@ class JobPreparationActor(workflowDescriptor: EngineWorkflowDescriptor,
}

def handleDockerValue(value: String) = DockerImageIdentifier.fromString(value) match {
// If the backend supports docker and we got a tag - we need to lookup the hash
case Success(dockerImageId: DockerImageIdentifierWithoutHash) if hasDockerDefinition =>
// If the backend supports docker, lookup is enabled, and we got a tag - we need to lookup the hash
case Success(dockerImageId: DockerImageIdentifierWithoutHash) if hasDockerDefinition && DockerConfiguration.instance.enabled =>
sendDockerRequest(dockerImageId)
// If the backend supports docker, we got a tag but lookup is disabled, continue with no call caching and no hash
case Success(dockerImageId: DockerImageIdentifierWithoutHash) if hasDockerDefinition =>
lookupKvsOrBuildDescriptorAndStop(inputs, attributes, FloatingDockerTagWithoutHash(dockerImageId.fullName))

// If the backend doesn't support docker - no need to lookup and we're ok for call caching
case Success(_: DockerImageIdentifierWithoutHash) if !hasDockerDefinition =>
Expand Down

0 comments on commit 6ed1f11

Please sign in to comment.