API

This section includes information for using the Python API of beat.cmdline.

beat.cmdline.algorithms.pull_impl(webapi, prefix, names, force, indentation, format_cache, lib_cache)[source]

Copies algorithms (and required libraries/dataformats) from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

  • format_cache (dict) – A dictionary containing all dataformats already downloaded.

  • lib_cache (dict) – A dictionary containing all libraries already downloaded.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.algorithms.print_examples()[source]
beat.cmdline.algorithms.execute_impl(prefix, cache, instructions_file)[source]
beat.cmdline.algorithms.get_dependencies(ctx, asset_name)[source]
class beat.cmdline.algorithms.AlgorithmCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = algorithm ['declaration', 'code', 'description'] ['name', 'declaration', 'code', 'description'] <function get_dependencies>
beat.cmdline.cache.get_paths(config)[source]

Utility functions that are useful to all sub-commands

class beat.cmdline.common.ModificationStatus(value)[source]

Bases: Enum

This enum describes the state of possible changes between a local asset and it’s remote counter part

NO_CHANGES = ''
REMOTE_ONLY_AVAILABLE = 'r'
LOCAL_ONLY_AVAILABLE = 'l'
DOC_CHANGED = 'd'
CONTENT_CHANGED = '+'
BOTH_CHANGED = '*'
beat.cmdline.common.recursive_rmdir_if_empty(path, stop_at)[source]

Recursively removes empty directories until a certain top directory

class beat.cmdline.common.Selector(prefix)[source]

Bases: object

Keeps track of versions and fork status

can_fork(asset_type)[source]

Returns whether the given asset type can be forked

has_versions(asset_type)[source]

Returns whether the given asset type can have versions

fork(asset_type, src, dst)[source]

Registers that object dst is a fork of object src

forked_from(asset_type, name)[source]

Returns the name of the originating source object or None

version(asset_type, src, dst)[source]

Registers that object dst is a new version of object src

version_of(asset_type, name)[source]

Returns the name of the originating version object or None

delete(asset_type, name)[source]

Forgets about an object that was being tracked

load()[source]

Loads contents from file

save()[source]

Saves contents to file

beat.cmdline.common.retrieve_remote_list(webapi, asset_type, fields)[source]

Utility function used by commands to retrieve a remote list of objects

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • fields (list) – A list of fields to retrieve from the remote server

Returns

A list of dictionaries containing the name, short_description and hash of available remote objects.

Return type

list

beat.cmdline.common.make_up_remote_list(webapi, asset_type, requirements)[source]

Creates a list of downloadable objects from user requirements.

This function can create a list of downloadable objects from user requirements. User requirements may point to valid object names (in which case these are returned unchanged) or partial object names, which are used to filter available remote resources. A list of fully resolved remote names respecting user restrictions is returned.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • requirements (list) – A list of requirements that are used to filter (additively) the available (remote) objects.

Returns

A list of valid object names matching user requirements

and its order.

Return type

list

beat.cmdline.common.display_remote_list(webapi, asset_type)[source]

Implements a generic “list –remote” command

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest, on behalf of a pre-configured user.

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.make_up_local_list(prefix, asset_type, requirements)[source]

Creates a list of uploadable objects from user requirements.

This function can create a list of uploadable objects from user requirements. User requirements may point to valid object names (in which case these are returned unchanged) or partial object names, which are used to filter available local resources. A list of fully resolved local names respecting user restrictions is returned.

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • requirements (list) – A list of requirements that are used to filter (additively) the available (remote) objects.

Returns

A list of strings, each with the relative name of an

object belonging to a certain category and in the order prescribed by the user.

Return type

list

beat.cmdline.common.display_local_list(prefix, asset_type)[source]

Implements the local “list” command

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.display_local_path(prefix, asset_type, names)[source]

Implements the local “path” command

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.edit_local_file(prefix, editor, asset_type, name)[source]

Implements the local “path” command

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.make_webapi(config)[source]

Instantiates an usable web-api proxy using the command-line configuration

Parameters

config (object) – The command-line configuration object, from which this function will extract the platform, user and token parameters.

Returns

WebAPI: A valid web-api proxy instance

beat.cmdline.common.check_one(prefix, asset_type, name)[source]

Implements object validation for a single, well-defined object

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • name (str) – The name of the object, representing the unique relative path of the objects to check (e.g. user/integer/1)

  • klass (type) – A python class that validates the object. It must accept the object

