targetplugins Package¶
dockertarget
Module¶
The module containing the classes describing the targets.
-
class
fastr.resources.plugins.targetplugins.dockertarget.
DockerTarget
(binary, docker_image)[source]¶ Bases:
fastr.core.target.Target
A tool target that is located in a Docker images. Can be run using docker-py. A docker target only need two variables: the binary to call within the docker container, and the docker container to use.
{ "arch": "*", "os": "*", "binary": "bin/test.py", "docker_image": "fastr/test" }
<target os="*" arch="*" binary="bin/test.py" docker_image="fastr/test">
-
__abstractmethods__
= frozenset()¶
-
__init__
(binary, docker_image)[source]¶ Define a new docker target.
Parameters: docker_image (str) – Docker image to use
-
__module__
= 'fastr.resources.plugins.targetplugins.dockertarget'¶
-
container
¶
-
docker_api
= None¶ Docker api to use for docker target
-
monitor_docker
(container, resources)[source]¶ Monitor a docker container and profile the cpu, memory and io use. Register the resource use every _MONITOR_INTERVAL seconds.
Parameters: - container (ContainerCollection) – process to monitor
- resources (ProcessUsageCollection) – list to append measurements to
-
run_command
(command)[source]¶ Run a command with the target
Return type: TargetResult
-
localbinarytarget
Module¶
The module containing the classes describing the targets.
-
class
fastr.resources.plugins.targetplugins.localbinarytarget.
LocalBinaryTarget
(binary, paths=None, environment_variables=None, initscripts=None, modules=None, interpreter=None, **kwargs)[source]¶ Bases:
fastr.core.target.SubprocessBasedTarget
A tool target that is a local binary on the system. Can be found using environmentmodules or a path on the executing machine. A local binary target has a number of fields that can be supplied:
binary (required)
: the name of the binary/script to call, can also be calledbin
for backwards compatibility.modules
: list of modules to load, this can be environmentmodules or lmod modules. If modules are given, thepaths
,environment_variables
andinitscripts
are ignored.paths
: a list of paths to add following the structure{"value": "/path/to/dir", "type": "bin"}
. The types can bebin
if the it should be added to $PATH orlib
if it should be added to te library path (e.g. $LD_LIBRARY_PATH for linux).environment_variables
: a dictionary of environment variables to set.initscript
: a list of script to run before running the main toolinterpreter
: the interpreter to use to call the binary e.g.python
The LocalBinaryTarget will first check if there are modules given and the module subsystem is loaded. If that is the case it will simply unload all current modules and load the given modules. If not it will try to set up the environment itself by using the following steps:
- Prepend the bin paths to $PATH
- Prepend the lib paths to the correct environment variable
- Setting the other environment variables given ($PATH and the system library path are ignored and cannot be set that way)
- Call the initscripts one by one
The definition of the target in JSON is very straightforward:
{ "binary": "bin/test.py", "interpreter": "python", "paths": [ { "type": "bin", "value": "vfs://apps/test/bin" }, { "type": "lib", "value": "./lib" } ], "environment_variables": { "othervar": 42, "short_var": 1, "testvar": "value1" }, "initscripts": [ "bin/init.sh" ], "modules": ["elastix/4.8"] }
In XML the definition would be in the form of:
<target os="linux" arch="*" modules="elastix/4.8" bin="bin/test.py" interpreter="python"> <paths> <path type="bin" value="vfs://apps/test/bin" /> <path type="lib" value="./lib" /> </paths> <environment_variables short_var="1"> <testvar>value1</testvar> <othervar>42</othervar> </environment_variables> <initscripts> <initscript>bin/init.sh</initscript> </initscripts> </target>
-
DYNAMIC_LIBRARY_PATH_DICT
= {'darwin': 'DYLD_LIBRARY_PATH', 'linux': 'LD_LIBRARY_PATH', 'windows': 'PATH'}¶
-
__abstractmethods__
= frozenset()¶
-
__init__
(binary, paths=None, environment_variables=None, initscripts=None, modules=None, interpreter=None, **kwargs)[source]¶ Define a new local binary target. Must be defined either using paths and optionally environment_variables and initscripts, or enviroment modules.
-
__module__
= 'fastr.resources.plugins.targetplugins.localbinarytarget'¶
-
paths
¶
-
run_command
(command)[source]¶ Run a command with the target
Return type: TargetResult
macrotarget
Module¶
The module containing the classes describing the targets.
-
class
fastr.resources.plugins.targetplugins.macrotarget.
MacroTarget
(network_file, method=None, function='main')[source]¶ Bases:
fastr.core.target.Target
A target for MacroNodes. This target cannot be executed as the MacroNode handles execution differently. But this contains the information for the MacroNode to find the internal Network.
-
__abstractmethods__
= frozenset()¶
-
__init__
(network_file, method=None, function='main')[source]¶ Define a new local binary target. Must be defined either using paths and optionally environment_variables and initscripts, or enviroment modules.
-
__module__
= 'fastr.resources.plugins.targetplugins.macrotarget'¶
-
singularitytarget
Module¶
The module containing the classes describing the targets.
-
class
fastr.resources.plugins.targetplugins.singularitytarget.
SingularityTarget
(binary, container, interpreter=None)[source]¶ Bases:
fastr.core.target.SubprocessBasedTarget
A tool target that is run using a singularity container, see the singulary website
binary (required)
: the name of the binary/script to call, can also be calledbin
for backwards compatibility.container (required)
: the singularity container to run, this can be in url form for singularity- pull or as a path to a local container
interpreter
: the interpreter to use to call the binary e.g.python
-
SINGULARITY_BIN
= 'singularity'¶
-
__abstractmethods__
= frozenset()¶
-
__init__
(binary, container, interpreter=None)[source]¶ Define a new local binary target. Must be defined either using paths and optionally environment_variables and initscripts, or enviroment modules.
-
__module__
= 'fastr.resources.plugins.targetplugins.singularitytarget'¶