Package mbuild :: Module work_queue :: Class command_t
[frames] | no frames]

Class command_t

source code

object --+
         |
        command_t

The primary data structure used to track jobs in this script. It is created when you add plan_t objects to the DAG dag_t.

Instance Methods
 
__init__(self, command=None, args=None, xenv=None, unbufferred=False, output_file_name=None, shell_executable=None, directory=None, name=None, show_output=True, osenv=None, seconds=0, input_file_name=None)
This is the unit of work for the work_queue_t.
source code
 
__str__(self)
str(x)
source code
 
add_after_me(self, n)
Make the current command execute before command n.
source code
 
add_before_me(self, n)
Make the current command execute after command n
source code
 
dagkey(self) source code
 
dump(self, tab_output=False, show_output=True) source code
 
dump_cmd(self) source code
string
elapsed(self)
Return the elapsed time.
source code
 
elapsed_time(self)
Return the elapsed time as an number of seconds
source code
 
execute(self)
Execute the command whether it be a python function or a command string.
source code
bool
failed(self)
Return the exit status.
source code
bool
has_python_subcommand(self)
Return true if the command list has a python function
source code
 
hash(self) source code
bool
is_command_line(self, i=0)
Return true if the command list element is normal string command line.
source code
bool
is_dir_cmd(self, i=0)
Return true if the command list element is a python dir_cmd_t object
source code
bool
is_python_command(self, i=0)
Return true if the command list element is a python function
source code
 
stderr_exists(self) source code
 
stdout_exists(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, command=None, args=None, xenv=None, unbufferred=False, output_file_name=None, shell_executable=None, directory=None, name=None, show_output=True, osenv=None, seconds=0, input_file_name=None)
(Constructor)

source code 

This is the unit of work for the work_queue_t. These are typically created by the dag_t but they can also be created by hand and added to the work_queue_t to execute arbitrary commands.

Parameters:
  • command (string or python function, or a list of both) - command line string to execute or a python function
  • args (anything) - (optional) typically a list of arguments for the python function.
  • xenv (env_t) - (optional) environment for used by the python function. Passed as the second argument to the python function.
  • osenv (dictionary) - (optional) the environment that will be set in the new subprocess.
  • unbufferred (bool) - (optional) true if the output should be unbufferred.
  • output_file_name (string) - (optional) file name for stderr/stdout
  • show_output (bool) - (optional) show output, default True
  • input_file_name (string) - (optional) file name for stdin
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

add_after_me(self, n)

source code 

Make the current command execute before command n.

Parameters:

add_before_me(self, n)

source code 

Make the current command execute after command n

Parameters:

elapsed(self)

source code 

Return the elapsed time.

Returns: string
the elapsed wall clock time of execution.

execute(self)

source code 

Execute the command whether it be a python function or a command string. This is executed by worker threads but is made available here for potential debugging. Record execution exit/return status and output.

Sets the exit_status, output and stderr error fields of the

command object.

failed(self)

source code 

Return the exit status.

Returns: bool
True if the command failed (exit status != 0)