-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Environment
Platform: Vertex AI Pipelines
kfp Python library 2.14.3
When running a Kubeflow pipeline on Vertex AI, if the component has the attribute set_memory_limit, it gets 403 error when exporting the logs to Cloud Logging.
The service account correctly has the "log writer" role. I have other components in the same pipeline, exactly the same but without set_memory_limit, and they work correctly.
task = (
example_component(
attribute1="hello"
).set_memory_limit("50G").set_caching_options(
enable_caching=False
).set_display_name("Test component")
)
@component(
base_image="my-python-image",
packages_to_install=[
"google-cloud-logging==3.12.1",
],
)
def example_component(attribute1: str):
import logging
from google.cloud import logging as cloud_logging
from google.cloud.logging.handlers import CloudLoggingHandler
_client = cloud_logging.Client()
_client.setup_logging(log_level=log_level)
# Remove KFP executor duplicate log in stdout
root_logger = logging.getLogger()
for handler in root_logger.handlers[:]:
# Check if the handler is a standard console stream, but NOT the Cloud handler
if isinstance(handler, logging.StreamHandler) and not isinstance(
handler, CloudLoggingHandler
):
root_logger.removeHandler(handler)
logging.warning("example")
Error logs:
2025-12-12 14:24:50.100 CET
Failed to submit 1 logs.
2025-12-12 14:24:50.100 CET
Traceback (most recent call last):
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/cloud/logging_v2/handlers/transports/background_thread.py", line 122, in _safely_commit_batch
2025-12-12 14:24:50.100 CET
batch.commit()
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/cloud/logging_v2/logger.py", line 507, in commit
2025-12-12 14:24:50.100 CET
client.logging_api.write_entries(
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/cloud/logging_v2/_gapic.py", line 167, in write_entries
2025-12-12 14:24:50.100 CET
self._gapic_api.write_log_entries(request=request)
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/cloud/logging_v2/services/logging_service_v2/client.py", line 1008, in write_log_entries
2025-12-12 14:24:50.100 CET
response = rpc(
2025-12-12 14:24:50.100 CET
^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/gapic_v1/method.py", line 131, in __call__
2025-12-12 14:24:50.100 CET
return wrapped_func(*args, **kwargs)
2025-12-12 14:24:50.100 CET
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 294, in retry_wrapped_func
2025-12-12 14:24:50.100 CET
return retry_target(
2025-12-12 14:24:50.100 CET
^^^^^^^^^^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 156, in retry_target
2025-12-12 14:24:50.100 CET
next_sleep = _retry_error_helper(
2025-12-12 14:24:50.100 CET
^^^^^^^^^^^^^^^^^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/retry/retry_base.py", line 214, in _retry_error_helper
2025-12-12 14:24:50.100 CET
raise final_exc from source_exc
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/retry/retry_unary.py", line 147, in retry_target
2025-12-12 14:24:50.100 CET
result = target()
2025-12-12 14:24:50.100 CET
^^^^^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/timeout.py", line 130, in func_with_timeout
2025-12-12 14:24:50.100 CET
return func(*args, **kwargs)
2025-12-12 14:24:50.100 CET
^^^^^^^^^^^^^^^^^^^^^
2025-12-12 14:24:50.100 CET
File "/workspaces/app/.venv/lib/python3.11/site-packages/google/api_core/grpc_helpers.py", line 78, in error_remapped_callable
2025-12-12 14:24:50.100 CET
raise exceptions.from_grpc_error(exc) from exc
2025-12-12 14:24:50.100 CET
google.api_core.exceptions.PermissionDenied: 403 Permission 'logging.logEntries.create' denied on resource (or it may not exist). [reason: "IAM_PERMISSION_DENIED"
2025-12-12 14:24:50.100 CET
domain: "iam.googleapis.com"
2025-12-12 14:24:50.100 CET
metadata {
2025-12-12 14:24:50.100 CET
key: "permission"
2025-12-12 14:24:50.100 CET
value: "logging.logEntries.create"
2025-12-12 14:24:50.100 CET
}
2025-12-12 14:24:50.100 CET
, type_url: "type.googleapis.com/google.logging.v2.WriteLogEntriesPartialErrors"
2025-12-12 14:24:50.100 CET
value: "\nX\010\000\022T\010\007\022PPermission \'logging.logEntries.create\' denied on resource (or it may not exist)."
2025-12-12 14:24:50.100 CET
]
It has been reported before, but never corrected: #11302