rs_dpr_service/main.md¶
rs dpr service main module.
DatabaseJobFormatError
¶
JobsFormatError
¶
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
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
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
execute_process(request, resource)
async
¶
Used to execute processing jobs.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
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
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
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
get_config_contents()
¶
Return the pygeoapi configuration yaml file contents.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
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
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
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
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
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
get_processes(request)
async
¶
Returns list of all available processes from config.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
get_resource(request, resource)
async
¶
Should return info about a specific resource.
Source code in docs/rs-dpr-service/rs_dpr_service/main.py
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 |