Skip to content
Merged
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: 2 additions & 0 deletions backend/src/main/scala/cromwell/backend/backend.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ final case class BackendJobDescriptor(workflowDescriptor: BackendWorkflowDescrip
.flatten
.toSet

def allInputFiles: Set[WomFile] = evaluatedTaskInputs.values.flatMap(findFiles).toSet

def findFiles(v: WomValue): Set[WomFile] = v match {
case value: WomFile => Set(value)
case WomOptionalValue(_, Some(value)) => findFiles(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ trait StandardAsyncExecutionActor
*/
def inputsToNotLocalize: Set[WomFile] = Set.empty

protected def noLocalizationForTask: Boolean =
// WDL 1.1: `runtime.localizationOptional` indicates all files for task are optional
jobDescriptor.runtimeAttributes.get(wom.RuntimeAttributesKeys.LocalizationOptional).contains(WomBoolean(true))

/** @see [[Command.instantiate]] */
final lazy val commandLineValueMapper: WomValue => WomValue = { womValue =>
mapOrNoResolve(mapCommandLineWomFile)(womValue).get
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Per the 1.1 spec,

"Provides input-specific hints in the form of an object. Each key within this
hint should refer to an actual input defined for the current task. A key may
also refer to a specific member of a struct/object input."

Currently, `localizationOptional` is the only hint Cromwell supports.

https://github.com/openwdl/wdl/blob/wdl-1.1/SPEC.md#reserved-runtime-hints
https://github.com/openwdl/wdl/blob/wdl-1.1/SPEC.md#localizationoptional
https://github.com/openwdl/wdl/blob/wdl-1.1/SPEC.md#inputs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"input_hint_wf.foo": "gs://centaur-ci/textfile_1.txt",
"input_hint_wf.bar": ["gs://centaur-ci/textfile_2.txt", "gs://centaur-ci/textfile_3.txt"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: input_hint_all_optional
testFormat: workflowsuccess
backends: [GCPBATCH]

files {
workflow: input_hint_all_optional.wdl
inputs: input_hint_all_optional.json
}

metadata {
status: Succeeded
"outputs.input_hint_wf.errors": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version development-1.1

# Adapted from https://github.com/openwdl/wdl/blob/wdl-1.1/SPEC.md#reserved-runtime-hints

task localization_tester {
input {
File foo
Array[File] bar
}

# Require that the file is NOT localized, adapted from `draft3_nio_file_papi2.wdl`
command <<<
touch errors.txt
ls

# Check filenames are correct
[ ~{foo} = "gs://centaur-ci/textfile_1.txt" ] || echo "Wrong filename ~{foo}" >> errors.txt
[ ~{bar[0]} = "gs://centaur-ci/textfile_2.txt" ] || echo "Wrong filename ~{bar[0]}" >> errors.txt
[ ~{bar[1]} = "gs://centaur-ci/textfile_3.txt" ] || echo "Wrong filename ~{bar[1]}" >> errors.txt

# Check files are not localized
find . -path "*centaur-ci/textfile_1.txt" >> errors.txt
find . -path "*centaur-ci/textfile_2.txt" >> errors.txt
find . -path "*centaur-ci/textfile_3.txt" >> errors.txt
>>>

output {
String errors = read_string("errors.txt")
}

runtime {
localizationOptional: true
container: "rockylinux/rockylinux:10-minimal"
predefinedMachineType: "e2-medium"
}

meta {
volatile: true
}
}

workflow input_hint_wf {

input {
File foo
Array[File] bar
}

call localization_tester {
input: foo, bar
}

output {
String errors = localization_tester.errors
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ class AwsBatchAsyncBackendJobExecutionActor(
override lazy val dockerImageUsed: Option[String] = Option(jobDockerImage)

// overriden function : used in StandardAsyncExecutionActor
// AWS localization optional came in with the fork and is untested as of 2025-11 (no Centaur cases)
override def inputsToNotLocalize: Set[WomFile] =
jobDescriptor.fullyQualifiedInputs.collect {
case (_, womFile: WomFile)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,20 @@ class GcpBatchAsyncBackendJobExecutionActor(override val standardParams: Standar
}
)

override lazy val inputsToNotLocalize: Set[WomFile] = {
val localizeOptional = jobDescriptor.findInputFilesByParameterMeta {
case MetaValueElementObject(values) => values.get("localization_optional").contains(MetaValueElementBoolean(true))
case _ => false
// TODO: There is an AWS version of this that looks functionally identical. Consider unifying.
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth a ticket in the CTM board? This might be a good onboarding ticket for a future dev

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'm going to do this in the next PR, it's too small to document and re-explain later.

override def inputsToNotLocalize: Set[WomFile] =
if (noLocalizationForTask)
jobDescriptor.allInputFiles
else {
val localizeOptional = jobDescriptor.findInputFilesByParameterMeta {
case MetaValueElementObject(values) =>
values.get("localization_optional").contains(MetaValueElementBoolean(true))
case _ => false
}
val localizeSkipped = localizeOptional.filter(canSkipLocalize)
val localizeMapped = localizeSkipped.map(cloudResolveWomFile)
localizeSkipped ++ localizeMapped
}
val localizeSkipped = localizeOptional.filter(canSkipLocalize)
val localizeMapped = localizeSkipped.map(cloudResolveWomFile)
localizeSkipped ++ localizeMapped
}

private def canSkipLocalize(womFile: WomFile): Boolean = {
var canSkipLocalize = true
Expand Down
10 changes: 9 additions & 1 deletion wom/src/main/scala/wom/RuntimeAttributes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@ object RuntimeAttributesKeys {
val FailOnStderrKey = "failOnStderr"
val ContinueOnReturnCodeKey = "continueOnReturnCode"

// New for WDL 1.1
// WDL 1.1 required hints
// Semantically, this is the same as continueOnReturnCode as the two attributes are combined at the parsing stage
val ReturnCodesKey = "returnCodes"
val GpuRequiredKey = "gpu"

// WDL 1.1 reserved hints
// "Reserved" means optional for an engine to implement, but it must follow the spec if it does
// Cromwell supports `runtime.inputs.<qualified path>.localizationOptional` for single files
// as well as `runtime.localizationOptional` to apply to all files in a task
val LocalizationOptional = "localizationOptional"
val Inputs = "inputs"
val Outputs = "outputs"

val sharedMemoryKey = "sharedMemorySize"
}

Expand Down
Loading