fal 1.29.0__py3-none-any.whl → 1.30.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fal might be problematic. Click here for more details.

fal/_fal_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.29.0'
32
- __version_tuple__ = version_tuple = (1, 29, 0)
31
+ __version__ = version = '1.30.0'
32
+ __version_tuple__ = version_tuple = (1, 30, 0)
33
33
 
34
34
  __commit_id__ = commit_id = None
fal/app.py CHANGED
@@ -337,8 +337,10 @@ class App(BaseServable):
337
337
 
338
338
  def __init__(self, *, _allow_init: bool = False):
339
339
  if not _allow_init and not os.getenv("IS_ISOLATE_AGENT"):
340
+ cls_name = self.__class__.__name__
340
341
  raise NotImplementedError(
341
- "Running apps through SDK is not implemented yet."
342
+ "Running apps through SDK is not implemented yet. "
343
+ f"Please use `fal run path/to/app.py::{cls_name}` to run your app."
342
344
  )
343
345
 
344
346
  @classmethod
fal/cli/apps.py CHANGED
@@ -5,6 +5,7 @@ from dataclasses import asdict
5
5
  from typing import TYPE_CHECKING
6
6
 
7
7
  import fal.cli.runners as runners
8
+ from fal.sdk import RunnerState
8
9
 
9
10
  from ._utils import get_client
10
11
  from .parser import FalClientParser
@@ -298,7 +299,11 @@ def _runners(args):
298
299
  alias_runners = connection.list_alias_runners(alias=args.app_name)
299
300
 
300
301
  runners_table = runners.runners_table(alias_runners)
301
- args.console.print(f"Runners: {len(alias_runners)}")
302
+ pending_runners = [
303
+ runner for runner in alias_runners if runner.state == RunnerState.PENDING
304
+ ]
305
+ args.console.print(f"Runners: {len(alias_runners) - len(pending_runners)}")
306
+ args.console.print(f"Pending Runners: {len(pending_runners)}")
302
307
  # Drop the alias column, which is the first column
303
308
  runners_table.columns.pop(0)
304
309
  args.console.print(runners_table)
fal/cli/deploy.py CHANGED
@@ -142,11 +142,16 @@ def _deploy_from_reference(
142
142
  args.console.print(
143
143
  f"\thttps://{playground_host}/models/{user.username}/{app_name}{endpoint}"
144
144
  )
145
- args.console.print("Endpoints:")
145
+ args.console.print("Synchronous Endpoints:")
146
146
  for endpoint in loaded.endpoints:
147
147
  args.console.print(
148
148
  f"\thttps://{endpoint_host}/{user.username}/{app_name}{endpoint}"
149
149
  )
150
+ args.console.print("Asynchronous Endpoints (Recommended):")
151
+ for endpoint in loaded.endpoints:
152
+ args.console.print(
153
+ f"\thttps://queue.{endpoint_host}/{user.username}/{app_name}{endpoint}"
154
+ )
150
155
 
151
156
 
152
157
  def _deploy(args):
fal/cli/runners.py CHANGED
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import List
4
4
 
5
- from fal.sdk import RunnerInfo
5
+ from fal.sdk import RunnerInfo, RunnerState
6
6
 
7
7
  from ._utils import get_client
8
8
  from .parser import FalClientParser
@@ -19,6 +19,7 @@ def runners_table(runners: List[RunnerInfo]):
19
19
  table.add_column("Expires In")
20
20
  table.add_column("Uptime")
21
21
  table.add_column("Revision")
22
+ table.add_column("State")
22
23
 
23
24
  for runner in runners:
24
25
  external_metadata = runner.external_metadata
@@ -45,6 +46,7 @@ def runners_table(runners: List[RunnerInfo]):
45
46
  ),
46
47
  f"{runner.uptime} ({runner.uptime.total_seconds()}s)",
47
48
  runner.revision,
49
+ runner.state.value,
48
50
  )
49
51
 
50
52
  return table
