Skip to content

Commit

Permalink
labels fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
mcovarr committed Sep 10, 2024
1 parent d0bd7da commit 246701d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions docs/backends/GCPBatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,15 @@ backend.providers.GCPBATCH.config {
Every call run on the GCP Batch backend is given certain labels by default, so that Google resources can be queried by these labels later.
The current default label set automatically applied is:

| Key | Value | Example | Notes |
|-----|-------|---------|-------|
| cromwell-workflow-id | The Cromwell ID given to the root workflow (i.e. the ID returned by Cromwell on submission) | cromwell-d4b412c5-bf3d-4169-91b0-1b635ce47a26 | To fit the required [format](#label-format), we prefix with 'cromwell-' |
| cromwell-sub-workflow-name | The name of this job's sub-workflow | my-sub-workflow | Only present if the task is called in a subworkflow. |
| wdl-task-name | The name of the WDL task | my-task | |
| wdl-call-alias | The alias of the WDL call that created this job | my-task-1 | Only present if the task was called with an alias. |
| Key | Value | Example | Notes |
|----------------------------|---------------------------------------------------------------------------------------------|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| cromwell-workflow-id | The Cromwell ID given to the root workflow (i.e. the ID returned by Cromwell on submission) | cromwell-d4b412c5-bf3d-4169-91b0-1b635ce47a26 | To fit the required [format](#label-format), we prefix with 'cromwell-' |
| cromwell-sub-workflow-id | The Cromwell ID given to this job's sub-workflow (immediate parent workflow) | cromwell-sub-d4b412c5-bf3d-4169-91b0-1b635ce47a26 | To fit the required [format](#label-format), we prefix with 'cromwell-sub-'. Only present if the task is called in a subworkflow. |
| cromwell-sub-workflow-name | The name of this job's sub-workflow | my-sub-workflow | Only present if the task is called in a subworkflow. |
| wdl-task-name | The name of the WDL task | my-task | |
| wdl-call-alias | The alias of the WDL call that created this job | my-task-1 | Only present if the task was called with an alias. |
| wdl-attempt | Attempt number for this call | 1 | |
| wdl-shard-index | Index of this job within a scatter, | | Only present if the task was called within a scatter. |

Any custom labels provided as '`google_labels`' in the [workflow options](../wf_options/Google) are also applied to Google resources by GCP Batch.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ class GcpBatchRequestFactoryImpl()(implicit gcsTransferConfiguration: GcsTransfe
val subWorkflow = workflow.callable

Check warning on line 259 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala#L259

Added line #L259 was not covered by tests
val subWorkflowLabels =
if (!subWorkflow.equals(workflow.rootWorkflow))
Labels("cromwell-sub-workflow-name" -> subWorkflow.name)
Labels("cromwell-sub-workflow-name" -> subWorkflow.name,
"cromwell-sub-workflow-id" -> s"cromwell-sub-${jobDescriptor.workflowDescriptor.id.toString}")

Check warning on line 263 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala#L261-L263

Added lines #L261 - L263 were not covered by tests
else
Labels.empty

Check warning on line 265 in supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala

View check run for this annotation

Codecov / codecov/patch

supportedBackends/google/batch/src/main/scala/cromwell/backend/google/batch/api/GcpBatchRequestFactoryImpl.scala#L265

Added line #L265 was not covered by tests

Expand All @@ -274,7 +275,6 @@ class GcpBatchRequestFactoryImpl()(implicit gcsTransferConfiguration: GcsTransfe

val allLabels = Labels(
"cromwell-workflow-id" -> s"cromwell-${workflow.rootWorkflowId}",
"cromwell-root-workflow-id" -> jobDescriptor.workflowDescriptor.rootWorkflowId.toString,
"wdl-task-name" -> call.callable.name,
"wdl-attempt" -> backendJobDescriptorKey.attempt.toString,
"goog-batch-worker" -> "true",
Expand Down

0 comments on commit 246701d

Please sign in to comment.