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.Object

Export 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.

progressPercent: int = 0

Last reported progress, in percent.

progressStep: int = 0

Current progress step.

progressTotal: int = 1

Total number of progress steps.

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 client export 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: