Environment
Classes that represent the environment of a study.
GitDependency
Bases: Dependency
Environment GitDependency class for substituting a git dependency.
Source code in maestrowf/datastructures/environment/gitdependency.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
__init__(name, value, path, token='$', **kwargs)
Initialize the GitDependency class.
The GitDepedency represents a dependency that is stored in a user
accessible remote repository that supports the git protocol. Each
GitDependency acquires itself from its designated remote repository;
otherwise, this class operates like the Variable class and
represents substrings that can be present within String data that are
meant to be replaced. The general format that such items take is
generally expressed as '
Currently, the GitDependency class only supports three optional parameters: branch, hash, and tag. Each operate as their name specifies according to how they would be used in git. The class will acquire the specific repository in accordance with a specified optional (example: if a tag is specfied, the class will clone then checkout the tag). The only caveat to the optionals is that only one may be used at a time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
String name that refers to a GitDependency instance. |
required | |
value |
The URL (SSH or FTP) to the remote git repository. |
required | |
path |
The local path where the copy of the repository is cloned to. |
required | |
token |
String of expected character(s) that appear at the beginning of a substring representing the dependency variable. |
'$'
|
|
kwargs |
Optional keyword arguments - Only valid optionals are "branch", "hash", and "tag". |
{}
|
Source code in maestrowf/datastructures/environment/gitdependency.py
__str__()
Generate the string representation of the object.
Returns:
Type | Description |
---|---|
A string with the token form of the variable. |
acquire(substitutions=None)
Acquire the dependency specified by the PathDependency.
The GitDependency will clone the remote repository specified by the instance's value to the local repository specified by path. If a commit hash is specified, acquire will attempt to rebase to the repository version described by the hash. Alternatively, if a tag is specfied acquire will attempt to checkout the version labeled by the tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
substitutions |
List of Substitution objects that can be applied. |
None
|
Source code in maestrowf/datastructures/environment/gitdependency.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
get_var()
Get the variable representation of the dependency's name.
Returns:
Type | Description |
---|---|
String of the Dependencies's name in token form. |
substitute(data)
Substitute the dependency's value for its notation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
String to substitute dependency into. |
required |
Returns:
Type | Description |
---|---|
String with the dependency's name replaced with its value. |
Source code in maestrowf/datastructures/environment/gitdependency.py
PathDependency
Bases: Dependency
Environment PathDependency class for substituting a path dependency.
Source code in maestrowf/datastructures/environment/pathdependency.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
__init__(name, value, token='$')
Initialize the PathDependency class.
The PathDependency represents a dependency that is stored in the local
file system. These dependencies can be things like shared group folders
or local directories in user space which contain items the study needs
to run. Otherwise, this class operates like the Variable class and
represents substrings that can be present within String data that are
meant to be replaced. The general format that such items take is
generally expressed as '
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
String name that refers to a PathDependency instance. |
required | |
value |
The value to substitute for the PathDependency instance. |
required | |
token |
String of expected character(s) that appear at the beginning of a substring representing the dependency variable. |
'$'
|
Source code in maestrowf/datastructures/environment/pathdependency.py
__str__()
Generate the string representation of the object.
Returns:
Type | Description |
---|---|
A string with the token form of the variable. |
acquire(substitutions=None)
Acquire the dependency specified by the PathDependency.
The PathDependency is simply a path that already exists, so the method doesn't actually acquire anything, but it does verify that the path exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
substitutions |
List of Substitution objects that can be applied. |
None
|
Source code in maestrowf/datastructures/environment/pathdependency.py
get_var()
Get the variable representation of the dependency's name.
Returns:
Type | Description |
---|---|
String of the Dependencies's name in token form. |
substitute(data)
Substitute the dependency's value for its notation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
String to substitute dependency into. |
required |
Returns:
Type | Description |
---|---|
String with the dependency's name replaced with its value. |
Source code in maestrowf/datastructures/environment/pathdependency.py
Script
Bases: Source
Script class for applying changes to the execution environment.
Source code in maestrowf/datastructures/environment/script.py
__init__(source)
Initialize the Script class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
The command for changing the execution environment. |
required |
Source code in maestrowf/datastructures/environment/script.py
apply(cmds)
Apply the Script source to the specified list of commands.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cmds |
List of commands to add source to. |
required |
Returns:
Type | Description |
---|---|
List of commands with the source prepended. |
Source code in maestrowf/datastructures/environment/script.py
Variable
Bases: Substitution
Environment Variable class capable of substituting itself into strings.
Derived from the Substitution EnvObject class which requires that a substitution be able to inject itself into data.
Source code in maestrowf/datastructures/environment/variable.py
__init__(name, value, token='$')
Initialize the Variable class.
The Variable represents substrings that can be present within String
data that are meant to be replaced. The general format that such items
take is generally expressed as '
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
String name that refers to a Variable instance. |
required | |
value |
The value to substitute for the Variable instance. |
required | |
token |
String of expected character(s) that appear at the beginning of a substring representing the variable. |
'$'
|
Source code in maestrowf/datastructures/environment/variable.py
__str__()
Generate the string representation of the objects.
Returns:
Type | Description |
---|---|
A string with the token form of the variable. |
get_var()
Get the variable representation of the variable's name.
Returns:
Type | Description |
---|---|
String of the Variable's name in token form. |
substitute(data)
Substitute the variable's value for its notation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
String to substitute variable into. |
required |
Returns:
Type | Description |
---|---|
String with the variable's name replaced with its value. |