rs_dpr_service/main.md
rs dpr service main module.
DatabaseJobFormatError
Bases: Exception
Exception raised when an error occurred during the init of a provider.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
108 109 | |
JobsFormatError
Bases: Exception
Exception raised when an error occurred during the init of a provider.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
112 113 | |
app_lifespan(fastapi_app)
async
Lifespann app to be implemented with start up / stop logic
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
build_cluster_info(data)
This function handles missing parameters from request, hence properly creates a ClusterInfo object.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
delete_job_endpoint(request, job_id=Annotated[str, Path(..., title='The ID of the job to delete')])
async
Deletes a specific job from the database.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | |
execute_process(request, resource)
async
Used to execute processing jobs.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | |
filter_enabled_resources(config)
Return the usual list of processors in local mode, and a specific one on cluster.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
format_job_data(job)
Method to apply reformatting on job data to make it compliant with OGC (process) standards Args: job: information on a specific job to fromat: the job must have the same attributes than the columns from the PostgreSql database Result: reformatted and validated job_data variable to put in the response
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | |
format_jobs_data(jobs)
Method validate information on all existing jobs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
dict
|
information on all existing jobs |
required |
Result: reformatted and validated jobs_data variable to provide to the response
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | |
get_config_contents()
Return the pygeoapi configuration yaml file contents.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
161 162 163 164 165 166 167 168 169 170 171 172 | |
get_config_path()
Return the pygeoapi configuration path and set the PYGEOAPI_CONFIG env var accordingly.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
154 155 156 157 158 | |
get_enabled_processors()
Return the desired processors. These are set in DPR_ENABLED_PROCESSORS by deployment in rs-helm.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
129 130 131 132 133 134 | |
get_job_logs_endpoint(request, job_id=Annotated[str, Path(..., title='The ID of the job')])
async
Used to stream logs of a processing job.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
get_job_status_endpoint(request, job_id=Annotated[str, Path(..., title='The ID of the job')])
async
Used to get status of processing job.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
476 477 478 479 480 481 482 483 484 485 486 487 | |
get_jobs_endpoint(request)
async
Returns the status of all jobs from database.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
491 492 493 494 495 496 497 498 499 500 501 | |
get_processes(request)
async
Returns list of all available processes from config.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
get_resource(request, resource)
async
Should return info about a specific resource.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
init_db(pause=3, timeout=None)
Initialize the PostgreSQL database connection and sets up required table and ENUM type.
This function constructs the database URL using environment variables for PostgreSQL credentials, host, port, and database name. It then creates an SQLAlchemy engine and registers the ENUM type JobStatus and the 'job' tables if they don't already exist.
Environment Variables
- POSTGRES_USER: Username for database authentication.
- POSTGRES_PASSWORD: Password for the database.
- POSTGRES_HOST: Hostname of the PostgreSQL server.
- POSTGRES_PORT: Port number of the PostgreSQL server.
- POSTGRES_DB: Database name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pause
|
int
|
pause in seconds to wait for the database connection. |
3
|
timeout
|
int | None
|
timeout in seconds to wait for the database connection. |
None
|
Returns:
| Type | Description |
|---|---|
PostgreSQLManager
|
PostgreSQLManager instance |
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
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 | |
init_pygeoapi()
Init pygeoapi
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
175 176 177 | |