@@ -82,7 +84,11 @@ def _list(args):
82
84
  client = get_client(args.host, args.team)
83
85
  with client.connect() as connection:
84
86
  runners = connection.list_runners()
85
- args.console.print(f"Runners: {len(runners)}")
87
+ pending_runners = [
88
+ runner for runner in runners if runner.state == RunnerState.PENDING
89
+ ]
90
+ args.console.print(f"Runners: {len(runners) - len(pending_runners)}")
91
+ args.console.print(f"Pending Runners: {len(pending_runners)}")
86
92
  args.console.print(runners_table(runners))
87
93
 
88
94
  requests_table = runners_requests_table(runners)
fal/sdk.py CHANGED
@@ -261,6 +261,21 @@ class AliasInfo:
261
261
  valid_regions: list[str]
262
262
 
263
263
 
264
+ class RunnerState(Enum):
265
+ RUNNING = "running"
266
+ PENDING = "pending"
267
+ UNKNOWN = "unknown"
268
+
269
+ @staticmethod
270
+ def from_proto(proto: isolate_proto.RunnerInfo.State) -> RunnerState:
271
+ if proto is isolate_proto.RunnerInfo.State.RUNNING:
272
+ return RunnerState.RUNNING
273
+ elif proto is isolate_proto.RunnerInfo.State.PENDING:
274
+ return RunnerState.PENDING
275
+ else:
276
+ return RunnerState.UNKNOWN
277
+
278
+
264
279
  @dataclass
265
280
  class RunnerInfo:
266
281
  runner_id: str
@@ -270,6 +285,15 @@ class RunnerInfo:
270
285
  external_metadata: dict[str, Any]
271
286
  revision: str
272
287
  alias: str
288
+ state: RunnerState
289
+
290
+
291
+ @dataclass
292
+ class ServiceURLs:
293
+ playground: str
294
+ run: str
295
+ queue: str
296
+ ws: str
273
297
 
274
298
 
275
299
  @dataclass
@@ -279,12 +303,14 @@ class HostedRunResult(Generic[ResultT]):
279
303
  logs: list[Log] = field(default_factory=list)
280
304
  result: ResultT | None = None
281
305
  stream: Any = None
306
+ service_urls: ServiceURLs | None = None
282
307
 
283
308
 
284
309
  @dataclass
285
310
  class RegisterApplicationResult:
286
311
  result: RegisterApplicationResultType | None
287
312
  logs: list[Log] = field(default_factory=list)
313
+ service_urls: ServiceURLs | None = None
288
314
 
289
315
 
290
316
  @dataclass
@@ -421,6 +447,7 @@ def _from_grpc_runner_info(message: isolate_proto.RunnerInfo) -> RunnerInfo:
421
447
  external_metadata=external_metadata,
422
448
  revision=message.revision,
423
449
  alias=message.alias,
450
+ state=RunnerState.from_proto(message.state),
424
451
  )
425
452
 
426
453
 
@@ -435,6 +462,9 @@ def _from_grpc_register_application_result(
435
462
  if not message.HasField("result")
436
463
  else RegisterApplicationResultType(message.result.application_id)
437
464
  ),
465
+ service_urls=from_grpc(message.service_urls)
466
+ if message.HasField("service_urls")
467
+ else None,
438
468
  )
439
469
 
440
470
 
