Skip to content

Commit ea9f9cd

Browse files
committed
fix bugs with querying job
1 parent 2c27fc7 commit ea9f9cd

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN hatch dep show requirements > requirements.txt && pip install -r requirement
1414

1515
COPY . .
1616

17-
# install the package (more likely to change, leverage caching!)
18-
RUN pip install .
17+
# install the package with AWS extras so the ECS task has boto3, etc.
18+
RUN pip install '.[aws]'
1919

2020
ENTRYPOINT ["compose-run"]

compose_runner/aws_lambda/status_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]:
8181
output_doc = _parse_output(description.get("output"))
8282
body["output"] = output_doc
8383

84-
artifact_prefix = output_doc.get("artifact_prefix") or output_doc.get("run_id")
84+
artifact_prefix = description.get("name")
85+
if not artifact_prefix:
86+
raise ValueError("Execution does not expose a name; cannot determine artifact prefix.")
8587
body["artifact_prefix"] = artifact_prefix
8688

8789
if status in {"SUCCEEDED", "FAILED"}:

compose_runner/tests/test_lambda_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def generate_presigned_url(self, client_method, Params, ExpiresIn):
137137
def test_status_handler_succeeded(monkeypatch):
138138
start = datetime(2024, 1, 1, tzinfo=timezone.utc)
139139
stop = datetime(2024, 1, 1, 1, tzinfo=timezone.utc)
140-
output_payload = {"artifact_prefix": "artifact-1", "results": {"bucket": "bucket", "prefix": "prefix"}}
140+
output_payload = {"results": {"bucket": "bucket", "prefix": "prefix"}}
141141

142142
class FakeBody:
143143
def __init__(self, data):
@@ -150,6 +150,7 @@ class FakeSFN:
150150
def describe_execution(self, **kwargs):
151151
return {
152152
"status": "SUCCEEDED",
153+
"name": "artifact-1",
153154
"startDate": start,
154155
"stopDate": stop,
155156
"output": json.dumps(output_payload),

infra/cdk/stacks/compose_runner_stack.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs: object) -> Non
124124
container = task_definition.add_container(
125125
"ComposeRunnerContainer",
126126
image=ecs.ContainerImage.from_docker_image_asset(fargate_asset),
127-
command=["python", "-m", "compose_runner.ecs_task"],
127+
entry_point=["python", "-m", "compose_runner.ecs_task"],
128128
logging=ecs.LogDriver.aws_logs(
129129
log_group=task_log_group,
130130
stream_prefix="compose-runner",
@@ -261,6 +261,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs: object) -> Non
261261
description="Reports Step Functions execution status and metadata.",
262262
)
263263
state_machine.grant_read(status_function)
264+
results_bucket.grant_read(status_function)
264265

265266
status_function_url = status_function.add_function_url(
266267
auth_type=lambda_.FunctionUrlAuthType.NONE,

0 commit comments

Comments
 (0)