Worker
worker
engine
Engine
Bases: ABC
Source code in src/qgis_server_light/worker/engine.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
available_job_info_classes: dict[str, Type[QslJobInfoParameter]] = {}
instance-attribute
available_runner_classes: dict[str, Type[Runner]] = {}
instance-attribute
available_runner_classes_by_job_info: dict[str, Type[Runner]] = {}
instance-attribute
context = context
instance-attribute
info = self._initialize_infos()
instance-attribute
layer_cache: dict[Any, Any] = {}
instance-attribute
qgis = Qgis(svg_paths, log_level)
instance-attribute
status
property
__del__()
Source code in src/qgis_server_light/worker/engine.py
48 49 | |
__init__(context: EngineContext, runner_plugins: list[str], svg_paths: Optional[List[str]] = None, log_level=logging.WARNING)
Source code in src/qgis_server_light/worker/engine.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
process(job_info: QslJobInfoParameter) -> JobResult
Source code in src/qgis_server_light/worker/engine.py
121 122 123 124 125 126 127 128 129 | |
runner_plugin_by_job_info(job_info: QslJobInfoParameter) -> Type[Runner]
Here we decide which plugin we load dynamically out of the available ones.
Parameters:
-
job_info(QslJobInfoParameter) –Is the parameter instance we check the available worker classes and there the job_info_class at each.
Returns:
-
Type[Runner]–The selected runner class
Source code in src/qgis_server_light/worker/engine.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
set_crashed()
Source code in src/qgis_server_light/worker/engine.py
138 139 | |
set_processing()
Source code in src/qgis_server_light/worker/engine.py
141 142 | |
set_waiting()
Source code in src/qgis_server_light/worker/engine.py
135 136 | |
EngineContext
dataclass
Source code in src/qgis_server_light/worker/engine.py
23 24 25 | |
base_path: Union[str, pathlib.Path]
instance-attribute
__init__(base_path: Union[str, pathlib.Path]) -> None
image_utils
qgis
CredentialsHelper
Bases: QgsCredentials
Source code in src/qgis_server_light/worker/qgis.py
9 10 11 12 13 14 15 16 17 18 19 | |
__init__()
Source code in src/qgis_server_light/worker/qgis.py
10 11 12 | |
request(realm, username, password, message)
Source code in src/qgis_server_light/worker/qgis.py
14 15 16 | |
requestMasterPassword(password, stored)
Source code in src/qgis_server_light/worker/qgis.py
18 19 | |
Qgis(svg_paths: Optional[List[str]], log_level)
Source code in src/qgis_server_light/worker/qgis.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
version() -> int
Source code in src/qgis_server_light/worker/qgis.py
47 48 | |
version_name() -> str
Source code in src/qgis_server_light/worker/qgis.py
51 52 | |
qgis_type_serializer
QDateConverter
Bases: Converter
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
10 11 12 13 14 15 16 17 18 19 20 | |
format = 'yyyy-MM-dd'
class-attribute
instance-attribute
deserialize(value: str, **kwargs: Any) -> QDate
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
13 14 | |
serialize(value: QDate, **kwargs: Any) -> Optional[str]
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
16 17 18 19 20 | |
register_converters_at_runtime()
Source code in src/qgis_server_light/worker/qgis_type_serializer.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
redis
DEFAULT_DATA_ROOT = '/io/data'
module-attribute
DEFAULT_SVG_PATH = '/io/svg'
module-attribute
RedisEngine
Bases: Engine
Source code in src/qgis_server_light/worker/redis.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 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 | |
boot_start = time.time()
instance-attribute
info_expire: int = 300
instance-attribute
max_retries = 11
instance-attribute
retry_wait = 0.01
instance-attribute
shutdown = False
instance-attribute
__init__(context: EngineContext, runner_plugins: list[str], svg_paths: Optional[List] = None) -> None
Source code in src/qgis_server_light/worker/redis.py
28 29 30 31 32 33 34 35 36 37 38 39 | |
exit_connection_error()
staticmethod
Source code in src/qgis_server_light/worker/redis.py
49 50 51 52 | |
exit_gracefully(signum, frame)
Source code in src/qgis_server_light/worker/redis.py
54 55 56 57 | |
heartbeat(client: Redis) -> datetime.datetime
Source code in src/qgis_server_light/worker/redis.py
78 79 80 81 | |
register_worker(client: Redis)
Source code in src/qgis_server_light/worker/redis.py
83 84 85 86 87 88 89 90 91 92 93 | |
retry_connection(redis_url: str, count: int)
Source code in src/qgis_server_light/worker/redis.py
95 96 97 | |
retry_handling_with_jitter(count: int)
Source code in src/qgis_server_light/worker/redis.py
41 42 43 44 45 46 47 | |
run(redis_url)
Source code in src/qgis_server_light/worker/redis.py
119 120 121 122 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 | |
set_job_runtime_status(job_id: str, pipeline: Pipeline, status: str, start_time: float)
staticmethod
Source code in src/qgis_server_light/worker/redis.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
start(redis_url) -> Redis
Source code in src/qgis_server_light/worker/redis.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
main() -> None
Source code in src/qgis_server_light/worker/redis.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
runner
common
JobContext
dataclass
Source code in src/qgis_server_light/worker/runner/common.py
38 39 40 | |
base_path: str | Path
instance-attribute
__init__(base_path: str | Path) -> None
MapRunner
Bases: Runner
Base class for any runner that interacts with a map. Not runnable by itself.
Source code in src/qgis_server_light/worker/runner/common.py
65 66 67 68 69 70 71 72 73 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
context = context
instance-attribute
custom_layer_drivers = ['xyzvectortiles', 'mbtilesvectortiles']
class-attribute
instance-attribute
default_style_name = 'default'
class-attribute
instance-attribute
job_info = job_info
instance-attribute
layer_cache = layer_cache
instance-attribute
map_layers: List[QgsMapLayer] = list()
instance-attribute
qgis = qgis
instance-attribute
raster_layer_drivers = ['gdal', 'wms', 'xyz', 'arcgismapserver', 'wcs']
class-attribute
instance-attribute
vector_layer_drivers = ['ogr', 'postgres', 'spatialite', 'mssql', 'oracle', 'wfs', 'delimitedtext', 'gpx', 'arcgisfeatureserver']
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoParameter, layer_cache: Optional[Dict] = None) -> None
Source code in src/qgis_server_light/worker/runner/common.py
92 93 94 95 96 97 98 99 100 101 102 103 | |
get_cache_name(job_layer_definition: QslJobLayer) -> str
Central method to decide which name is used in the cache to identify a layer.
Source code in src/qgis_server_light/worker/runner/common.py
146 147 148 149 150 | |
Runner
Bases: ABC
Source code in src/qgis_server_light/worker/runner/common.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
job_info_class: Type[QslJobInfoParameter]
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoParameter, layer_cache: Optional[Dict])
Source code in src/qgis_server_light/worker/runner/common.py
46 47 48 49 50 51 52 53 54 | |
deserialize_job_info(job_info: bytes)
classmethod
Source code in src/qgis_server_light/worker/runner/common.py
60 61 62 | |
run()
Source code in src/qgis_server_light/worker/runner/common.py
56 57 58 | |
feature
GetFeatureRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/feature.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
job_info_class = QslJobInfoFeature
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoFeature, layer_cache: Optional[Dict] = None, layer_style_cache: Optional[set] = None) -> None
Source code in src/qgis_server_light/worker/runner/feature.py
32 33 34 35 36 37 38 39 40 | |
run()
Source code in src/qgis_server_light/worker/runner/feature.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
feature_info
GetFeatureInfoRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/feature_info.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 | |
job_info_class = QslJobInfoFeatureInfo
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoFeatureInfo, layer_cache: Optional[Dict] = None) -> None
Source code in src/qgis_server_light/worker/runner/feature_info.py
22 23 24 25 26 27 28 29 | |
run()
Source code in src/qgis_server_light/worker/runner/feature_info.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 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 | |
legend
GetLegendRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/legend.py
5 6 7 8 9 10 11 | |
__init__(qgis, context: JobContext, job_info: QslJobInfoLegend) -> None
Source code in src/qgis_server_light/worker/runner/legend.py
6 7 | |
run()
Source code in src/qgis_server_light/worker/runner/legend.py
9 10 11 | |
process
ProcessRunner
Bases: MapRunner
Source code in src/qgis_server_light/worker/runner/process.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoParameter, layer_cache: Optional[dict])
Source code in src/qgis_server_light/worker/runner/process.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
load_providers(qgis: Qgis)
Source code in src/qgis_server_light/worker/runner/process.py
28 29 30 | |
render
RenderRunner
Bases: MapRunner
Responsible for rendering a QslRenderJob to an image.
Source code in src/qgis_server_light/worker/runner/render.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
job_info_class = QslJobInfoRender
class-attribute
instance-attribute
__init__(qgis: QgsApplication, context: JobContext, job_info: QslJobInfoRender, layer_cache: Optional[Dict] = None) -> None
Source code in src/qgis_server_light/worker/runner/render.py
20 21 22 23 24 25 26 27 | |
image_formats()
classmethod
Source code in src/qgis_server_light/worker/runner/render.py
29 30 31 | |
run()
Run this runner. Returns: A JobResult with the content_type and image_data (bytes) of the rendered image.
Source code in src/qgis_server_light/worker/runner/render.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |