fiber.config
This module deals with Fiber configurations.
There are 3 way of setting Fiber configurations: config file, environment variable and Python code. The priorities are: Python code > environment variable > config file.
Config file¶
Fiber config file is a plain text file following Python's
configparser file
format. It needs to be named .fiberconfig
and put into the directory where
you launch your code.
An example .fiberconfig
file:
[default] log_level=debug log_file=stdout backend=local
Environment variable¶
Alternatively, you can also use environment variables to pass configurations to
Fiber. The environment variable names are in format FIBER_
+ config name in
upper case.
For example, an equivalent way of specifying the above config using environment variables is:
FIBER_LOG_LEVEL=debug FIBER_LOG_FILE=stdout FIBER_BACKEND=local python code.py ...
Python code¶
You can also set Fiber config in your Python code:
import fiber.config as fiber_config ... def main(): fiber_config.log_level = "debug" fiber_config.log_file = "stdout" fiber_config.backend = "local"
Note that almost all of the configurations needs to be set before you launch any Fiber processes.
Config
Config(self, conf_file=None)
Fiber configuration object. Available configurations:
key | Type | Default | Notes |
---|---|---|---|
debug | bool | False | Set this to True to turn on debugging |
image | str | None | Docker image to use when starting new processes |
default_image | str | None | Default docker image to use when image config value is not set |
backend | str | None | Fiber backend to use when starting new processes. Check here for available backends |
default_backend | str | local |
Default Fiber backend to use when backend config is not set |
log_level | str/int | logging.INFO |
Fiber log level. This config accepts either a int value (log levels from logging module like logging.INFO ) or strings: debug , info , warning , error , critical |
log_file | str | /tmp/fiber.log |
Default fiber log file path. Fiber will append the process name to this value and create one log file for each process. A special value stdout means to print the logs to standard output |
ipc_admin_master_port | int | 0 |
The port that master process uses to communicate with child processes. Default value is 0 which means the master process will choose a random port |
kubernetes_namespace | str | default |
The namespace that Fiber kubernetes backend will use to create pods and do other work on Kubernetes |