beat.cmdline.common.check(prefix, asset_type, names)[source]

Implements object validation

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to check. If the list is empty, then we check all available objects of a given type.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.fetch_object(webapi, asset_type, name, fields)[source]

Retrieves a single well-known object from the server

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • name (str) – A string defining the name of the object to retrieve

  • fields (list) – A list of fields to retrieve from the remote server

Returns

A dictionary containing the object contents

Return type

dict

beat.cmdline.common.pull(webapi, prefix, asset_type, names, fields, force, indentation)[source]

Copies objects from the server to the local prefix

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • fields (list) – A list of strings, each defining one field that must be downloaded from the web-server for a given object of the current type and passed, unchanged to the storage save() method. For example, for toolchains, this value shall be ['declaration']. For algorithms, it shall be ['declaration', 'code'].

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

list: A list of strings containing the names of objects

successfuly downloaded or which were already present on the current installation (if the user has chosen not to --force the override), in the order of their download.

Return type

int

beat.cmdline.common.diff(webapi, prefix, asset_type, name, fields)[source]

Shows the differences between two objects, for each of the fields

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • name (str) – A string defining the name of the object to calculate differences from.

  • fields (list) – A list of strings, each defining one field that must be downloaded from the web-server for a given object of the current type. For example, for toolchains, this value shall be ['declaration']. For algorithms, it shall be ['declaration', 'code'].

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.create(prefix, asset_type, names)[source]

Creates an empty object of a certain type under the given name

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (str) – A string defining the names of the objects to create.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.copy(prefix, asset_type, src, dst)[source]

Creates a new object by copying another object of the same type.

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • src (str) – A string defining the name of the object to fork a new version from.

  • dst (str) – A string defining the name of the object to fork to.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.new_version(prefix, asset_type, src)[source]

Creates a new object by copying another object of the same type.

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • src (str) – A string defining the name of the object to fork a new version from.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.fork(prefix, asset_type, src, dst)[source]

Creates a new object by forking another object of the same type.

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • src (str) – A string defining the name of the object to fork from.

  • dst (str) – A string defining the name of the object to fork to.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.delete_local(prefix, asset_type, names)[source]

Deletes a local object of a given type

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to delete.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.delete_remote(webapi, asset_type, names)[source]

Deletes a remote object of a given type

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to delete.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.status(webapi, prefix, asset_type)[source]

Flags objects which have changed

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

list: A list of objects that have local modifications and

should be pushed remotely, eventually.

Return type

int

beat.cmdline.common.push(webapi, prefix, asset_type, names, fields, mappings, force, dry_run, indentation)[source]

Copies objects to the server from the local prefix

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to push or a filtering criteria for local objects. If the list is empty, then we push all available objects of a given type, which have changes. If no user is set, then an error is raised.

  • fields (list) – A list of strings, each defining one field that must be uploaded to the web-server for a given object of the current type. For example, for toolchains, this value shall be ['declaration', 'description']. For algorithms, it shall be ['declaration', 'code', 'description'].

  • mappings (dict) – A dictionary containing mappings from the stock field names to equivalents which are expected by our web interface. This field is required by experiments only.

  • force (bool) – If set to True, then push local changes even if no change is detected on the local copy.

  • dry_run (bool) – If set to True, then only prints what it would do instead of doing it.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

list: A list of strings containing the names of objects

successfuly uploaded or which were already present on the remote server (if the user has chosen not to --force the override), in the order of their upload.

Return type

int

beat.cmdline.common.dot_diagram(prefix, asset_type, names, path, formats)[source]

Dumps DOT (Graphviz) diagrams of the given toolchains/experiments

Parameters
  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • asset_type (str) – One of database, dataformat, algorithm, toolchain or experiment.

  • names (list) – A list of strings, each representing the unique relative path of the objects to push or a filtering criteria for local objects. If the list is empty, then we push all available objects of a given type, which have changes. If no user is set, then an error is raised.

  • path (str) – The directory to use for dumping the drawings. The filenames assigned correspond to the full object name. If not set, the default is to write on the current directory.

  • formats (list) – A list of formats to dump. If not set or set to an empty value, then dump dot/graphviz and png formats.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.common.stringify(value)[source]

Creates a string representation of a baseformat represented as a dict

To avoid overloading the terminal that will print the result of this function, only the first ten elements of lists are processed with visual cues that will show that there’s more to it.

The input variable value is modified in-place.

Parameters

