gws.base.exporter.worker¶
Export job worker.
Source code: gws.base.exporter.worker
Module Contents¶
- class gws.base.exporter.worker.Object(root: gws.Root, user: gws.User, job: gws.Job | None, request: gws.ExportRequest)¶
Bases:
gws.base.job.worker.ObjectExport job worker.
Loads the requested features, runs the exporter and stores the export result in the job. Progress is reported in percent, one step for loading, one per feature and one for writing.
- project: gws.Project¶
Project of the request.
- request: gws.ExportRequest¶
Export request.
- result: gws.ExportResult¶
Export result, filled by the exporter.
- load_features()¶
Load the requested features.
Features of models with the
clientexport strategy are built from the request props, others are read from their models by uid. Features of unknown models and features that are not found are skipped with a warning.- Returns:
The features, in the order of the request.
- notify(event, details=None)¶
Advance the progress by one step and update the job.
- Parameters:
event – Event name, not used.
details – Event details, not used.
- Raises:
gws.JobTerminated – If the job was cancelled or removed.
- classmethod run(root: gws.Root, job: gws.Job)¶
Run an export job.
Called by the job manager. Reads the request from the file given in the job payload.
- Parameters:
root – Root object.
job – The job.
- work()¶
Run the export and store the result in the job, if there is one.
- Raises:
gws.NotFoundError – If the project or the exporter does not exist.
gws.ForbiddenError – If the user cannot read the project.
gws.JobTerminated – If the job was cancelled or removed.