Skip to content

Commit cd6915b

Browse files
committed
feat: introduce request_timeout
1 parent b301281 commit cd6915b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

projects/fal/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ readme = "README.md"
2323
requires-python = ">=3.8"
2424
dependencies = [
2525
"isolate[build]>=0.13.0,<1.14.0",
26-
"isolate-proto==0.5.3",
26+
"isolate-proto==0.5.4",
2727
"grpcio==1.64.0",
2828
"dill==0.3.7",
2929
"cloudpickle==3.0.0",

projects/fal/src/fal/api.py

+11
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ class FalServerlessHost(Host):
397397
"max_multiplexing",
398398
"setup_function",
399399
"metadata",
400+
"request_timeout",
400401
"_base_image",
401402
"_scheduler",
402403
"_scheduler_options",
@@ -444,6 +445,7 @@ def register(
444445
scheduler = options.host.get("_scheduler", None)
445446
scheduler_options = options.host.get("_scheduler_options", None)
446447
exposed_port = options.get_exposed_port()
448+
request_timeout = options.host.get("request_timeout")
447449

448450
machine_requirements = MachineRequirements(
449451
machine_types=machine_type, # type: ignore
@@ -456,6 +458,7 @@ def register(
456458
max_multiplexing=max_multiplexing,
457459
max_concurrency=max_concurrency,
458460
min_concurrency=min_concurrency,
461+
request_timeout=request_timeout,
459462
)
460463

461464
partial_func = _prepare_partial_func(func)
@@ -516,6 +519,7 @@ def _run(
516519
scheduler_options = options.host.get("_scheduler_options", None)
517520
exposed_port = options.get_exposed_port()
518521
setup_function = options.host.get("setup_function", None)
522+
request_timeout = options.host.get("request_timeout")
519523

520524
machine_requirements = MachineRequirements(
521525
machine_types=machine_type, # type: ignore
@@ -528,6 +532,7 @@ def _run(
528532
max_multiplexing=max_multiplexing,
529533
max_concurrency=max_concurrency,
530534
min_concurrency=min_concurrency,
535+
request_timeout=request_timeout,
531536
)
532537

533538
return_value = _UNSET
@@ -693,6 +698,7 @@ def function(
693698
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
694699
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
695700
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
701+
request_timeout: int | None = None,
696702
setup_function: Callable[..., None] | None = None,
697703
_base_image: str | None = None,
698704
_scheduler: str | None = None,
@@ -719,6 +725,7 @@ def function(
719725
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
720726
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
721727
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
728+
request_timeout: int | None = None,
722729
setup_function: Callable[..., None] | None = None,
723730
_base_image: str | None = None,
724731
_scheduler: str | None = None,
@@ -795,6 +802,7 @@ def function(
795802
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
796803
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
797804
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
805+
request_timeout: int | None = None,
798806
setup_function: Callable[..., None] | None = None,
799807
_base_image: str | None = None,
800808
_scheduler: str | None = None,
@@ -826,6 +834,7 @@ def function(
826834
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
827835
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
828836
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
837+
request_timeout: int | None = None,
829838
setup_function: Callable[..., None] | None = None,
830839
_base_image: str | None = None,
831840
_scheduler: str | None = None,
@@ -851,6 +860,7 @@ def function(
851860
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
852861
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
853862
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
863+
request_timeout: int | None = None,
854864
setup_function: Callable[..., None] | None = None,
855865
_base_image: str | None = None,
856866
_scheduler: str | None = None,
@@ -876,6 +886,7 @@ def function(
876886
keep_alive: int = FAL_SERVERLESS_DEFAULT_KEEP_ALIVE,
877887
max_multiplexing: int = FAL_SERVERLESS_DEFAULT_MAX_MULTIPLEXING,
878888
min_concurrency: int = FAL_SERVERLESS_DEFAULT_MIN_CONCURRENCY,
889+
request_timeout: int | None = None,
879890
setup_function: Callable[..., None] | None = None,
880891
_base_image: str | None = None,
881892
_scheduler: str | None = None,

0 commit comments

Comments
 (0)