shakemap.utils.dependencies¶
-
class
shakemap.utils.dependencies.
DepNode
(deps, cmd, child=None)[source]¶ Bases:
object
A helper class to create a dependency tree made up of “nodes” with parents, children, and data.
Create a new node. When called without a child node, this will be the root node of a tree. When called with a child, this node will be a parent of the child node.
- Parameters:
-
parents
()[source]¶ Returns the parents of the calling node.
- Parameters:
none –
- Returns:
Returns a list of parent nodes of the calling node.
- Return type:
-
child
()[source]¶ Returns the child of the calling node.
- Parameters:
none –
- Returns:
Returns the child node of the calling node or None if the calling node is the root.
- Return type:
class DepNode or None
-
deps
()[source]¶ Returns the dependency list of the calling node.
- Parameters:
none –
- Returns:
- A list of (file (str), required (bool)) tuples that are the
dependencies of the node’s cmd.
- Return type:
-
cmd
()[source]¶ Returns the command stored in the calling node.
- Parameters:
none –
- Returns:
The command stored in the node.
- Return type:
-
class
shakemap.utils.dependencies.
CommandDatabase
(classes, eventid, install_path=None, data_path=None)[source]¶ Bases:
object
A class to keep track of dependencies.
Create a new (or open an exsiting) dependency database for checking the status of command dependencies.
- Parameters:
- Returns:
An instance of the CommandDatabase class.
- Return type:
class CommandDatabase
-
getDependencyStatus
(cmd)[source]¶ Return the status of the specified command and its ancestors.
- Parameters:
cmd (str) – The command name of one of the configured modules for shake (i.e., the “coremods”)
- Returns:
A list of tuples of type (command, status) where the status is one of:
- missing-depencencies: the command cannot run because of
missing dependencies
- out-of-date: the dependencies are newer than the output, so
the command should be run
okay: The output is up to date relative to the dependencies
- Return type: