jscheffl commented on code in PR #65498:
URL: https://github.com/apache/airflow/pull/65498#discussion_r3107101391
##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py:
##########
@@ -1054,10 +1054,12 @@ def _write_logs(self, pod: k8s.V1Pod, follow: bool =
False, since_time: DateTime
since_seconds = None
if since_time:
try:
+ if isinstance(since_time, str):
+ since_time =
datetime.datetime.fromisoformat(since_time.replace("Z", "+00:00"))
since_seconds = math.ceil(
(datetime.datetime.now(tz=datetime.timezone.utc) -
since_time).total_seconds()
)
Review Comment:
I think this is a false-positive. We do not want to change annotation but we
assume from K8s API there migth be a string coming (even if we do not want).
Can you add a note so that the history is clear? e.g. like:
```suggestion
if isinstance(since_time, str): # against interface spec
but accept string as safeguard
since_time =
datetime.datetime.fromisoformat(since_time.replace("Z", "+00:00"))
since_seconds = math.ceil(
(datetime.datetime.now(tz=datetime.timezone.utc) -
since_time).total_seconds()
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]