pybrook.__main__
¶
PyBrook CLI entrypoint.
ModelChangeEventHandler
¶
Bases: FileSystemEventHandler
Handles model hot-reloading.
Source code in pybrook/__main__.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
brook = brook
instance-attribute
¶
modified = False
instance-attribute
¶
__init__(brook)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
brook |
PyBrook
|
A PyBrook instance. |
required |
Source code in pybrook/__main__.py
54 55 56 57 58 59 60 61 |
|
on_modified(event)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Union[DirModifiedEvent, FileModifiedEvent]
|
Event representing file/directory modification. |
required |
Source code in pybrook/__main__.py
63 64 65 66 67 68 69 70 71 |
|
add_consumer_args(parser, consumers)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parser |
ArgumentParser
|
The main argument parser. |
required |
consumers |
list[BaseStreamConsumer]
|
List of consumers to generate CLI options for. |
required |
Returns:
Type | Description |
---|---|
dict[str, ConsumerConfig]
|
A dictionary of consumer configs filled with defaults. |
dict[str, ConsumerConfig]
|
Consumer group names are used as keys. |
Source code in pybrook/__main__.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
main()
¶
CLI Entrypoint.
Starts PyBrook workers.
Examples:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Source code in pybrook/__main__.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
update_workers_config(args, workers_config)
¶
Updates workers_config
with settings loaded from argparse arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args |
Namespace
|
An argparse |
required |
workers_config |
dict[str, ConsumerConfig]
|
A dictionary of
consumer configs to update using
settings loaded from the |
required |
Returns:
Source code in pybrook/__main__.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|