Skip to content

Commit bec8295

Browse files
committed
filter tasks
1 parent ef90faf commit bec8295

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

backend/pycon/tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ def launch_heavy_processing_worker():
3030
cluster_name = f"pythonit-{settings.ENVIRONMENT}"
3131
ecs_client = boto3.client("ecs", region_name=settings.AWS_REGION_NAME)
3232

33-
response = ecs_client.list_tasks(cluster=cluster_name, desiredStatus="RUNNING")
33+
response = ecs_client.list_tasks(
34+
cluster=cluster_name,
35+
desiredStatus="RUNNING",
36+
family=f"pythonit-{settings.ENVIRONMENT}-heavy-processing-worker",
37+
)
3438

3539
if len(response["taskArns"]) > 0:
3640
return

backend/pycon/tests/test_tasks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ def test_launch_heavy_processing_worker_starts_task(settings, mocker):
3939
launch_heavy_processing_worker()
4040

4141
mock_client.return_value.describe_tasks.assert_called_with(
42-
cluster="pythonit-production-heavy-processing-worker", tasks=["arn-abc"]
42+
cluster="pythonit-production", tasks=["arn-abc"]
4343
)
4444

4545
mock_client.return_value.list_tasks.assert_called_with(
46-
cluster="pythonit-production-heavy-processing-worker", desiredStatus="RUNNING"
46+
cluster="pythonit-production",
47+
desiredStatus="RUNNING",
48+
family="pythonit-production-heavy-processing-worker",
4749
)
4850

4951
mock_client.return_value.run_task.assert_called_with(
50-
cluster="pythonit-production-heavy-processing-worker",
52+
cluster="pythonit-production",
5153
taskDefinition="pythonit-production-heavy-processing-worker",
5254
count=1,
5355
networkConfiguration={

infrastructure/applications/pycon_backend/worker.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ locals {
169169
value = jsonencode({
170170
subnets = [data.aws_subnet.public_1a.id],
171171
security_groups = [
172-
data.aws_security_group.rds.id,
173-
data.aws_security_group.lambda.id,
174-
aws_security_group.instance.id
172+
var.security_group_id
175173
],
176174
})
177175
},

0 commit comments

Comments
 (0)