Skip to content

Instantly share code, notes, and snippets.

@tsibley
Created March 1, 2023 00:36
Show Gist options
  • Save tsibley/306348df621e6c02fa249345cd5313d7 to your computer and use it in GitHub Desktop.
Save tsibley/306348df621e6c02fa249345cd5313d7 to your computer and use it in GitHub Desktop.
From 3c10552e28e1133a521b3150038ed100261a9ef9 Mon Sep 17 00:00:00 2001
From: Thomas Sibley <[email protected]>
Date: Tue, 28 Feb 2023 16:24:24 -0800
Subject: [PATCH 1/2] wip! crossbreed's autopilots
---
nextstrain/cli/runner/aws_batch/jobs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nextstrain/cli/runner/aws_batch/jobs.py b/nextstrain/cli/runner/aws_batch/jobs.py
index b79d3d8..69cf0e8 100644
--- a/nextstrain/cli/runner/aws_batch/jobs.py
+++ b/nextstrain/cli/runner/aws_batch/jobs.py
@@ -290,7 +290,7 @@ def override_definition(base_definition_name: str, image: str) -> str:
# These are AWS-assigned keys returned by describe_job_definitions() which
# aren't supported as keyword arguments by register_job_definition().
- for key in {'jobDefinitionArn', 'revision', 'status'}:
+ for key in {'jobDefinitionArn', 'revision', 'status', 'containerOrchestrationType'}:
del derived_definition[key]
batch.register_job_definition(**derived_definition)
--
2.39.1
From 09665fe67b8e902e46315a8e06dfa28795151935 Mon Sep 17 00:00:00 2001
From: Thomas Sibley <[email protected]>
Date: Tue, 28 Feb 2023 16:35:46 -0800
Subject: [PATCH 2/2] wip! highjacked momentousness
---
nextstrain/cli/runner/aws_batch/jobs.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/nextstrain/cli/runner/aws_batch/jobs.py b/nextstrain/cli/runner/aws_batch/jobs.py
index 69cf0e8..31042f5 100644
--- a/nextstrain/cli/runner/aws_batch/jobs.py
+++ b/nextstrain/cli/runner/aws_batch/jobs.py
@@ -288,9 +288,12 @@ def override_definition(base_definition_name: str, image: str) -> str:
derived_definition["jobDefinitionName"] = derived_definition_name
derived_definition["containerProperties"]["image"] = image
- # These are AWS-assigned keys returned by describe_job_definitions() which
- # aren't supported as keyword arguments by register_job_definition().
- for key in {'jobDefinitionArn', 'revision', 'status', 'containerOrchestrationType'}:
+ # Remove keys in the output of describe_job_definitions() which aren't
+ # supported as inputs (keyword arguments) by register_job_definition().
+ describe_outputs = set(batch.meta.service_model.operation_model("DescribeJobDefinitions").output_shape.members["jobDefinitions"].member.members)
+ register_inputs = set(batch.meta.service_model.operation_model("RegisterJobDefinition").input_shape.members)
+
+ for key in describe_outputs - register_inputs:
del derived_definition[key]
batch.register_job_definition(**derived_definition)
--
2.39.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment