run_pipe#

pyCGM2.Mek.pipe.pipe.run_pipe(environment, dependencies_folder, pipeline, destination, session, source, overwrite=True, quiet=False, pipe_exe=None, check=False, timeout=None)#

Build and run the Pipe command.

Parameters:
  • environment (str | Path) – Environment file.

  • dependencies_folder (str | Path | Iterable[str | Path]) – Folder(s) of the pipeline dependencies. Each folder is passed with its own -f flag.

  • pipeline (str) – Pipeline name.

  • destination (str | Path) – Output (h5) file.

  • session (str | Path) – Session (YAML) file.

  • source (str | Path) – Source folder.

  • overwrite (bool, optional) – Overwrite the destination. Defaults to True.

  • quiet (bool, optional) – Quiet mode. Defaults to False.

  • pipe_exe (str | Path, optional) – Path of the Pipe executable. Defaults to the PIPE_EXE environment variable.

  • check (bool, optional) – Raise CalledProcessError on non-zero exit. Defaults to False.

  • timeout (float, optional) – Timeout in seconds. Defaults to None.

Returns:

subprocess.CompletedProcess – Result of the command.

Raises:
  • FileNotFoundError – If the Pipe executable cannot be found.

  • ValueError – If no dependencies folder is given.

Example:

result = run_pipe(
    environment=MOVECK_BASE / envFile,
    dependencies_folder=[MOVECK_BASE / "pipelines", MOVECK_BASE / "custom"],
    pipeline=pipelineName,
    destination=f"{main_path}/{output_h5file}",
    session=f"{main_path}/{output_file}",  # the generated YAML
    source=session_path,
    overwrite=True,
    quiet=True,
)