gpf_entrepot_toolbelt.orchestrator.models.upload module

class gpf_entrepot_toolbelt.orchestrator.models.upload.GpfUpload(_id: str, name: str, type: str, type_infos: dict = <factory>, status: str | None = None, srs: str | None = None, extent: ~gpf_entrepot_toolbelt.orchestrator.models.extent.GpfExtent | None = None, size: int | None = None, storage: ~gpf_entrepot_toolbelt.orchestrator.models.storage.GpfStorage | None = None)

Bases : object

GPF Upload class.

Exemple

output = GpfUpload(
    _id="1231544456-1546546-164565",
    name="input_db",
    type="VECTOR",
    type_infos={}
)
STORAGE_PREFIX = 'uploads'
__init__(_id: str, name: str, type: str, type_infos: dict = <factory>, status: str | None = None, srs: str | None = None, extent: ~gpf_entrepot_toolbelt.orchestrator.models.extent.GpfExtent | None = None, size: int | None = None, storage: ~gpf_entrepot_toolbelt.orchestrator.models.storage.GpfStorage | None = None) None
check_type(allowed_upload_types: list[str]) Status

Function that checks if the upload is one of the right types

Paramètres:

allowed_upload_types (list[str]) – list of allowed types.

Renvoie:

status of the check

Type renvoyé:

Status

extent: GpfExtent = None
classmethod from_dict(val: dict) Self

Load object from a dict.

Args

val (dict): dict value to load

Return

Self: object with attributes filled from dict.

Exemple

stored_data = GpfUpload.from_dict(
        {
            "_id" : "1231544456-1546546-164565",
            "name" : "input_db",
            "type" : "VECTOR",
            "type_infos" : {}
        }
    )
print(stored_data._id)
property fs_path: Path | None

Get the path to the filesystem, or None if upload is NOT on a FILESYSTEM storage type

Renvoie:

path to the filesystem

Type renvoyé:

Union[Path, None]

import_files(dest: Path, strict: bool = True) tuple[list[str], list[str]]

Importe tous les fichiers définis de la stored_data dans le dossier spécifié.

Paramètres:
  • dest (Path) – dossier de destination des fichiers

  • strict (bool, optional) – active le mode strict. Defaults to True.

Lève:

S3IncompleteDownload – si le mode strict est activé et qu’il y a des téléchargements fichiers en erreur

Renvoie:

tuple des listes d’objets téléchargés avec succès et

ceux dont le téléchargement a échoué.

Type renvoyé:

tuple[str, str]

name: str
size: int = None
srs: str = None
status: str = None
storage: GpfStorage = None
property storage_client: GpfS3Client | None

Get an authenticated storage client.

Renvoie:

object storage client

Type renvoyé:

Union[GpfS3Client, None]

to_dict() dict

Convert dataclass object into dictionary. Supersedes dataclass.asdict

Renvoie:

object as dictionary

Type renvoyé:

dict

Exemple

output = GpfUpload(
    _id="1231544456-1546546-164565",
    name="input_db",
    type="VECTOR",
    type_infos={}
)
print(output.to_dict())
type: str
type_infos: dict