@@ -445,6 +475,13 @@ def _from_grpc_hosted_run_status(
445
475
  return HostedRunStatus(HostedRunState(message.state))
446
476
 
447
477
 
478
+ @from_grpc.register(isolate_proto.ServiceURLs)
479
+ def _from_grpc_service_urls(
480
+ message: isolate_proto.ServiceURLs,
481
+ ) -> ServiceURLs:
482
+ return ServiceURLs(message.playground, message.run, message.queue, message.ws)
483
+
484
+
448
485
  @from_grpc.register(isolate_proto.HostedRunResult)
449
486
  def _from_grpc_hosted_run_result(
450
487
  message: isolate_proto.HostedRunResult,
@@ -459,6 +496,9 @@ def _from_grpc_hosted_run_result(
459
496
  from_grpc(message.status),
460
497
  logs=[from_grpc(log) for log in message.logs],
461
498
  result=return_value,
499
+ service_urls=from_grpc(message.service_urls)
500
+ if message.HasField("service_urls")
501
+ else None,
462
502
  )
463
503
 
464
504
 
@@ -769,7 +809,7 @@ class FalServerlessConnection:
769
809
  return [from_grpc(alias) for alias in response.aliases]
770
810
 
771
811
  def list_alias_runners(self, alias: str) -> list[RunnerInfo]:
772
- request = isolate_proto.ListAliasRunnersRequest(alias=alias)
812
+ request = isolate_proto.ListAliasRunnersRequest(alias=alias, list_pending=True)
773
813
  response = self.stub.ListAliasRunners(request)
774
814
  return [from_grpc(runner) for runner in response.runners]
775
815
 
@@ -797,6 +837,6 @@ class FalServerlessConnection:
797
837
  self.stub.KillRunner(request)
798
838
 
799
839
  def list_runners(self) -> list[RunnerInfo]:
800
- request = isolate_proto.ListRunnersRequest()
840
+ request = isolate_proto.ListRunnersRequest(list_pending=True)
801
841
  response = self.stub.ListRunners(request)
802
842
  return [from_grpc(runner) for runner in response.runners]
@@ -1,3 +1,4 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from fal.toolkit.utils.download_utils import * # noqa: F403
4
+ from fal.toolkit.utils.setup_utils import patch_onnx_runtime # noqa: F401
@@ -0,0 +1,34 @@
1
+ import os
2
+
3
+
4
+ def patch_onnx_runtime(
5
+ inter_op_num_threads: int = 16,
6
+ intra_op_num_threads: int = 16,
7
+ omp_num_threads: int = 16,
8
+ ):
9
+ """
10
+ Patch ONNX Runtime's defaults to set the number of threads for inter-op,
11
+ intra-op, and OpenMP.Trying to use an ONNX Runtime session within a fal app
12
+ without explicitly setting these parameters can lead to issues, for example,
13
+ it can cause several logs related to these parameters to be printed.
14
+ Please run this function before importing any ONNX Runtime modules
15
+ in your application.
16
+
17
+ Args:
18
+ inter_op_num_threads (int): Number of threads for inter-op parallelism.
19
+ intra_op_num_threads (int): Number of threads for intra-op parallelism.
20
+ omp_num_threads (int): Number of threads for OpenMP parallelism.
21
+
22
+ """
23
+ import onnxruntime as ort
24
+
25
+ os.environ["OMP_NUM_THREADS"] = str(omp_num_threads)
26
+
27
+ _default_session_options = ort.capi._pybind_state.get_default_session_options()
28
+
29
+ def get_default_session_options_new():
30
+ _default_session_options.inter_op_num_threads = inter_op_num_threads
31
+ _default_session_options.intra_op_num_threads = intra_op_num_threads
32
+ return _default_session_options
33
+
34
+ ort.capi._pybind_state.get_default_session_options = get_default_session_options_new
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fal
3
- Version: 1.29.0
3
+ Version: 1.30.0
4
4
  Summary: fal is an easy-to-use Serverless Python Framework
5
5
  Author: Features & Labels <support@fal.ai>
6
6
  Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
8
8
  Requires-Dist: isolate[build]<0.19.0,>=0.18.0
9
- Requires-Dist: isolate-proto<0.11.0,>=0.10.2
9
+ Requires-Dist: isolate-proto<0.13.0,>=0.12.0
10
10
  Requires-Dist: grpcio<2,>=1.64.0
11
11
  Requires-Dist: dill==0.3.7
12
12
  Requires-Dist: cloudpickle==3.0.0
@@ -31,7 +31,7 @@ Requires-Dist: python-dateutil<3,>=2.8.0
31
31
  Requires-Dist: types-python-dateutil<3,>=2.8.0
32
32
  Requires-Dist: importlib-metadata>=4.4; python_version < "3.10"
33
33
  Requires-Dist: msgpack<2,>=1.0.7
34
- Requires-Dist: websockets<13,>=12.0
34
+ Requires-Dist: websockets<16,>=12.0
35
35
  Requires-Dist: pillow<11,>=10.2.0
36
36
  Requires-Dist: pyjwt[crypto]<3,>=2.8.0
37
37
  Requires-Dist: uvicorn<1,>=0.29.0
@@ -1,10 +1,10 @@
1
1
  fal/__init__.py,sha256=wXs1G0gSc7ZK60-bHe-B2m0l_sA6TrFk4BxY0tMoLe8,784
2
2
  fal/__main__.py,sha256=4JMK66Wj4uLZTKbF-sT3LAxOsr6buig77PmOkJCRRxw,83
3
- fal/_fal_version.py,sha256=n_lSuEHJgb4rULoS5dvoiQp1WmyrS2tr5qmwqkMv_jI,706
3
+ fal/_fal_version.py,sha256=z2-YScutuXozpQDoDBzRXepmCAPjCxXPXKoXD3x7ggE,706
4
4
  fal/_serialization.py,sha256=npXNsFJ5G7jzBeBIyVMH01Ww34mGY4XWhHpRbSrTtnQ,7598
5
5
  fal/_version.py,sha256=1BbTFnucNC_6ldKJ_ZoC722_UkW4S9aDBSW9L0fkKAw,2315
6
6
  fal/api.py,sha256=TWUpQICgsRO5aDdRP8A3sFI26P6QM93TobcW9M4E0lQ,47501
7
- fal/app.py,sha256=LktoVpMj3CXR3WCnptakDUvFwOVWsCfstl8wVofovIA,25740
7
+ fal/app.py,sha256=2zCrpSgqWY8kIuxu2RIOeoKC1_dbC3s7Im2qokUq0js,25872
8
8
  fal/apps.py,sha256=pzCd2mrKl5J_4oVc40_pggvPtFahXBCdrZXWpnaEJVs,12130
9
9
  fal/config.py,sha256=1HRaOJFOAjB7fbQoEPCSH85gMvEEMIMPeupVWgrHVgU,3572
10
10
  fal/container.py,sha256=FTsa5hOW4ars-yV1lUoc0BNeIIvAZcpw7Ftyt3A4m_w,2000
@@ -13,7 +13,7 @@ fal/flags.py,sha256=QonyDM7R2GqfAB1bJr46oriu-fHJCkpUwXuSdanePWg,987
13
13
  fal/project.py,sha256=QgfYfMKmNobMPufrAP_ga1FKcIAlSbw18Iar1-0qepo,2650
14
14
  fal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  fal/rest_client.py,sha256=kGBGmuyHfX1lR910EoKCYPjsyU8MdXawT_cW2q8Sajc,568
16
- fal/sdk.py,sha256=tUrwEohQz2B3LN-troH5FcON4VwRnV0zFjB0FRctDBA,26218
16
+ fal/sdk.py,sha256=TdDj86WFWiK1g4g6MdxiA6vbMVc9ix8Iges2UtBGt4g,27406
17
17
  fal/sync.py,sha256=ZuIJA2-hTPNANG9B_NNJZUsO68EIdTH0dc9MzeVE2VU,4340
18
18
  fal/utils.py,sha256=iQTBG3-i6JZgHkkwbY_I4210g0xoW-as51yrke608u0,2208
19
19
  fal/workflows.py,sha256=Zl4f6Bs085hY40zmqScxDUyCu7zXkukDbW02iYOLTTI,14805
@@ -23,12 +23,12 @@ fal/auth/local.py,sha256=sndkM6vKpeVny6NHTacVlTbiIFqaksOmw0Viqs_RN1U,1790
23
23
  fal/cli/__init__.py,sha256=padK4o0BFqq61kxAA1qQ0jYr2SuhA2mf90B3AaRkmJA,37
24
24
  fal/cli/_utils.py,sha256=ulYezhr3G29nTIF8MDQ6tsW01Oj1zPo-YSqMoBi05Ic,1871
25
25
  fal/cli/api.py,sha256=ZuDE_PIC-czzneTAWMwvC7P7WnwIyluNZSuJqzCFhqI,2640
26
- fal/cli/apps.py,sha256=73vLbMTpgadd0p_S6RW8t7NKpTmIMO_W2mYoWbyZvcQ,11008
26
+ fal/cli/apps.py,sha256=pty0v0RIihCeKl1xG9NWIUMTWGhGUJf452x58EfBL-M,11242
27
27
  fal/cli/auth.py,sha256=Qe-Z3ycXJnOzHimz5PjCQYoni8MF4csmdL19yGN7a1o,5171
28
28
  fal/cli/cli_nested_json.py,sha256=veSZU8_bYV3Iu1PAoxt-4BMBraNIqgH5nughbs2UKvE,13539
29
29
  fal/cli/create.py,sha256=a8WDq-nJLFTeoIXqpb5cr7GR7YR9ZZrQCawNm34KXXE,627
30
30
  fal/cli/debug.py,sha256=u_urnyFzSlNnrq93zz_GXE9FX4VyVxDoamJJyrZpFI0,1312
31
- fal/cli/deploy.py,sha256=RB6UZCWE1Jp8rWkepfwQyuAy09Mq-O9rmXjWg7k5DEU,8425
31
+ fal/cli/deploy.py,sha256=JAUi9FtN58pGk3_2JPd84h-RKurLatRjAUxL_Oe0vWo,8701
32
32
  fal/cli/doctor.py,sha256=U4ne9LX5gQwNblsYQ27XdO8AYDgbYjTO39EtxhwexRM,983
33
33
  fal/cli/files.py,sha256=pSgAnTm2eHdP-IPkMIVfnK_Ii7mkSSOVgvbsiFUVBC0,2936
34
34
  fal/cli/keys.py,sha256=7Sf4DT4le89G42eAOt0ltRjbZAtE70AVQ62hmjZhUy0,3059
@@ -36,7 +36,7 @@ fal/cli/main.py,sha256=LnJCe83Fdr5-i3Fkpvrd9BZPjHtcX_H1EEmy6rVlCz8,3180
36
36
  fal/cli/parser.py,sha256=jYsGQ0BLQuKI7KtN1jnLVYKMbLtez7hPjwTNfG3UPSk,2964
37
37
  fal/cli/profile.py,sha256=agyGFQRLHOtzJEdN3Pn9317rg044XaszNCZrf0ELK-8,6016
38
38
  fal/cli/run.py,sha256=nAC12Qss4Fg1XmV0qOS9RdGNLYcdoHeRgQMvbTN4P9I,1202
39
- fal/cli/runners.py,sha256=7efNX9vm6D1aBlg0M5-u5plw3HHC41Sj-N7eRNIHnqw,3689
39
+ fal/cli/runners.py,sha256=4knYZLG5WagdHoBUpjVsh_8BXHebU_rAtlRyRmJDZWI,3976
40
40
  fal/cli/secrets.py,sha256=QKSmazu-wiNF6fOpGL9v2TDYxAjX9KTi7ot7vnv6f5E,2474
41
41
  fal/cli/teams.py,sha256=6fR2rKJtiUJPThP7QsO4NLo9UdhUxraGvQZk3_Di6Ow,1218
42
42
  fal/console/__init__.py,sha256=ernZ4bzvvliQh5SmrEqQ7lA5eVcbw6Ra2jalKtA7dxg,132
@@ -73,10 +73,11 @@ fal/toolkit/image/nsfw_filter/env.py,sha256=iAP2Q3vzIl--DD8nr8o3o0goAwhExN2v0feY
73
73
  fal/toolkit/image/nsfw_filter/inference.py,sha256=BhIPF_zxRLetThQYxDDF0sdx9VRwvu74M5ye6Povi40,2167
74
74
  fal/toolkit/image/nsfw_filter/model.py,sha256=63mu8D15z_IosoRUagRLGHy6VbLqFmrG-yZqnu2vVm4,457
75
75
  fal/toolkit/image/nsfw_filter/requirements.txt,sha256=3Pmrd0Ny6QAeBqUNHCgffRyfaCARAPJcfSCX5cRYpbM,37
76
- fal/toolkit/utils/__init__.py,sha256=CrmM9DyCz5-SmcTzRSm5RaLgxy3kf0ZsSEN9uhnX2Xo,97
76
+ fal/toolkit/utils/__init__.py,sha256=w3Q-9So2HUefk7pU3wMGxhAx2PRsab4mBOxI9JlMmsQ,172
77
77
  fal/toolkit/utils/download_utils.py,sha256=F6oRoP2ynO5xgeRtweVpgJ5xmEhpbKorkXDrakaPpTw,21391
78
78
  fal/toolkit/utils/endpoint.py,sha256=5EXoshA2PD_brjEfhNWAWasjqLOCRrjBnfhj6QGuMt8,782
79
79
  fal/toolkit/utils/retry.py,sha256=0pnKqs1Y2dADMAk2944FZr68ZL3wQC_5hqApfgyMf_8,1531
80
+ fal/toolkit/utils/setup_utils.py,sha256=PuFkswFMUCVgfMawGuhCj4lHS7wX-yXXmAhX7hu-Ijo,1311
80
81
  fal/toolkit/video/__init__.py,sha256=YV0jWpuvoA_CDFQXhd3zOvilFLKH7DYARrbzR7hWhpE,35
81
82
  fal/toolkit/video/video.py,sha256=dHNMdV_zJHiJMzlfIiyDv7tqJBsD32aoc3Ao0t1nKNk,572
82
83
  openapi_fal_rest/__init__.py,sha256=ziculmF_i6trw63LzZGFX-6W3Lwq9mCR8_UpkpvpaHI,152
@@ -142,8 +143,8 @@ openapi_fal_rest/models/workflow_node_type.py,sha256=-FzyeY2bxcNmizKbJI8joG7byRi
142
143
  openapi_fal_rest/models/workflow_schema.py,sha256=4K5gsv9u9pxx2ItkffoyHeNjBBYf6ur5bN4m_zePZNY,2019
143
144
  openapi_fal_rest/models/workflow_schema_input.py,sha256=2OkOXWHTNsCXHWS6EGDFzcJKkW5FIap-2gfO233EvZQ,1191
144
145
  openapi_fal_rest/models/workflow_schema_output.py,sha256=EblwSPAGfWfYVWw_WSSaBzQVju296is9o28rMBAd0mc,1196
145
- fal-1.29.0.dist-info/METADATA,sha256=SiKSUGjpp9TXi3xwebvMXKLZXzUyzwG4BAwrNtX3sAs,4089
146
- fal-1.29.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
147
- fal-1.29.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
148
- fal-1.29.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
149
- fal-1.29.0.dist-info/RECORD,,
146
+ fal-1.30.0.dist-info/METADATA,sha256=TGC06pQWQEN5vwNf81Qzy-NlPuqAhw5Fc4lB1VT6Oz0,4089
147
+ fal-1.30.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
148
+ fal-1.30.0.dist-info/entry_points.txt,sha256=32zwTUC1U1E7nSTIGCoANQOQ3I7-qHG5wI6gsVz5pNU,37
149
+ fal-1.30.0.dist-info/top_level.txt,sha256=r257X1L57oJL8_lM0tRrfGuXFwm66i1huwQygbpLmHw,21
150
+ fal-1.30.0.dist-info/RECORD,,
File without changes