Classes
DistributedRunner
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
worker_cls | type[DistributedWorker] | \<class 'fal.distributed.worker.DistributedWorker'\> | - |
world_size | int | 1 | - |
master_addr | str | '127.0.0.1' | - |
master_port | int | 29500 | - |
worker_addr | str | '127.0.0.1' | - |
worker_port | int | 54923 | - |
timeout | int | 86400 | - |
keepalive_payload | dict[str, Any] | \{\} | - |
keepalive_interval | int | float | NoneType | None | - |
cwd | str | Path | NoneType | None | - |
set_device | Optional[bool] | None | - |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
zmq_socket | Optional[Socket[Any]] | - | - |
context | Optional[mp.ProcessContext] | - | - |
keepalive_timer | Optional[KeepAliveTimer] | - | - |
Methods
Methods
close_zmq_socket
NoneTypeensure_alive
NoneTypegather_errors
list[Exception]get_zmq_socket
A ZeroMQ socket.invoke
| Parameter | Type | Default | Description |
|---|---|---|---|
payload | dict[str, Any] | \{\} | The payload to send to the worker. |
timeout | Optional[int] | None | The timeout for the overall operation. |
Anyis_alive
boolkeepalive
| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | int | float | NoneType | 60.0 | - |
NoneTypemaybe_cancel_keepalive
NoneTypemaybe_reset_keepalive
NoneTypemaybe_start_keepalive
NoneTyperun
torch.multiprocessing.spawn. This method must be synchronous.| Parameter | Type | Default | Description |
|---|---|---|---|
kwargs | Any | - | The arguments to pass to the worker. |
NoneTypestart
| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | int | 1800 | The timeout for the distributed processes. |
kwargs | Any | - | - |
NoneTypestop
| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | int | 10 | The timeout for the distributed processes to stop. |
NoneTypestream
| Parameter | Type | Default | Description |
|---|---|---|---|
payload | dict[str, Any] | \{\} | The payload to send to the worker. |
timeout | Optional[int] | None | The timeout for the overall operation. |
streaming_timeout | Optional[int] | None | The timeout in-between streamed results. |
as_text_events | bool | False | Whether to yield results as text events. |
AsyncIterator[Any]terminate
| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | int | float | 10 | - |
NoneTypeDistributedWorker
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
rank | int | 0 | - |
world_size | int | 1 | - |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
queue | queue.Queue[bytes] | - | - |
loop | asyncio.AbstractEventLoop | - | - |
thread | threading.Thread | - | - |
Properties
Properties
| Name | Type | Description |
|---|---|---|
device | - | The device for the current worker |
running | bool | Whether the event loop is running |
Methods
Methods
add_streaming_error
| Parameter | Type | Default | Description |
|---|---|---|---|
error | Exception | - | The error to add to the queue. |
NoneTypeadd_streaming_result
| Parameter | Type | Default | Description |
|---|---|---|---|
result | Any | - | The result to add to the queue. |
image_format | str | 'jpeg' | - |
as_text_event | bool | False | - |
NoneTypeinitialize
| Parameter | Type | Default | Description |
|---|---|---|---|
kwargs | Any | - | - |
NoneTyperank_print
| Parameter | Type | Default | Description |
|---|---|---|---|
message | str | - | The message to print. |
debug | bool | False | Whether to print the message as a debug message. |
NoneTyperun_in_worker
| Parameter | Type | Default | Description |
|---|---|---|---|
func | Callable[Ellipsis, Any] | - | - |
args | Any | - | - |
kwargs | Any | - | - |
Future[Any]setup
| Parameter | Type | Default | Description |
|---|---|---|---|
kwargs | Any | - | - |
NoneTypeshutdown
| Parameter | Type | Default | Description |
|---|---|---|---|
timeout | int | float | NoneType | None | The timeout for the shutdown. |
NoneTypesubmit
| Parameter | Type | Default | Description |
|---|---|---|---|
coro | Coroutine[Any, Any, Any] | - | The coroutine to submit to the event loop. |
Future[Any]teardown
NoneType