zaku.server
Task Server¶
- class zaku.server.Redis[source]¶
Bases:
ParamsProtoRedis Configuration for the TaskServer class.
- We support both direct connection to a single redis server,
and a high availability setup using Redis Sentinel. The latter require setting up a replica set and a group of sentinels.
Single Redis Server Usage¶
# Put this into an .env file REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=xxxxxxxxxxxxxxxxxxx REDIS_DB=0
CLI Options:
--redis.host :str 'localhost' --redis.port :int 6379 --redis.password :any None --redis.db :any 0
Sentinel Usage (High availability setup)¶
# Put this into an .env file SENTINEL_HOSTs=host1:port1,host2:port2 # <=== Notice it is plural. # This is a comma separated list of hosts. SENTINEL_PASSWORD=xxxxxxxxxxxxxxxxxxx. # <=== This is the password for the sentinels. sentinel_cluster_name=primary # <=== This is the name of the redis cluster. SENTINEL_DB=0 # <=== This is the logical database.
CLI Options:
--redis.sentinel_hosts :str 'localhost' --redis.sentinel_password :any None --redis.sentinel_db :any 0
Common Errors:¶
Setting keepalive: ConnectionError is due to timeout. See below for more infomation.
- host = 'localhost'¶
- port = 6379¶
- password = None¶
- sentinel_hosts = None¶
- sentinel_password = Proto(default=Proto(default=None, dtype=None, help=':any None ', metavar='\x08'), dtype=<class 'params_proto.proto.Proto'>, help=":Proto Proto(default=None, dtype=None, help=':any... ", metavar='\x08')¶
- cluster_name = 'primary'¶
- shuffle = False¶
- db = 0¶
- health_check_interval = 10¶
- socket_connect_timeout = 5¶
- retry_on_timeout = True¶
- socket_keepalive = True¶
- class zaku.server.TaskServer[source]¶
Bases:
ParamsProto,ServerTaskServer
This is the server that maintains the Task Queue.
Usage
app = TaskServer() app.run()
CLI Options
python -m zaku.server --help -h, --help show this help message and exit --prefix :str 'Zaku-task-queues' --queue-len :int 100 --host :str 'localhost' set to 0.0.0.0 to enable remote (not localhost) connections. --port :int 9000 --cors :str 'https://vuer.ai,https://dash.ml,http://lo... --cert :str None the path to the SSL certificate --key :str None the path to the SSL key --ca-cert :str None the trusted root CA certificates --REQUEST-MAX-SIZE :int 100000000 the maximum packet size --free-port :bool False kill process squatting target port if True. --static-root :str '.' --verbose :bool False show the list of configurations during launch if True.- prefix = 'Zaku-task-queues'¶
- queue_len = 100¶
- host: str = 'localhost'¶
- port: int = 9000¶
- cors: str = 'https://vuer.ai,https://dash.ml,http://localhost:8000,http://127.0.0.1:8000,*'¶
Enable CORS
- cert: str = None¶
the path to the SSL certificate
- key: str = None¶
the path to the SSL key
- ca_cert: str = None¶
the trusted root CA certificates
- REQUEST_MAX_SIZE = 100000000¶
- free_port = None¶
- static_root = '.'¶
- verbose = None¶
- WEBSOCKET_MAX_SIZE = 268435456¶