ramble.cmd package
- exception ramble.cmd.CommandNameError(name)[source]
Bases:
RambleErrorException class thrown for impermissible command names
- exception ramble.cmd.PythonNameError(name)[source]
Bases:
RambleErrorException class thrown for impermissible python names
- ramble.cmd.all_commands()[source]
Get a sorted list of all ramble commands.
This will list the lib/ramble/ramble/cmd directory and find the commands there to construct the list. It does not actually import the python files – just gets the names.
- ramble.cmd.find_workspace(args)[source]
Find active workspace from args or environment variable.
- Check for a workspace in this order:
via
ramble -w WRKSPCorramble -D DIR(arguments)via a path in the ramble.workspace.RAMBLE_WORKSPACE_VAR environment variable.
If a workspace is found, read it in. If not, return None.
- Parameters:
args (argparse.Namespace) – argparse namespace with command arguments
- Returns:
a found workspace, or
None- Return type:
- ramble.cmd.find_workspace_path(args)[source]
Find path to active workspace from args or environment variable.
- Check for a workspace in this order:
via
ramble -w WRKSPCorramble -D DIR(arguments)via a path in the ramble.workspace.RAMBLE_WORKSPACE_VAR environment variable.
If a workspace is found, return it’s path. If not, return None.
- Parameters:
args (argparse.Namespace) – argparse namespace with command arguments
- Returns:
Path to workspace root, or None
- Return type:
(str)
- ramble.cmd.get_command(cmd_name)[source]
Imports the command function associated with cmd_name.
The function’s name is derived from cmd_name using python_name().
- Parameters:
cmd_name (str) – name of the command (contains
-, not_).
- ramble.cmd.get_module(cmd_name)[source]
Imports the module for a particular command name and returns it.
- Parameters:
cmd_name (str) – name of the command for which to get a module (contains
-, not_).
- ramble.cmd.python_name(cmd_name)[source]
Convert
-to_in command name, to make a valid identifier.
- ramble.cmd.require_active_workspace(cmd_name, dry_run: bool = False)[source]
Used by commands to get the active workspace
If a workspace is not found, print an error message that says the calling command needs an active workspace.
- Parameters:
- Returns:
the active workspace
- Return type:
- ramble.cmd.require_cmd_name(cname)[source]
Require that the provided name is a valid command name (per cmd_name()). Useful for checking parameters for function prerequisites.
- ramble.cmd.require_python_name(pname)[source]
Require that the provided name is a valid python name (per python_name()). Useful for checking parameters for function prerequisites.
Subpackages
Submodules
ramble.cmd.attributes module
- ramble.cmd.attributes.attributes_to_objects(users=None, attr_name='maintainers', object_type=ObjectTypes.applications)[source]
- ramble.cmd.attributes.defined_objects(attr_name='maintainers', object_type=ObjectTypes.applications)[source]
ramble.cmd.clean module
ramble.cmd.commands module
- class ramble.cmd.commands.BashCompletionWriter(prog, out=None, aliases=False)[source]
Bases:
ArgparseCompletionWriterWrite argparse output as bash programmable tab completion.
- class ramble.cmd.commands.RambleArgparseRstWriter(prog, out=None, aliases=False, documented_commands=None, rst_levels=None)[source]
Bases:
ArgparseRstWriterRST writer tailored for ramble documentation.
- class ramble.cmd.commands.SubcommandWriter(prog, out=None, aliases=False)[source]
Bases:
ArgparseWriter- format(cmd)[source]
Returns the string representation of a single node in the parser tree.
Override this in subclasses to define how each subcommand should be displayed.
- Parameters:
(Command) – parsed information about a command or subcommand
- Returns:
the string representation of this subcommand
- Return type:
- ramble.cmd.commands.formatters = {'bash': <function bash>, 'names': <function names>, 'rst': <function rst>, 'subcommands': <function subcommands>}
list of command formatters
- ramble.cmd.commands.update_completion(parser, args)[source]
Iterate through the shells and update the standard completion files.
This is a convenience method to avoid calling this command many times, and to simplify completion update for developers.
- ramble.cmd.commands.update_completion_args = {'base_with_aliases': {'aliases': True, 'format': 'bash', 'header': '/home/docs/checkouts/readthedocs.org/user_builds/ramble-dev-dapomeroy/checkouts/latest/lib/ramble/docs/_ramble_root/share/ramble/bash/ramble-completion.in', 'update': '/home/docs/checkouts/readthedocs.org/user_builds/ramble-dev-dapomeroy/checkouts/latest/lib/ramble/docs/_ramble_root/share/ramble/custom-ramble-completion.bash'}, 'bash_no_aliases': {'aliases': False, 'format': 'bash', 'header': '/home/docs/checkouts/readthedocs.org/user_builds/ramble-dev-dapomeroy/checkouts/latest/lib/ramble/docs/_ramble_root/share/ramble/bash/ramble-completion.in', 'update': '/home/docs/checkouts/readthedocs.org/user_builds/ramble-dev-dapomeroy/checkouts/latest/lib/ramble/docs/_ramble_root/share/ramble/ramble-completion.bash'}}
standard arguments for updating completion scripts we iterate through these when called with –update-completion
ramble.cmd.config module
- ramble.cmd.config.config_add(args)[source]
Add the given configuration to the specified config scope
This is a stateful operation that edits the config files.
- ramble.cmd.config.config_edit(args)[source]
Edit the configuration file for a specific scope and config section.
With no arguments and an active workspace, edit the ramble.yaml for the active workspace.
- ramble.cmd.config.config_get(args)[source]
Dump merged YAML configuration for a specific section.
With no arguments and an active workspace, print the contents of the workspace’s config file (ramble.yaml).
- ramble.cmd.config.config_list(args)[source]
List the possible configuration sections.
Used primarily for shell tab completion scripts.
ramble.cmd.data module
- ramble.cmd.data.data(parser, args, unknown_args=None)[source]
Look for a function called data_<name> and call it.
- ramble.cmd.data.sanitize_arg_name(base_name)[source]
Allow function names to be remapped (eg - to _)
- ramble.cmd.data.subcommand_functions = {}
Dictionary mapping subcommand names and aliases to functions
ramble.cmd.debug module
ramble.cmd.deployment module
- ramble.cmd.deployment.deployment(parser, args)[source]
Look for a function called deployment_<name> and call it.
- ramble.cmd.deployment.deployment_pull_setup_parser(subparser)[source]
Pull a workspace deployment into current workspace
- ramble.cmd.deployment.sanitize_arg_name(base_name)[source]
Allow function names to be remapped (eg - to _)
- ramble.cmd.deployment.subcommand_functions = {'pull': <function deployment_pull>, 'push': <function deployment_push>}
Dictionary mapping subcommand names and aliases to functions
ramble.cmd.docs module
ramble.cmd.edit module
ramble.cmd.help module
ramble.cmd.info module
ramble.cmd.license module
- ramble.cmd.license.apache2_mit_spdx = '(Apache-2.0 OR MIT)'
Ramble’s license identifier
- ramble.cmd.license.git = <exe: ['/usr/bin/git']>
need the git command to check new files
- ramble.cmd.license.lgpl_exceptions = ['lib/ramble/ramble/cmd/license.py', 'lib/ramble/ramble/test/cmd/license.py']
licensed files that can have LGPL language in them so far, just this command – so it can find LGPL things elsewhere
- ramble.cmd.license.license_lines = 9
SPDX license id must appear in the first <license_lines> lines of a file
- ramble.cmd.license.licensed_files = ['bin/ramble$', 'bin/ramble-python$', 'lib/ramble/ramble/.*\\.py$', 'lib/ramble/ramble/.*\\.sh$', 'lib/ramble/llnl/.*\\.py$', 'lib/ramble/docs/(?!command_index|ramble|llnl).*\\.rst$', 'lib/ramble/docs/.*\\.py$', 'lib/ramble/external/__init__.py$', 'lib/ramble/external/ordereddict_backport.py$', 'share/ramble/.*\\.sh$', 'share/ramble/.*\\.bash$', 'share/ramble/.*\\.csh$', 'share/ramble/qa/run-[^/]*$', 'share/ramble/bash/.*$', 'share/ramble/cloud-build/.*\\.yaml$', 'examples/.*\\.yaml$', 'var/ramble/repos/.*/application.py$', 'var/ramble/repos/.*/modifier.py$', 'var/ramble/repos/.*/package_manager.py$', 'var/ramble/repos/.*/workflow_manager.py$', 'var/ramble/repos/.*/system.py$', 'var/ramble/repos/.*/platform.py$', 'var/ramble/repos/.*/base_class.py$', 'var/ramble/repos/.*/base_application.py$', 'var/ramble/repos/.*/base_modifier.py$', 'var/ramble/repos/.*/base_package_manager.py$', 'var/ramble/repos/.*/base_workflow_manager.py$', 'var/ramble/repos/.*/base_system.py$', 'var/ramble/repos/.*/base_platform.py$']
regular expressions for licensed files.
ramble.cmd.list module
ramble.cmd.mirror module
ramble.cmd.on module
ramble.cmd.python module
- ramble.cmd.python.ipython_interpreter(args)[source]
An ipython interpreter is intended to be interactive, so it doesn’t support running a script or arguments
- ramble.cmd.python.propagate_exceptions_from(console)[source]
Set sys.excepthook to let uncaught exceptions return 1 to the shell.
- Parameters:
console (code.InteractiveConsole) – the console that needs a change in sys.excepthook
ramble.cmd.repo module
ramble.cmd.results module
- ramble.cmd.results.import_results_file(filename)[source]
Import Ramble experiment results from a JSON or YAML file.
Returns a results dictionary.
- ramble.cmd.results.results_index(args)[source]
List attributes in results including FOMs and template variables
- ramble.cmd.results.results_report(args)[source]
Create a report with charts from Ramble experiment results.
ramble.cmd.software_definitions module
- ramble.cmd.software_definitions.collect_definitions()[source]
Build software definition data structures
Iterate over all defined objects and extract their software definitions. Built maps representing which objects use a given software definition, and where detected conflicts have occurred.
The maps are global to this module, and reused in other internal methods.
- ramble.cmd.software_definitions.count_conflicts()[source]
Iterate over conflicts and count how many were detected
- ramble.cmd.software_definitions.print_summary()[source]
Print a summary of all software definitions
ramble.cmd.style module
- ramble.cmd.style.changed_files(base=None, untracked=True, all_files=False, root='/home/docs/checkouts/readthedocs.org/user_builds/ramble-dev-dapomeroy/checkouts/latest/lib/ramble/docs/_ramble_root')[source]
Get list of changed files in the Ramble repository.
- ramble.cmd.style.filter_file(source, dest, output=False)[source]
Filter a single file through all the patterns in pattern_exemptions.
- ramble.cmd.style.get_tool_args(args, tool_name)[source]
Helper to get tool-specific arguments from args.
ramble.cmd.unit_test module
- ramble.cmd.unit_test.add_back_pytest_args(args, unknown_args)[source]
Add parsed pytest args, unknown args, and remainder together.
We add some basic pytest arguments to the Ramble parser to ensure that they show up in the short help, so we have to reassemble things here.
ramble.cmd.workspace module
- ramble.cmd.workspace.create_temp_workspace_directory()[source]
Returns the path of a temporary directory in which to create a workspace
- ramble.cmd.workspace.sanitize_arg_name(base_name)[source]
Allow function names to be remapped (eg - to _)
- ramble.cmd.workspace.subcommand_functions = {'activate': <function workspace_activate>, 'analyze': <function workspace_analyze>, 'archive': <function workspace_archive>, 'concretize': <function workspace_concretize>, 'config': <function workspace_config>, 'create': <function workspace_create>, 'deactivate': <function workspace_deactivate>, 'edit': <function workspace_edit>, 'experiment-logs': <function workspace_experiment_logs>, 'generate-config': <function workspace_generate_config>, 'info': <function workspace_info>, 'list': <function workspace_list>, 'ls': <function workspace_list>, 'manage': <function workspace_manage>, 'mirror': <function workspace_mirror>, 'push-to-cache': <function workspace_push_to_cache>, 'remove': <function workspace_remove>, 'rm': <function workspace_remove>, 'setup': <function workspace_setup>}
Dictionary mapping subcommand names and aliases to functions
- ramble.cmd.workspace.workspace(parser, args, unknown_args)[source]
Look for a function called workspace_<name> and call it.
- ramble.cmd.workspace.workspace_archive_setup_parser(subparser)[source]
archive current workspace state
- ramble.cmd.workspace.workspace_deactivate_setup_parser(subparser)[source]
deactivate any active workspace in the shell
- ramble.cmd.workspace.workspace_edit_setup_parser(subparser)[source]
edit workspace config or template
- ramble.cmd.workspace.workspace_experiment_logs_setup_parser(subparser)[source]
print log information for workspace
- ramble.cmd.workspace.workspace_generate_config(args)[source]
Generate a configuration file for this ramble workspace
- ramble.cmd.workspace.workspace_generate_config_setup_parser(subparser)[source]
generate current workspace config
- ramble.cmd.workspace.workspace_manage(args)[source]
Look for a function for the manage subcommand, and execute it.
- ramble.cmd.workspace.workspace_manage_experiments_setup_parser(subparser)[source]
manage experiment definitions
- ramble.cmd.workspace.workspace_manage_includes(args)[source]
Execute workspace manage include command
- ramble.cmd.workspace.workspace_manage_includes_setup_parser(subparser)[source]
manage workspace includes
- ramble.cmd.workspace.workspace_manage_modifiers(args)[source]
Execute workspace manage modifiers command
- ramble.cmd.workspace.workspace_manage_modifiers_setup_parser(subparser)[source]
manage workspace modifiers
- ramble.cmd.workspace.workspace_manage_software(args)[source]
Execute workspace manage software command
- ramble.cmd.workspace.workspace_manage_software_setup_parser(subparser)[source]
manage workspace software definitions
- ramble.cmd.workspace.workspace_mirror_setup_parser(subparser)[source]
mirror current workspace state
- ramble.cmd.workspace.workspace_push_to_cache_setup_parser(subparser)[source]
push workspace envs to a given buildcache