Skip to content

Commit 0626178

Browse files
committed
Improve task creation logs
1 parent 575db17 commit 0626178

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

api/src/shared/common/gcp_utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ def create_http_task_with_name(
9595
headers={"Content-Type": "application/json"},
9696
),
9797
)
98-
logging.info("Task created with task_name: %s", task_name)
9998
try:
10099
response = client.create_task(parent=parent, task=task)
100+
logging.info("Task created with task_name: %s", task_name)
101101
except Exception as e:
102-
logging.error("Error creating task: %s", e)
103-
logging.error("response: %s", response)
104-
logging.info("Successfully created task in create_http_task_with_name")
102+
if "Requested entity already exists" in str(e):
103+
logging.info("Task already exists for %s, skipping.", task_name)
104+
else:
105+
logging.error("Error creating task: %s", e)
106+
logging.error("response: %s", response)

0 commit comments

Comments
 (0)