libsubprocess: subprocess execution functions

Run subprocess jobs.

class haddock.libs.libsubprocess.BaseJob(input_: Path, output: Path, executable: Path, *args: Any)[source]

Bases: object

Base class for a subprocess job.

make_cmd() None[source]

Execute subprocess job.

run() bytes[source]

Execute job in subprocess.

class haddock.libs.libsubprocess.CNSJob(input_file: str | Path, output_file: str | Path, envvars: dict[str, Any] | None = None, cns_exec: str | Path | None = None)[source]

Bases: object

A CNS job script.

property cns_exec: str | Path

CNS executable path.

property envvars: dict[str, Any]

CNS environment vars.

run(compress_inp: bool = False, compress_out: bool = True, compress_seed: bool = False) bytes[source]

Run this CNS job script.

Parameters:
  • compress_inp (bool) – Compress the *.inp file to ‘.gz’ after the run. Defaults to False.

  • compress_out (bool) – Compress the *.out file to ‘.gz’ after the run. Defaults to True.

  • compress_seed (bool) – Compress the *.seed file to ‘.gz’ after the run. Defaults to False.

class haddock.libs.libsubprocess.Job(input_: Path, output: Path, executable: Path, *args: Any)[source]

Bases: BaseJob

Instantiate a standard job.

Runs with the following scheme:

$ cmd ARGS INPUT

make_cmd() None[source]

Execute subprocess job.

class haddock.libs.libsubprocess.JobInputFirst(input_: Path, output: Path, executable: Path, *args: Any)[source]

Bases: BaseJob

Instantiate a subprocess job with inverted args and input.

Runs with the following scheme, INPUT comes first:

$ cmd INPUT ARGS

make_cmd() None[source]

Execute job in subprocess.