Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ env:

jobs:
lint:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -52,7 +52,7 @@ jobs:
run: hatch fmt

unit-test:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -70,7 +70,7 @@ jobs:


build:
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
if: ${{ inputs.version != '' }}
needs:
- build
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Download Sdist and Wheel from GitHub
uses: actions/download-artifact@v8
Expand All @@ -133,7 +133,7 @@ jobs:
# The simple docs tool we're using doesn't support versions, so our docs
# will only reflect what's in main.
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
20 changes: 16 additions & 4 deletions crossplane/function/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,21 @@ def cli(cache_size, **kwargs):
def standard_options(func: F) -> F:
"""Apply the standard Composition Function CLI options to a Click command."""

@click.option(
"--max-send-message-size",
type=int,
default=None,
envvar="MAX_SEND_MESSAGE_SIZE",
help="Maximum size of sent gRPC messages in MB. "
"Defaults to --max-recv-message-size.",
)
@click.option(
"--max-recv-message-size",
"--max-grpc-message-size",
type=int,
default=DEFAULT_MAX_RECV_MESSAGE_SIZE,
show_default=True,
envvar="MAX_RECV_MESSAGE_SIZE",
envvar=["MAX_RECV_MESSAGE_SIZE", "MAX_GRPC_MESSAGE_SIZE"],
help="Maximum size of received gRPC messages in MB.",
)
@click.option(
Expand Down Expand Up @@ -107,15 +116,18 @@ def run( # noqa: PLR0913
tls_certs_dir: str | None,
insecure: bool,
max_recv_message_size: int,
max_send_message_size: int | None,
) -> None:
"""Start a composition function gRPC server with standard options."""
level = logging.Level.DEBUG if debug else logging.Level.INFO
logging.configure(level=level)

size_bytes = max_recv_message_size * 1024 * 1024
if max_send_message_size is None:
max_send_message_size = max_recv_message_size

options = [
("grpc.max_receive_message_length", size_bytes),
("grpc.max_send_message_length", size_bytes),
("grpc.max_receive_message_length", max_recv_message_size * 1024 * 1024),
("grpc.max_send_message_length", max_send_message_size * 1024 * 1024),
]

runtime.serve(
Expand Down
1 change: 1 addition & 0 deletions crossplane/function/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def serve(
loop = asyncio.get_event_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

server = grpc.aio.server(options=options)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies = [
"click==8.*",
"grpcio==1.84.0",
"grpcio-reflection==1.*",
"protobuf==7.36.1", # Must be compatible with grpcio-tools.
"protobuf==7.36.2", # Must be compatible with grpcio-tools.
"pydantic==2.*",
"structlog==26.*",
]
Expand Down