-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from fal-ai/batuhan/fea-836-expose-grpc-option…
…s-for-internal-isolate feat: support dynamic grpc reconfiguration on all gRPC channels
- Loading branch information
Showing
5 changed files
with
78 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ast | ||
import os | ||
|
||
_GRPC_OPTION_PREFIX = "ISOLATE_GRPC_CALL_" | ||
|
||
|
||
def get_default_options(): | ||
"""Return the default list of GRPC call options (both for | ||
server and client) which are set via environment variables. | ||
Each environment variable starting with `ISOLATE_GRPC_CALL_` | ||
will be converted to a GRPC option. The name of the option | ||
will be the name of the environment variable, with the | ||
`ISOLATE_GRPC_CALL_` prefix removed and converted to lowercase. | ||
""" | ||
|
||
options = [] | ||
for raw_key, raw_value in os.environ.items(): | ||
if raw_key.startswith(_GRPC_OPTION_PREFIX): | ||
field = raw_key[len(_GRPC_OPTION_PREFIX) :].lower() | ||
value = ast.literal_eval(raw_value) | ||
options.append((f"grpc.{field}", value)) | ||
return options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters