HWRF
trunk@4391
|
Implements the produtil.run: provides the object tree for representing shell commands. More...
Implements the produtil.run: provides the object tree for representing shell commands.
Do not load this module directly except for type checking (instanceof(o,produtil.prog.Runner)). It is meant to be used only by the produtil.run module. This module is part of the implementation of a shell-like syntax for running programs. The rest of the implementation is in the produtil.run and produtil.pipeline modules. MPI programs are implemented by the produtil.mpiprog and produtil.mpi_impl.
This module implements a shell-like syntax of running shell programs from Python. This module should not be used directly: the produtil.run implements critical parts of the functionality. Specifically, this module implements the Runner and ImmutableRunner classes. It also knows how to convert them to produtil.pipeline.Pipeline objects for actual execution.
Note that the actual work of creating the Runner or ImmutableRunner, or turning them into Pipeline objects done by the produtil.run module. Turning MPI programs into Runner objects is done by the produtil.mpiprog module and produtil.mpi_impl package, with the public interface in produtil.run. Hence, nobody would ever load this module directly, except for type checking (ie.: to see if your argument is a Runner before passing it to produtil.run.checkrun)..
Classes | |
class | EqualInEnv |
Raised when converting a Runner or pipeline of Runners to a POSIX sh string if there is an equal ("=") sign in an environment variable name. More... | |
class | EqualInExecutable |
Raised when converting a Runner or pipeline of Runners to a posix sh string if a Runner's executable contains an equal ("=") sign. More... | |
class | FileOpener |
This is part of the internal implementation of Runner, used to convert it to a produtil.pipeline.Pipeline for execution. More... | |
class | ImmutableRunner |
An copy-on-write version of Runner. More... | |
class | InvalidPipeline |
Raised when the caller specifies an invalid input or output when piping a Runner into or out of another object. More... | |
class | MultipleStderr |
Raised when the caller specifies more than one destination for a Runner's stderr. More... | |
class | MultipleStdin |
Raised when the caller specifies more than one source for the stdin of a Runner. More... | |
class | MultipleStdout |
Raised when the caller specifies more than one destination for a Runner's stdout. More... | |
class | NoSuchRedirection |
Raised when trying to convert a pipeline of Runners to a POSIX sh string, if a redirection in the pipeline cannot be expressed in POSIX sh. More... | |
class | NotValidPosixSh |
Base class of exceptions that are raised when converting a Runner or pipeline of Runners to a POSIX sh command, if the Runner cannot be expressed as POSIX sh. More... | |
class | NotValidPosixShString |
Raised when converting a Runner or pipeline of Runners to a POSIX sh string. More... | |
class | OutIsError |
Instructs a Runner to send stderr to stdout. More... | |
class | OverspecifiedStream |
Raised when one tries to specify the stdout, stderr or stdin to go to, or come from, more than one location. More... | |
class | ProgSyntaxError |
Base class of exceptions raised when a Runner is given arguments that make no sense. More... | |
class | Runner |
Represents a single stage of a pipeline to execute. More... | |
class | StreamGenerator |
This is part of the internal implementation of Runner, and is used to convert it to a produtil.pipeline.Pipeline for execution. More... | |
class | StreamReuser |
Arranges for a stream-like object to be sent to the stdout, stderr or stdin of a Runner. More... | |
class | StringInput |
Represents sending a string to a process's stdin. More... | |
Functions | |
def | shvarok (s) |
Returns True if the specified environment variable name is a valid POSIX sh variable name, and False otherwise. More... | |
def | shstrok (s) |
Returns True if the specified string can be expressed as a POSIX sh string, and false otherwise. More... | |
def | shbackslash (s) |
Given a Python str, returns a backslashed POSIX sh string, or raises NotValidPosixShString if that cannot be done. More... | |
def produtil.prog.shbackslash | ( | s | ) |
Given a Python str, returns a backslashed POSIX sh string, or raises NotValidPosixShString if that cannot be done.
s | a string to backslash |
Definition at line 105 of file prog.py.
Referenced by produtil.prog.FileOpener.to_shell(), produtil.prog.StringInput.to_shell(), produtil.mpiprog.MPIRank.to_shell(), and produtil.prog.Runner.to_shell().
def produtil.prog.shstrok | ( | s | ) |
Returns True if the specified string can be expressed as a POSIX sh string, and false otherwise.
s | a string |
Definition at line 95 of file prog.py.
Referenced by produtil.prog.shbackslash().