value (dict) – A dictionary representing the baseformat object, obtained as with beat.backend.python.baseformat.baseformat.as_dict(), that represents the object one seeks to represent in string format.

Returns

dict: Modifies the input variable value in-place, but also returns it.

class beat.cmdline.config.Configuration(args)[source]

Bases: object

Keeps track of configuration elements

property path

The directory for the prefix

property cache

The directory for the cache

property database_paths

A dict of paths for databases

set(key, value)[source]

Sets or resets a field in the configuration

save(local=False)[source]

Saves contents to configuration file

Parameters

local – bool, Optional if set to True, then save configuration values to local configuration file (typically .beatrc)

is_database_key(key)[source]
as_dict()[source]
beat.cmdline.databases.load_database_sets(configuration, database_name)[source]
beat.cmdline.databases.start_db_container(configuration, cmd, host, db_name, protocol_name, set_name, database, db_set, excluded_outputs=None, uid=None, db_root=None)[source]
beat.cmdline.databases.pull_impl(webapi, prefix, names, force, indentation, format_cache)[source]

Copies databases (and required dataformats) from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

  • format_cache (dict) – A dictionary containing all dataformats already downloaded.

Returns

Indicating the exit status of the command, to be reported back to

the calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.databases.index_outputs(configuration, names, uid=None, db_root=None, docker=False)[source]
beat.cmdline.databases.list_index_files(configuration, names)[source]
beat.cmdline.databases.delete_index_files(configuration, names)[source]
beat.cmdline.databases.view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None, db_root=None, docker=False)[source]
class beat.cmdline.databases.DatabaseCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = database ['declaration', 'code', 'description'] ['name', 'declaration', 'code', 'description'] None
beat.cmdline.dataformats.pull_impl(webapi, prefix, names, force, indentation, cache)[source]

Copies dataformats (recursively) from the server.

Data formats are particularly tricky to download because of their recursive nature. This requires a specialized recursive technique to download base and referenced dataformats.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

  • cache (dict) – A dictionary containing all dataformats already downloaded.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.dataformats.get_dependencies(ctx, asset_name)[source]
class beat.cmdline.dataformats.DataformatCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = dataformat ['declaration', 'description'] ['name', 'declaration', 'description'] <function get_dependencies>
beat.cmdline.experiments.run_experiment(configuration, name, force, use_docker, use_local, run_environment_path, quiet)[source]

Run experiments locally

beat.cmdline.experiments.caches_impl(configuration, name, ls, delete, checksum)[source]

List all cache files involved in this experiment

beat.cmdline.experiments.pull_impl(webapi, prefix, names, force, indentation, format_cache)[source]

Copies experiments (and required toolchains/algorithms) from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to

the calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.experiments.plot_impl(configuration, names, remote, show, output_folder, plotterparameters)[source]

Plots experiments from the server.

Parameters
  • configuration (object) – An instance of the configuration, to access the BEAT server and current configuration for information

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • remote (bool) – If set to True, then fetch results data for the experiments from the server.

  • show (bool) – If set shows the generated image.

  • output_folder (str) – A string representing the path in which the experiments plot will be stored

beat.cmdline.experiments.get_dependencies(ctx, asset_name)[source]
class beat.cmdline.experiments.ExperimentCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = experiment ['declaration', 'description'] ['name', 'declaration', 'toolchain', 'description'] <function get_dependencies>
exception beat.cmdline.experiments.ProgramKilled[source]

Bases: Exception

CTRL + C has been used

beat.cmdline.experiments.signal_handler(signum, frame)[source]

Basic signal handler for processing keyboard interruption

class beat.cmdline.experiments.ExperimentMonitor(interval, config, name)[source]

Bases: Thread

Thread doing the monitoring of an experiment

stop()[source]

Stop the thread cleanly

run()[source]

Periodically calls the platform instance to get the status of the selected experiment.

beat.cmdline.experiments.replace_line(pad, line, text)[source]

Replaces the content of a ncurses pad line

beat.cmdline.experiments.process_input(monitor, pad, delta, pad_height, height, width)[source]

Processes the keyboard input of an ncurses pad

beat.cmdline.libraries.pull_impl(webapi, prefix, names, force, indentation, cache)[source]

Copies libraries (and dependent libraries) from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

  • cache (dict) – A dictionary containing all libraries already downloaded.

Returns

Indicating the exit status of the command, to be reported back to the

calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.libraries.get_dependencies(ctx, asset_name)[source]
class beat.cmdline.libraries.LibraryCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = library ['declaration', 'code', 'description'] ['name', 'declaration', 'code', 'description'] <function get_dependencies>
beat.cmdline.plotters.pull_impl(webapi, prefix, names, force, indentation, format_cache)[source]

Copies plotters from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to

the calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

beat.cmdline.plotters.plot_impl(webapi, prefix, names, show, force, need_data_sample, inputdata, outputimage, plotterparameter, indentation, format_cache)[source]

plot sample plot from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • need_data_sample (bool) – If set to True, then fetch sample data for plotter.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • inputdata (str) – The path to the json file containing data to be plotted.

  • outputimage (str) – The png filename for dumping the plot. If not set the default value is “output_image.png”.

  • plotterparameter (str) – The name of the plotterparameter (without “.json” extension).

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to

the calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

class beat.cmdline.plotters.PlotterCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = plotter ['declaration', 'code', 'description'] None None
beat.cmdline.plotterparameters.pull_impl(webapi, prefix, names, force, indentation, format_cache)[source]

Copies plotterparameters from the server.

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation (int) – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Returns

Indicating the exit status of the command, to be reported back to

the calling process. This value should be zero if everything works OK, otherwise, different than zero (POSIX compliance).

Return type

int

class beat.cmdline.plotterparameters.PlotterparametersCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = plotterparameter ['data'] None None
class beat.cmdline.protocoltemplates.ProtocolTemplateCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = protocoltemplate None None None
beat.cmdline.protocoltemplates.pull_impl(webapi, prefix, names, force, indentation, cache)[source]

Copies protocol template from the server

Parameters
  • webapi (object) – An instance of our WebAPI class, prepared to access the BEAT server of interest

  • prefix (str) – A string representing the root of the path in which the user objects are stored

  • names (list) – A list of strings, each representing the unique relative path of the objects to retrieve or a list of usernames from which to retrieve objects. If the list is empty, then we pull all available objects of a given type. If no user is set, then pull all public objects of a given type.

  • force (bool) – If set to True, then overwrites local changes with the remotely retrieved copies.

  • indentation – The indentation level, useful if this function is called recursively while downloading different object types. This is normally set to 0 (zero).

Shows the working folder status for different objects

Usage:

%(prog)s status

class beat.cmdline.toolchains.ToolchainCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: AssetCommand

asset_info = toolchain ['declaration', 'description'] ['name', 'declaration', 'description'] None

Returns the currently compiled version number

exception beat.cmdline.webapi.WebAPIError(cmd, url, answer)[source]

Bases: RuntimeError

class beat.cmdline.webapi.WebAPI(platform, user, token=None)[source]

Bases: object

Central class for all remote service related calls

API_VERSION = 'v1'
API_PATH = '/api/v1'
is_anonymous()[source]
get(path)[source]
post(path, data=None)[source]
upload(path, data)[source]
download(path)[source]
put(path, data=None)[source]
delete(path)[source]

Click based helper classes

class beat.cmdline.click_helper.AliasedGroup(name: Optional[str] = None, commands: Optional[Union[Dict[str, Command], Sequence[Command]]] = None, **attrs: Any)[source]

Bases: Group

Class that handles prefix aliasing for commands

get_command(ctx, cmd_name)[source]

Re-imp

class beat.cmdline.click_helper.MutuallyExclusiveOption(*args, **kwargs)[source]

Bases: Option

Class implementing mutually exclusive option

From https://stackoverflow.com/a/37491504/5843716

handle_parse_result(ctx, opts, args)[source]

Re-imp

class beat.cmdline.click_helper.AssetInfo(asset_type=None, diff_fields=None, push_fields=None, get_dependencies=None)[source]

Bases: object

Information needed by the command to properly call local and remote commands

class beat.cmdline.click_helper.AssetCommand(name: Optional[str], context_settings: Optional[Dict[str, Any]] = None, callback: Optional[Callable[[...], Any]] = None, params: Optional[List[Parameter]] = None, help: Optional[str] = None, epilog: Optional[str] = None, short_help: Optional[str] = None, options_metavar: Optional[str] = '[OPTIONS]', add_help_option: bool = True, no_args_is_help: bool = False, hidden: bool = False, deprecated: bool = False)[source]

Bases: Command

Custom click command that will update the context with asset information related to the command called.

asset_info = None None None None
invoke(ctx)[source]

Re-imp