From 80e3b3574d1f74c2a1ec8c0a72695ae05d8f20ad Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Wed, 22 Dec 2021 05:29:27 -0500 Subject: [PATCH] Batch - ensure that logs are posted in chronological order (#4710) --- moto/batch/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/moto/batch/models.py b/moto/batch/models.py index 8e98db457..09ba0f9f1 100644 --- a/moto/batch/models.py +++ b/moto/batch/models.py @@ -618,6 +618,7 @@ class Job(threading.Thread, BaseModel, DockerModel): ) date = unix_time_millis(date_obj) logs.append({"timestamp": date, "message": line.strip()}) + logs = sorted(logs, key=lambda l: l["timestamp"]) # Send to cloudwatch log_group = "/aws/batch/job"