gpf_entrepot_toolbelt.orchestrator.check_livraison module

Check an upload.

gpf_entrepot_toolbelt.orchestrator.check_livraison.check_livraison_structure(work_dir_path: Path, upload_dir_name: str = 'upload', in_json_file_name: str = 'parameters.json', upload_dir_required: bool = False) bool

Check that the upload (livraison in Entrepôt terminology) is valid. Mainly file and folder structure.

Paramètres:
  • work_dir (Path) – path to the work_dir folder.

  • upload_dir_name (str, optional) – name of the subfolder to look for. Must be a subfolder of work_dir. Defaults to « upload ».

  • in_json_file_name (str, optional) – JSON filename where parameters are stored. Defaults to « parameters.json ».

  • upload_dir_required (bool, optional) – defines if upload_dir is required in the work_dir so its existence has to be checked. Defaults to True.

Renvoie:

True if everything is OK

Type renvoyé:

bool

gpf_entrepot_toolbelt.orchestrator.check_livraison.check_minimum_file(input_path: Path, minimum: int = 1, ignore_extensions: Iterable = ('.md5',), raise_error: bool = True) bool

Check if the input folder path contains at least {minimum} file inside, beside {ignore_extensions}.

Paramètres:
  • input_path (Path) – folder path to look into.

  • minimum (int, optional) – minimum number of files. Defaults to 1.

  • ignore_extensions (Iterable, optional) – file extensions to ignore. Defaults to (« .md5 »,).

  • raise_error (bool, optional) – if True, it raises an exception. Defaults to True.

Lève:

UploadNotEnoughFiles – when the folder contains less than the minimum set and raise_error is False

Renvoie:

True if the minimum of files is reached.

Type renvoyé:

bool