Skip to content

Commit 7b6e361

Browse files
authored
fix: fix the merge issue between 1424 and 1373 (#1461)
* fix: fix the merge issue between 1424 and 1373 * Update _function_session.py
1 parent fe72ada commit 7b6e361

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

bigframes/functions/_function_session.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
)
4848

4949
from bigframes import clients
50+
from bigframes import version as bigframes_version
5051
import bigframes.core.compile.ibis_types
5152
import bigframes.exceptions as bfe
5253
import bigframes.series as bf_series
@@ -265,6 +266,13 @@ def remote_function(
265266
.. deprecated:: 0.0.1
266267
This is an internal method. Please use :func:`bigframes.pandas.remote_function` instead.
267268
269+
.. warning::
270+
To use remote functions with Bigframes 2.0 and onwards, please (preferred)
271+
set an explicit user-managed ``cloud_function_service_account`` or (discouraged)
272+
set ``cloud_function_service_account`` to use the Compute Engine service account
273+
by setting it to `"default"`.
274+
See, https://cloud.google.com/functions/docs/securing/function-identity.
275+
268276
.. note::
269277
Please make sure following is setup before using this API:
270278
@@ -445,6 +453,26 @@ def remote_function(
445453
# Some defaults may be used from the session if not provided otherwise.
446454
session = self._resolve_session(session)
447455

456+
# raise a UserWarning if user does not explicitly set cloud_function_service_account to a
457+
# user-managed cloud_function_service_account of to default
458+
msg = bfe.format_message(
459+
"You have not explicitly set a user-managed `cloud_function_service_account`. "
460+
"Using the default Compute Engine service account. "
461+
"To use Bigframes 2.0, please explicitly set `cloud_function_service_account` "
462+
'either to a user-managed service account (preferred) or to `"default"` '
463+
"to use the Compute Engine service account (discouraged). "
464+
"See, https://cloud.google.com/functions/docs/securing/function-identity."
465+
)
466+
467+
if (
468+
bigframes_version.__version__.startswith("1.")
469+
and cloud_function_service_account is None
470+
):
471+
warnings.warn(msg, stacklevel=2, category=FutureWarning)
472+
473+
if cloud_function_service_account == "default":
474+
cloud_function_service_account = None
475+
448476
# A BigQuery client is required to perform BQ operations.
449477
bigquery_client = self._resolve_bigquery_client(session, bigquery_client)
450478

0 commit comments

Comments
 (0)