From 5b2c562152bc84aa22739fb7dfacc5a6258b12cc Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Fri, 19 Jan 2024 22:53:39 +0300 Subject: [PATCH] feat: add fal aliases runners (#46) * feat: add fal aliases runners * don't display counter when it is 0 --- projects/fal/src/fal/cli.py | 29 +++++++ projects/fal/src/fal/sdk.py | 23 ++++++ .../src/isolate_proto/controller.proto | 17 +++++ .../src/isolate_proto/controller_pb2.py | 38 ++++++---- .../src/isolate_proto/controller_pb2.pyi | 75 +++++++++++++++++++ .../src/isolate_proto/controller_pb2_grpc.py | 45 +++++++++++ 6 files changed, 211 insertions(+), 16 deletions(-) diff --git a/projects/fal/src/fal/cli.py b/projects/fal/src/fal/cli.py index 5dc596e8..42034d14 100644 --- a/projects/fal/src/fal/cli.py +++ b/projects/fal/src/fal/cli.py @@ -364,6 +364,7 @@ def _alias_table(aliases: list[AliasInfo]): table.add_column("Max Concurrency") table.add_column("Max Multiplexing") table.add_column("Keep Alive") + table.add_column("Active Workers") for app_alias in aliases: table.add_row( @@ -373,6 +374,7 @@ def _alias_table(aliases: list[AliasInfo]): str(app_alias.max_concurrency), str(app_alias.max_multiplexing), str(app_alias.keep_alive), + str(app_alias.active_runners), ) return table @@ -453,6 +455,33 @@ def alias_update( console.print(table) +@alias_cli.command("runners") +@click.argument("alias", required=True) +@click.pass_obj +def alias_list_runners( + client: api.FalServerlessClient, + alias: str, +): + with client.connect() as connection: + runners = connection.list_alias_runners(alias=alias) + + table = Table(title="Application Runners") + table.add_column("Runner ID") + table.add_column("In Flight Requests") + table.add_column("Expires in") + + for runner in runners: + table.add_row( + runner.runner_id, + str(runner.in_flight_requests), + "N/A (active)" + if not runner.expiration_countdown + else f"{runner.expiration_countdown}s", + ) + + console.print(table) + + @alias_cli.command("scale") @click.argument("alias", required=True) @click.argument("max_concurrency", required=True, type=int) diff --git a/projects/fal/src/fal/sdk.py b/projects/fal/src/fal/sdk.py index 70a221db..fe0bd459 100644 --- a/projects/fal/src/fal/sdk.py +++ b/projects/fal/src/fal/sdk.py @@ -187,6 +187,14 @@ class AliasInfo: keep_alive: int max_concurrency: int max_multiplexing: int + active_runners: int + + +@dataclass +class RunnerInfo: + runner_id: str + in_flight_requests: int + expiration_countdown: int @dataclass @@ -263,6 +271,16 @@ def _from_grpc_alias_info(message: isolate_proto.AliasInfo) -> AliasInfo: keep_alive=message.keep_alive, max_concurrency=message.max_concurrency, max_multiplexing=message.max_multiplexing, + active_runners=message.active_runners, + ) + + +@from_grpc.register(isolate_proto.RunnerInfo) +def _from_grpc_runner_info(message: isolate_proto.RunnerInfo) -> RunnerInfo: + return RunnerInfo( + runner_id=message.runner_id, + in_flight_requests=message.in_flight_requests, + expiration_countdown=message.expiration_countdown, ) @@ -524,6 +542,11 @@ def list_aliases(self) -> list[AliasInfo]: response: isolate_proto.ListAliasesResult = self.stub.ListAliases(request) return [from_grpc(alias) for alias in response.aliases] + def list_alias_runners(self, alias: str) -> list[RunnerInfo]: + request = isolate_proto.ListAliasRunnersRequest(alias=alias) + response = self.stub.ListAliasRunners(request) + return [from_grpc(runner) for runner in response.runners] + def set_secret(self, name: str, value: str) -> None: request = isolate_proto.SetSecretRequest(name=name, value=value) self.stub.SetSecret(request) diff --git a/projects/isolate_proto/src/isolate_proto/controller.proto b/projects/isolate_proto/src/isolate_proto/controller.proto index 711a6302..79513763 100644 --- a/projects/isolate_proto/src/isolate_proto/controller.proto +++ b/projects/isolate_proto/src/isolate_proto/controller.proto @@ -34,6 +34,8 @@ service IsolateController { rpc SetSecret (SetSecretRequest) returns (SetSecretResponse) {} // Lists all secrets rpc ListSecrets (ListSecretsRequest) returns (ListSecretsResponse) {} + // List alias runners in detail + rpc ListAliasRunners (ListAliasRunnersRequest) returns (ListAliasRunnersResponse) {} } message HostedMap { @@ -226,6 +228,7 @@ message AliasInfo { int32 max_concurrency = 4; int32 max_multiplexing = 5; int32 keep_alive = 6; + int32 active_runners = 7; } message SetSecretRequest { @@ -250,3 +253,17 @@ message Secret { message ListSecretsResponse { repeated Secret secrets = 1; } + +message ListAliasRunnersRequest { + string alias = 1; +} + +message ListAliasRunnersResponse { + repeated RunnerInfo runners = 1; +} + +message RunnerInfo { + string runner_id = 1; + int32 in_flight_requests = 2; + int32 expiration_countdown = 3; +} diff --git a/projects/isolate_proto/src/isolate_proto/controller_pb2.py b/projects/isolate_proto/src/isolate_proto/controller_pb2.py index 7e543bfc..aaf98c83 100644 --- a/projects/isolate_proto/src/isolate_proto/controller_pb2.py +++ b/projects/isolate_proto/src/isolate_proto/controller_pb2.py @@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x10\x63ontroller.proto\x12\ncontroller\x1a\x0c\x63ommon.proto\x1a\x0cserver.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto"\xde\x01\n\tHostedMap\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12!\n\x06inputs\x18\x04 \x03(\x0b\x32\x11.SerializedObjectB\x17\n\x15_machine_requirements"\xf6\x01\n\tHostedRun\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x42\x17\n\x15_machine_requirementsB\r\n\x0b_setup_func"\x88\x01\n\x14\x43reateUserKeyRequest\x12\x35\n\x05scope\x18\x01 \x01(\x0e\x32&.controller.CreateUserKeyRequest.Scope\x12\x12\n\x05\x61lias\x18\x02 \x01(\tH\x00\x88\x01\x01"\x1b\n\x05Scope\x12\t\n\x05\x41\x44MIN\x10\x00\x12\x07\n\x03\x41PI\x10\x01\x42\x08\n\x06_alias";\n\x15\x43reateUserKeyResponse\x12\x12\n\nkey_secret\x18\x01 \x01(\t\x12\x0e\n\x06key_id\x18\x02 \x01(\t"\x15\n\x13ListUserKeysRequest"B\n\x14ListUserKeysResponse\x12*\n\tuser_keys\x18\x01 \x03(\x0b\x32\x17.controller.UserKeyInfo"&\n\x14RevokeUserKeyRequest\x12\x0e\n\x06key_id\x18\x01 \x01(\t"\x17\n\x15RevokeUserKeyResponse"\x93\x01\n\x0bUserKeyInfo\x12\x0e\n\x06key_id\x18\x01 \x01(\t\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x05scope\x18\x03 \x01(\x0e\x32&.controller.CreateUserKeyRequest.Scope\x12\r\n\x05\x61lias\x18\x04 \x01(\t"\xb1\x01\n\x0fHostedRunResult\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x30\n\x06status\x18\x02 \x01(\x0b\x32\x1b.controller.HostedRunStatusH\x00\x88\x01\x01\x12\x12\n\x04logs\x18\x03 \x03(\x0b\x32\x04.Log\x12,\n\x0creturn_value\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x42\t\n\x07_statusB\x0f\n\r_return_value"\x80\x01\n\x0fHostedRunStatus\x12\x30\n\x05state\x18\x01 \x01(\x0e\x32!.controller.HostedRunStatus.State";\n\x05State\x12\x0f\n\x0bIN_PROGRESS\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x14\n\x10INTERNAL_FAILURE\x10\x02"\x82\x03\n\x13MachineRequirements\x12\x14\n\x0cmachine_type\x18\x01 \x01(\t\x12\x17\n\nkeep_alive\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nbase_image\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0c\x65xposed_port\x18\x04 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tscheduler\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\x37\n\x11scheduler_options\x18\x08 \x01(\x0b\x32\x17.google.protobuf.StructH\x04\x88\x01\x01\x12\x1d\n\x10max_multiplexing\x18\x06 \x01(\x05H\x05\x88\x01\x01\x12\x1c\n\x0fmax_concurrency\x18\t \x01(\x05H\x06\x88\x01\x01\x42\r\n\x0b_keep_aliveB\r\n\x0b_base_imageB\x0f\n\r_exposed_portB\x0c\n\n_schedulerB\x14\n\x12_scheduler_optionsB\x13\n\x11_max_multiplexingB\x12\n\x10_max_concurrency"\xf5\x03\n\x1aRegisterApplicationRequest\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x12\x1d\n\x10\x61pplication_name\x18\x05 \x01(\tH\x02\x88\x01\x01\x12\x37\n\tauth_mode\x18\x06 \x01(\x0e\x32\x1f.controller.ApplicationAuthModeH\x03\x88\x01\x01\x12 \n\x0fmax_concurrency\x18\x07 \x01(\x05\x42\x02\x18\x01H\x04\x88\x01\x01\x12.\n\x08metadata\x18\x08 \x01(\x0b\x32\x17.google.protobuf.StructH\x05\x88\x01\x01\x42\x17\n\x15_machine_requirementsB\r\n\x0b_setup_funcB\x13\n\x11_application_nameB\x0c\n\n_auth_modeB\x12\n\x10_max_concurrencyB\x0b\n\t_metadata"7\n\x1dRegisterApplicationResultType\x12\x16\n\x0e\x61pplication_id\x18\x01 \x01(\t"z\n\x19RegisterApplicationResult\x12\x12\n\x04logs\x18\x01 \x03(\x0b\x32\x04.Log\x12>\n\x06result\x18\x02 \x01(\x0b\x32).controller.RegisterApplicationResultTypeH\x00\x88\x01\x01\x42\t\n\x07_result"\xc2\x01\n\x18UpdateApplicationRequest\x12\x18\n\x10\x61pplication_name\x18\x01 \x01(\t\x12\x17\n\nkeep_alive\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10max_multiplexing\x18\x03 \x01(\x05H\x01\x88\x01\x01\x12\x1c\n\x0fmax_concurrency\x18\x04 \x01(\x05H\x02\x88\x01\x01\x42\r\n\x0b_keep_aliveB\x13\n\x11_max_multiplexingB\x12\n\x10_max_concurrency"D\n\x17UpdateApplicationResult\x12)\n\nalias_info\x18\x01 \x01(\x0b\x32\x15.controller.AliasInfo"f\n\x0fSetAliasRequest\x12\r\n\x05\x61lias\x18\x01 \x01(\t\x12\x10\n\x08revision\x18\x02 \x01(\t\x12\x32\n\tauth_mode\x18\x03 \x01(\x0e\x32\x1f.controller.ApplicationAuthMode"\x10\n\x0eSetAliasResult"#\n\x12\x44\x65leteAliasRequest\x12\r\n\x05\x61lias\x18\x01 \x01(\t"%\n\x11\x44\x65leteAliasResult\x12\x10\n\x08revision\x18\x01 \x01(\t"\x14\n\x12ListAliasesRequest";\n\x11ListAliasesResult\x12&\n\x07\x61liases\x18\x01 \x03(\x0b\x32\x15.controller.AliasInfo"\xa7\x01\n\tAliasInfo\x12\r\n\x05\x61lias\x18\x01 \x01(\t\x12\x10\n\x08revision\x18\x02 \x01(\t\x12\x32\n\tauth_mode\x18\x03 \x01(\x0e\x32\x1f.controller.ApplicationAuthMode\x12\x17\n\x0fmax_concurrency\x18\x04 \x01(\x05\x12\x18\n\x10max_multiplexing\x18\x05 \x01(\x05\x12\x12\n\nkeep_alive\x18\x06 \x01(\x05">\n\x10SetSecretRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\x05value\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value"\x13\n\x11SetSecretResponse"\x14\n\x12ListSecretsRequest"^\n\x06Secret\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\x0c\x63reated_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x42\x0f\n\r_created_time":\n\x13ListSecretsResponse\x12#\n\x07secrets\x18\x01 \x03(\x0b\x32\x12.controller.Secret*:\n\x13\x41pplicationAuthMode\x12\x0b\n\x07PRIVATE\x10\x00\x12\n\n\x06PUBLIC\x10\x01\x12\n\n\x06SHARED\x10\x02\x32\xe7\x07\n\x11IsolateController\x12=\n\x03Run\x12\x15.controller.HostedRun\x1a\x1b.controller.HostedRunResult"\x00\x30\x01\x12=\n\x03Map\x12\x15.controller.HostedMap\x1a\x1b.controller.HostedRunResult"\x00\x30\x01\x12V\n\rCreateUserKey\x12 .controller.CreateUserKeyRequest\x1a!.controller.CreateUserKeyResponse"\x00\x12S\n\x0cListUserKeys\x12\x1f.controller.ListUserKeysRequest\x1a .controller.ListUserKeysResponse"\x00\x12V\n\rRevokeUserKey\x12 .controller.RevokeUserKeyRequest\x1a!.controller.RevokeUserKeyResponse"\x00\x12h\n\x13RegisterApplication\x12&.controller.RegisterApplicationRequest\x1a%.controller.RegisterApplicationResult"\x00\x30\x01\x12`\n\x11UpdateApplication\x12$.controller.UpdateApplicationRequest\x1a#.controller.UpdateApplicationResult"\x00\x12\x45\n\x08SetAlias\x12\x1b.controller.SetAliasRequest\x1a\x1a.controller.SetAliasResult"\x00\x12N\n\x0b\x44\x65leteAlias\x12\x1e.controller.DeleteAliasRequest\x1a\x1d.controller.DeleteAliasResult"\x00\x12N\n\x0bListAliases\x12\x1e.controller.ListAliasesRequest\x1a\x1d.controller.ListAliasesResult"\x00\x12J\n\tSetSecret\x12\x1c.controller.SetSecretRequest\x1a\x1d.controller.SetSecretResponse"\x00\x12P\n\x0bListSecrets\x12\x1e.controller.ListSecretsRequest\x1a\x1f.controller.ListSecretsResponse"\x00\x62\x06proto3' + b'\n\x10\x63ontroller.proto\x12\ncontroller\x1a\x0c\x63ommon.proto\x1a\x0cserver.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto"\xde\x01\n\tHostedMap\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12!\n\x06inputs\x18\x04 \x03(\x0b\x32\x11.SerializedObjectB\x17\n\x15_machine_requirements"\xf6\x01\n\tHostedRun\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x42\x17\n\x15_machine_requirementsB\r\n\x0b_setup_func"\x88\x01\n\x14\x43reateUserKeyRequest\x12\x35\n\x05scope\x18\x01 \x01(\x0e\x32&.controller.CreateUserKeyRequest.Scope\x12\x12\n\x05\x61lias\x18\x02 \x01(\tH\x00\x88\x01\x01"\x1b\n\x05Scope\x12\t\n\x05\x41\x44MIN\x10\x00\x12\x07\n\x03\x41PI\x10\x01\x42\x08\n\x06_alias";\n\x15\x43reateUserKeyResponse\x12\x12\n\nkey_secret\x18\x01 \x01(\t\x12\x0e\n\x06key_id\x18\x02 \x01(\t"\x15\n\x13ListUserKeysRequest"B\n\x14ListUserKeysResponse\x12*\n\tuser_keys\x18\x01 \x03(\x0b\x32\x17.controller.UserKeyInfo"&\n\x14RevokeUserKeyRequest\x12\x0e\n\x06key_id\x18\x01 \x01(\t"\x17\n\x15RevokeUserKeyResponse"\x93\x01\n\x0bUserKeyInfo\x12\x0e\n\x06key_id\x18\x01 \x01(\t\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x05scope\x18\x03 \x01(\x0e\x32&.controller.CreateUserKeyRequest.Scope\x12\r\n\x05\x61lias\x18\x04 \x01(\t"\xb1\x01\n\x0fHostedRunResult\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12\x30\n\x06status\x18\x02 \x01(\x0b\x32\x1b.controller.HostedRunStatusH\x00\x88\x01\x01\x12\x12\n\x04logs\x18\x03 \x03(\x0b\x32\x04.Log\x12,\n\x0creturn_value\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x42\t\n\x07_statusB\x0f\n\r_return_value"\x80\x01\n\x0fHostedRunStatus\x12\x30\n\x05state\x18\x01 \x01(\x0e\x32!.controller.HostedRunStatus.State";\n\x05State\x12\x0f\n\x0bIN_PROGRESS\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x14\n\x10INTERNAL_FAILURE\x10\x02"\x82\x03\n\x13MachineRequirements\x12\x14\n\x0cmachine_type\x18\x01 \x01(\t\x12\x17\n\nkeep_alive\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nbase_image\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0c\x65xposed_port\x18\x04 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tscheduler\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\x37\n\x11scheduler_options\x18\x08 \x01(\x0b\x32\x17.google.protobuf.StructH\x04\x88\x01\x01\x12\x1d\n\x10max_multiplexing\x18\x06 \x01(\x05H\x05\x88\x01\x01\x12\x1c\n\x0fmax_concurrency\x18\t \x01(\x05H\x06\x88\x01\x01\x42\r\n\x0b_keep_aliveB\r\n\x0b_base_imageB\x0f\n\r_exposed_portB\x0c\n\n_schedulerB\x14\n\x12_scheduler_optionsB\x13\n\x11_max_multiplexingB\x12\n\x10_max_concurrency"\xf5\x03\n\x1aRegisterApplicationRequest\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12\x42\n\x14machine_requirements\x18\x02 \x01(\x0b\x32\x1f.controller.MachineRequirementsH\x00\x88\x01\x01\x12#\n\x08\x66unction\x18\x03 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x04 \x01(\x0b\x32\x11.SerializedObjectH\x01\x88\x01\x01\x12\x1d\n\x10\x61pplication_name\x18\x05 \x01(\tH\x02\x88\x01\x01\x12\x37\n\tauth_mode\x18\x06 \x01(\x0e\x32\x1f.controller.ApplicationAuthModeH\x03\x88\x01\x01\x12 \n\x0fmax_concurrency\x18\x07 \x01(\x05\x42\x02\x18\x01H\x04\x88\x01\x01\x12.\n\x08metadata\x18\x08 \x01(\x0b\x32\x17.google.protobuf.StructH\x05\x88\x01\x01\x42\x17\n\x15_machine_requirementsB\r\n\x0b_setup_funcB\x13\n\x11_application_nameB\x0c\n\n_auth_modeB\x12\n\x10_max_concurrencyB\x0b\n\t_metadata"7\n\x1dRegisterApplicationResultType\x12\x16\n\x0e\x61pplication_id\x18\x01 \x01(\t"z\n\x19RegisterApplicationResult\x12\x12\n\x04logs\x18\x01 \x03(\x0b\x32\x04.Log\x12>\n\x06result\x18\x02 \x01(\x0b\x32).controller.RegisterApplicationResultTypeH\x00\x88\x01\x01\x42\t\n\x07_result"\xc2\x01\n\x18UpdateApplicationRequest\x12\x18\n\x10\x61pplication_name\x18\x01 \x01(\t\x12\x17\n\nkeep_alive\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x1d\n\x10max_multiplexing\x18\x03 \x01(\x05H\x01\x88\x01\x01\x12\x1c\n\x0fmax_concurrency\x18\x04 \x01(\x05H\x02\x88\x01\x01\x42\r\n\x0b_keep_aliveB\x13\n\x11_max_multiplexingB\x12\n\x10_max_concurrency"D\n\x17UpdateApplicationResult\x12)\n\nalias_info\x18\x01 \x01(\x0b\x32\x15.controller.AliasInfo"f\n\x0fSetAliasRequest\x12\r\n\x05\x61lias\x18\x01 \x01(\t\x12\x10\n\x08revision\x18\x02 \x01(\t\x12\x32\n\tauth_mode\x18\x03 \x01(\x0e\x32\x1f.controller.ApplicationAuthMode"\x10\n\x0eSetAliasResult"#\n\x12\x44\x65leteAliasRequest\x12\r\n\x05\x61lias\x18\x01 \x01(\t"%\n\x11\x44\x65leteAliasResult\x12\x10\n\x08revision\x18\x01 \x01(\t"\x14\n\x12ListAliasesRequest";\n\x11ListAliasesResult\x12&\n\x07\x61liases\x18\x01 \x03(\x0b\x32\x15.controller.AliasInfo"\xbf\x01\n\tAliasInfo\x12\r\n\x05\x61lias\x18\x01 \x01(\t\x12\x10\n\x08revision\x18\x02 \x01(\t\x12\x32\n\tauth_mode\x18\x03 \x01(\x0e\x32\x1f.controller.ApplicationAuthMode\x12\x17\n\x0fmax_concurrency\x18\x04 \x01(\x05\x12\x18\n\x10max_multiplexing\x18\x05 \x01(\x05\x12\x12\n\nkeep_alive\x18\x06 \x01(\x05\x12\x16\n\x0e\x61\x63tive_runners\x18\x07 \x01(\x05">\n\x10SetSecretRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\x05value\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value"\x13\n\x11SetSecretResponse"\x14\n\x12ListSecretsRequest"^\n\x06Secret\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\x0c\x63reated_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x42\x0f\n\r_created_time":\n\x13ListSecretsResponse\x12#\n\x07secrets\x18\x01 \x03(\x0b\x32\x12.controller.Secret"(\n\x17ListAliasRunnersRequest\x12\r\n\x05\x61lias\x18\x01 \x01(\t"C\n\x18ListAliasRunnersResponse\x12\'\n\x07runners\x18\x01 \x03(\x0b\x32\x16.controller.RunnerInfo"Y\n\nRunnerInfo\x12\x11\n\trunner_id\x18\x01 \x01(\t\x12\x1a\n\x12in_flight_requests\x18\x02 \x01(\x05\x12\x1c\n\x14\x65xpiration_countdown\x18\x03 \x01(\x05*:\n\x13\x41pplicationAuthMode\x12\x0b\n\x07PRIVATE\x10\x00\x12\n\n\x06PUBLIC\x10\x01\x12\n\n\x06SHARED\x10\x02\x32\xc8\x08\n\x11IsolateController\x12=\n\x03Run\x12\x15.controller.HostedRun\x1a\x1b.controller.HostedRunResult"\x00\x30\x01\x12=\n\x03Map\x12\x15.controller.HostedMap\x1a\x1b.controller.HostedRunResult"\x00\x30\x01\x12V\n\rCreateUserKey\x12 .controller.CreateUserKeyRequest\x1a!.controller.CreateUserKeyResponse"\x00\x12S\n\x0cListUserKeys\x12\x1f.controller.ListUserKeysRequest\x1a .controller.ListUserKeysResponse"\x00\x12V\n\rRevokeUserKey\x12 .controller.RevokeUserKeyRequest\x1a!.controller.RevokeUserKeyResponse"\x00\x12h\n\x13RegisterApplication\x12&.controller.RegisterApplicationRequest\x1a%.controller.RegisterApplicationResult"\x00\x30\x01\x12`\n\x11UpdateApplication\x12$.controller.UpdateApplicationRequest\x1a#.controller.UpdateApplicationResult"\x00\x12\x45\n\x08SetAlias\x12\x1b.controller.SetAliasRequest\x1a\x1a.controller.SetAliasResult"\x00\x12N\n\x0b\x44\x65leteAlias\x12\x1e.controller.DeleteAliasRequest\x1a\x1d.controller.DeleteAliasResult"\x00\x12N\n\x0bListAliases\x12\x1e.controller.ListAliasesRequest\x1a\x1d.controller.ListAliasesResult"\x00\x12J\n\tSetSecret\x12\x1c.controller.SetSecretRequest\x1a\x1d.controller.SetSecretResponse"\x00\x12P\n\x0bListSecrets\x12\x1e.controller.ListSecretsRequest\x1a\x1f.controller.ListSecretsResponse"\x00\x12_\n\x10ListAliasRunners\x12#.controller.ListAliasRunnersRequest\x1a$.controller.ListAliasRunnersResponse"\x00\x62\x06proto3' ) _globals = globals() @@ -33,8 +33,8 @@ _REGISTERAPPLICATIONREQUEST.fields_by_name[ "max_concurrency" ]._serialized_options = b"\030\001" - _globals["_APPLICATIONAUTHMODE"]._serialized_start = 3501 - _globals["_APPLICATIONAUTHMODE"]._serialized_end = 3559 + _globals["_APPLICATIONAUTHMODE"]._serialized_start = 3727 + _globals["_APPLICATIONAUTHMODE"]._serialized_end = 3785 _globals["_HOSTEDMAP"]._serialized_start = 156 _globals["_HOSTEDMAP"]._serialized_end = 378 _globals["_HOSTEDRUN"]._serialized_start = 381 @@ -86,17 +86,23 @@ _globals["_LISTALIASESRESULT"]._serialized_start = 3007 _globals["_LISTALIASESRESULT"]._serialized_end = 3066 _globals["_ALIASINFO"]._serialized_start = 3069 - _globals["_ALIASINFO"]._serialized_end = 3236 - _globals["_SETSECRETREQUEST"]._serialized_start = 3238 - _globals["_SETSECRETREQUEST"]._serialized_end = 3300 - _globals["_SETSECRETRESPONSE"]._serialized_start = 3302 - _globals["_SETSECRETRESPONSE"]._serialized_end = 3321 - _globals["_LISTSECRETSREQUEST"]._serialized_start = 3323 - _globals["_LISTSECRETSREQUEST"]._serialized_end = 3343 - _globals["_SECRET"]._serialized_start = 3345 - _globals["_SECRET"]._serialized_end = 3439 - _globals["_LISTSECRETSRESPONSE"]._serialized_start = 3441 - _globals["_LISTSECRETSRESPONSE"]._serialized_end = 3499 - _globals["_ISOLATECONTROLLER"]._serialized_start = 3562 - _globals["_ISOLATECONTROLLER"]._serialized_end = 4561 + _globals["_ALIASINFO"]._serialized_end = 3260 + _globals["_SETSECRETREQUEST"]._serialized_start = 3262 + _globals["_SETSECRETREQUEST"]._serialized_end = 3324 + _globals["_SETSECRETRESPONSE"]._serialized_start = 3326 + _globals["_SETSECRETRESPONSE"]._serialized_end = 3345 + _globals["_LISTSECRETSREQUEST"]._serialized_start = 3347 + _globals["_LISTSECRETSREQUEST"]._serialized_end = 3367 + _globals["_SECRET"]._serialized_start = 3369 + _globals["_SECRET"]._serialized_end = 3463 + _globals["_LISTSECRETSRESPONSE"]._serialized_start = 3465 + _globals["_LISTSECRETSRESPONSE"]._serialized_end = 3523 + _globals["_LISTALIASRUNNERSREQUEST"]._serialized_start = 3525 + _globals["_LISTALIASRUNNERSREQUEST"]._serialized_end = 3565 + _globals["_LISTALIASRUNNERSRESPONSE"]._serialized_start = 3567 + _globals["_LISTALIASRUNNERSRESPONSE"]._serialized_end = 3634 + _globals["_RUNNERINFO"]._serialized_start = 3636 + _globals["_RUNNERINFO"]._serialized_end = 3725 + _globals["_ISOLATECONTROLLER"]._serialized_start = 3788 + _globals["_ISOLATECONTROLLER"]._serialized_end = 4884 # @@protoc_insertion_point(module_scope) diff --git a/projects/isolate_proto/src/isolate_proto/controller_pb2.pyi b/projects/isolate_proto/src/isolate_proto/controller_pb2.pyi index 298b7b68..f17211c3 100644 --- a/projects/isolate_proto/src/isolate_proto/controller_pb2.pyi +++ b/projects/isolate_proto/src/isolate_proto/controller_pb2.pyi @@ -1056,12 +1056,14 @@ class AliasInfo(google.protobuf.message.Message): MAX_CONCURRENCY_FIELD_NUMBER: builtins.int MAX_MULTIPLEXING_FIELD_NUMBER: builtins.int KEEP_ALIVE_FIELD_NUMBER: builtins.int + ACTIVE_RUNNERS_FIELD_NUMBER: builtins.int alias: builtins.str revision: builtins.str auth_mode: global___ApplicationAuthMode.ValueType max_concurrency: builtins.int max_multiplexing: builtins.int keep_alive: builtins.int + active_runners: builtins.int def __init__( self, *, @@ -1071,10 +1073,13 @@ class AliasInfo(google.protobuf.message.Message): max_concurrency: builtins.int = ..., max_multiplexing: builtins.int = ..., keep_alive: builtins.int = ..., + active_runners: builtins.int = ..., ) -> None: ... def ClearField( self, field_name: typing_extensions.Literal[ + "active_runners", + b"active_runners", "alias", b"alias", "auth_mode", @@ -1206,3 +1211,73 @@ class ListSecretsResponse(google.protobuf.message.Message): ) -> None: ... global___ListSecretsResponse = ListSecretsResponse + +@typing_extensions.final +class ListAliasRunnersRequest(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + ALIAS_FIELD_NUMBER: builtins.int + alias: builtins.str + def __init__( + self, + *, + alias: builtins.str = ..., + ) -> None: ... + def ClearField( + self, field_name: typing_extensions.Literal["alias", b"alias"] + ) -> None: ... + +global___ListAliasRunnersRequest = ListAliasRunnersRequest + +@typing_extensions.final +class ListAliasRunnersResponse(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + RUNNERS_FIELD_NUMBER: builtins.int + @property + def runners( + self, + ) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[ + global___RunnerInfo + ]: ... + def __init__( + self, + *, + runners: collections.abc.Iterable[global___RunnerInfo] | None = ..., + ) -> None: ... + def ClearField( + self, field_name: typing_extensions.Literal["runners", b"runners"] + ) -> None: ... + +global___ListAliasRunnersResponse = ListAliasRunnersResponse + +@typing_extensions.final +class RunnerInfo(google.protobuf.message.Message): + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + RUNNER_ID_FIELD_NUMBER: builtins.int + IN_FLIGHT_REQUESTS_FIELD_NUMBER: builtins.int + EXPIRATION_COUNTDOWN_FIELD_NUMBER: builtins.int + runner_id: builtins.str + in_flight_requests: builtins.int + expiration_countdown: builtins.int + def __init__( + self, + *, + runner_id: builtins.str = ..., + in_flight_requests: builtins.int = ..., + expiration_countdown: builtins.int = ..., + ) -> None: ... + def ClearField( + self, + field_name: typing_extensions.Literal[ + "expiration_countdown", + b"expiration_countdown", + "in_flight_requests", + b"in_flight_requests", + "runner_id", + b"runner_id", + ], + ) -> None: ... + +global___RunnerInfo = RunnerInfo diff --git a/projects/isolate_proto/src/isolate_proto/controller_pb2_grpc.py b/projects/isolate_proto/src/isolate_proto/controller_pb2_grpc.py index 0a8f7bb2..1f1ccce9 100644 --- a/projects/isolate_proto/src/isolate_proto/controller_pb2_grpc.py +++ b/projects/isolate_proto/src/isolate_proto/controller_pb2_grpc.py @@ -74,6 +74,11 @@ def __init__(self, channel): request_serializer=controller__pb2.ListSecretsRequest.SerializeToString, response_deserializer=controller__pb2.ListSecretsResponse.FromString, ) + self.ListAliasRunners = channel.unary_unary( + "/controller.IsolateController/ListAliasRunners", + request_serializer=controller__pb2.ListAliasRunnersRequest.SerializeToString, + response_deserializer=controller__pb2.ListAliasRunnersResponse.FromString, + ) class IsolateControllerServicer(object): @@ -153,6 +158,12 @@ def ListSecrets(self, request, context): context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") + def ListAliasRunners(self, request, context): + """List alias runners in detail""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def add_IsolateControllerServicer_to_server(servicer, server): rpc_method_handlers = { @@ -216,6 +227,11 @@ def add_IsolateControllerServicer_to_server(servicer, server): request_deserializer=controller__pb2.ListSecretsRequest.FromString, response_serializer=controller__pb2.ListSecretsResponse.SerializeToString, ), + "ListAliasRunners": grpc.unary_unary_rpc_method_handler( + servicer.ListAliasRunners, + request_deserializer=controller__pb2.ListAliasRunnersRequest.FromString, + response_serializer=controller__pb2.ListAliasRunnersResponse.SerializeToString, + ), } generic_handler = grpc.method_handlers_generic_handler( "controller.IsolateController", rpc_method_handlers @@ -574,3 +590,32 @@ def ListSecrets( timeout, metadata, ) + + @staticmethod + def ListAliasRunners( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/controller.IsolateController/ListAliasRunners", + controller__pb2.ListAliasRunnersRequest.SerializeToString, + controller__pb2.ListAliasRunnersResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + )