Skip to content

Commit

Permalink
feat(fal): don't scale by default on deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Oct 18, 2024
1 parent 0777cd5 commit e2e50dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 10 additions & 3 deletions projects/fal/src/fal/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def register(
application_auth_mode: Literal["public", "shared", "private"] | None = None,
metadata: dict[str, Any] | None = None,
deployment_strategy: Literal["recreate", "rolling"] = "recreate",
scale: bool = False,
) -> str | None:
environment_options = options.environment.copy()
environment_options.setdefault("python_version", active_python())
Expand All @@ -439,15 +440,21 @@ def register(
"machine_type", FAL_SERVERLESS_DEFAULT_MACHINE_TYPE
)
keep_alive = options.host.get("keep_alive", FAL_SERVERLESS_DEFAULT_KEEP_ALIVE)
max_concurrency = options.host.get("max_concurrency")
min_concurrency = options.host.get("min_concurrency")
max_multiplexing = options.host.get("max_multiplexing")
base_image = options.host.get("_base_image", None)
scheduler = options.host.get("_scheduler", None)
scheduler_options = options.host.get("_scheduler_options", None)
exposed_port = options.get_exposed_port()
request_timeout = options.host.get("request_timeout")

if scale:
max_concurrency = options.host.get("max_concurrency")
min_concurrency = options.host.get("min_concurrency")
max_multiplexing = options.host.get("max_multiplexing")
else:
max_concurrency = None
min_concurrency = None
max_multiplexing = None

machine_requirements = MachineRequirements(
machine_types=machine_type, # type: ignore
num_gpus=options.host.get("num_gpus"),
Expand Down
6 changes: 6 additions & 0 deletions projects/fal/src/fal/cli/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def _deploy_from_reference(
application_auth_mode=app_auth,
metadata=isolated_function.options.host.get("metadata", {}),
deployment_strategy=deployment_strategy,
scale=args.scale,
)

if app_id:
Expand Down Expand Up @@ -219,5 +220,10 @@ def valid_auth_option(option):
help="Deployment strategy.",
default="recreate",
)
parser.add_argument(
"--scale",
action="store_true",
help="Scale the application.",
)

parser.set_defaults(func=_deploy)

0 comments on commit e2e50dc

Please sign in to comment.