8.1. Building Blocks API Reference

8.1.1. Execution Context API

8.1.2. Application Kernel API

class radical.ensemblemd.Kernel(name, args=None, instance_type=None)[source]
arguments

List of arguments to the kernel as defined by the kernel definition files

copy_input_data

Instructs the kernel to copy one or more files or directories from the execution host’s filesystem into the kernel’s execution directory.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.copy_input_data = ["/location/on/EXECUTION/HOST/data.txt > input.txt"]
copy_output_data

Instructs the application to copy one or more files or directories from the kernel’s execution directory to a directory on the execution host.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.copy_output_data = ["output.txt > /home/me/results/result1.txt"]
cores

The number of cores the kernel is using.

download_input_data

Instructs the kernel to download one or more files or directories from a remote HTTP server into the kernel’s execution directory.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.download_input_data = ["http://REMOTE.WEBSERVER/location/data.txt > input.txt"]

Note

Supported URL types are http:// and https://.

download_output_data

Instructs the application to download one or more files or directories from the kernel’s execution directory back to the host the script is running on.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.download_output_data = ["output.txt > output-run-1.txt"]
exists_remote

Method to check if a kernel output file (or a list of files) exists on remote. This method is useful when using wrappers around executables

get_arg(name)[source]

Returns the value of the kernel argument given by ‘arg_name’.

get_instance_type

Returns the instance_type of the kernel. It can be ‘single’ or ‘multiple’

get_raw_args()[source]

Returns the arguments passed to the kernel.

Instructs the kernel to create a link to one or more files or directories on the execution host’s filesystem in the kernel’s execution directory.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.link_input_data = ["/location/on/EXECUTION/HOST/data.txt > input.txt"]
upload_input_data

Instructs the application to upload one or more files or directories from the host the script is running on into the kernel’s execution directory.

Example:

k = Kernel(name="misc.ccount")
k.arguments = ["--inputfile=input.txt", "--outputfile=output.txt"]
k.upload_input_data = ["/location/on/HOST/RUNNING/THE/SCRIPT/data.txt > input.txt"]

8.1.3. Exceptions & Errors

This module defines and implement all ensemblemd Exceptions.

exception radical.ensemblemd.exceptions.EnsemblemdError(msg)[source]

Bases: exceptions.Exception

EnsemblemdError is the base exception thrown by the ensemblemd library.

exception radical.ensemblemd.exceptions.NotImplementedError(method_name, class_name)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

NotImplementedError is thrown if a class method or function is not implemented.

exception radical.ensemblemd.exceptions.TypeError(expected_type, actual_type)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

TypeError is thrown if a parameter of a wrong type is passed to a method or function.

exception radical.ensemblemd.exceptions.ArgumentError(kernel_name, message, valid_arguments_set)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

A BadArgumentError is thrown if a wrong set of arguments were passed to a kernel.

exception radical.ensemblemd.exceptions.FileError(message)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

FileError is thrown if something goes wrong related to file operations, i.e., if a file doesn’t exist, cannot be copied and so on.

exception radical.ensemblemd.exceptions.NoKernelPluginError(kernel_name)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

NoKernelPluginError is thrown if no kernel plug-in could be found for a given kernel name.

exception radical.ensemblemd.exceptions.NoKernelConfigurationError(kernel_name, resource_key)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

NoKernelConfigurationError is thrown if no kernel configuration could be found for the provided resource key.

exception radical.ensemblemd.exceptions.NoExecutionPluginError(pattern_name, context_name, plugin_name)[source]

Bases: radical.ensemblemd.exceptions.EnsemblemdError

NoExecutionPluginError is thrown if a patterns is passed to an execution context via execut() but no execution plugin for the pattern exist.