src.tasks
Runs backend tasks using Celery. Allowing for multiple long-running tasks to complete in the background. Allows the frontend to send tasks and retrieve status later.
Attributes
Classes
Task that switches state to FAILURE if an exception occurs. |
Functions
|
Task to ensure static base data for the given area is added to the database. |
|
Transform a WKT string polygon into a GeoDataFrame. |
Module Contents
- src.tasks.message_broker_url = 'redis://Uninferable:6379/0'
- src.tasks.app
- src.tasks.log
- class src.tasks.OnFailureStateTask
Bases:
app
Task that switches state to FAILURE if an exception occurs.
- on_failure(exc: Exception, _task_id: str, _args: Tuple, _kwargs: Dict, _einfo: billiard.einfo.ExceptionInfo) None
Change state to FAILURE and add exception to task data if an exception occurs.
- Parameters:
exc (Exception) – The exception raised by the task.
- src.tasks.add_base_data_to_db(selected_polygon_wkt: str, base_data_parameters: Dict[str, str]) None
Task to ensure static base data for the given area is added to the database.
- Parameters:
selected_polygon_wkt (str) – The polygon defining the selected area to add base data for. Defined in WKT form.
base_data_parameters (Dict[str, str]) – The parameters from DEFAULT_MODULES_TO_PARAMETERS[retrieve_from_instructions] for the particular module.
- src.tasks.wkt_to_gdf(wkt: str) geopandas.GeoDataFrame
Transform a WKT string polygon into a GeoDataFrame.
- Parameters:
wkt (str) – The WKT form of the polygon to be transformed. In WGS84 CRS (epsg:4326).
- Returns:
The GeoDataFrame form of the polygon after being transformed.
- Return type:
gpd.GeoDataFrame