cloudmesh.ee.tools package

Submodules

cloudmesh.ee.tools.StopWatch module

class StopWatch[source]

Bases: object

benchmark()[source]
end(name)[source]
start(name)[source]

cloudmesh.ee.tools.parallel_executor module

Parallel Executor with Dependencies

Usage:

parallel_executor.py <yaml_file> parallel_executor.py -h | –help

Options:

-h –help Show this help message and exit.

class ParallelExecutor[source]

Bases: object

A class for executing steps in parallel with dependencies.

Usage:

executor = ParallelExecutor() executor.execute_with_yaml(“example.yaml”) executor.execute()

info

Information about the execution.

Type:

dict

steps

List of steps to be executed.

Type:

list

dependencies

Dependencies between steps.

Type:

dict

load_yaml(yaml_path)[source]

Load execution information from a YAML file.

load_json(json_path)[source]

Load execution information from a JSON file.

execute_step(step)[source]

Execute a single step.

execute_with_yaml(yaml_path)[source]

Load and execute steps from a YAML file.

execute()[source]

Execute all loaded steps.

Example

executor = ParallelExecutor() executor.execute_with_yaml(“example.yaml”) executor.execute()

Initialize the ParallelExecutor.

Sets up logging and initializes attributes.

Example

executor = ParallelExecutor()

execute()[source]

Execute all loaded steps.

Example

executor.execute()

execute_step(step)[source]

Execute a single step.

Parameters:

step (dict) – Step information.

Example

executor.execute_step({“name”: “step1”, “host”: “localhost”, “command”: “echo ‘Hello, World!’”})

execute_with_yaml(yaml_path)[source]

Load and execute steps from a YAML file.

Parameters:

yaml_path (str) – Path to the YAML file.

Example

executor.execute_with_yaml(“example.yaml”)

load_json(json_path)[source]

Load execution information from a JSON file.

Parameters:

json_path (str) – Path to the JSON file.

Example

executor.load_json(“example.json”)

load_yaml(yaml_path)[source]

Load execution information from a YAML file.

Parameters:

yaml_path (str) – Path to the YAML file.

Example

executor.load_yaml(“example.yaml”)

cloudmesh.ee.tools.sequential_executor module

Sequential Executor

Usage:

sequential_executor.py [–yaml=<yaml_file>] [–json=<json_file>] [–dryrun] sequential_executor.py -h | –help

Options:

-h –help Show this help message and exit. –yaml=<yaml_file> Path to the YAML file [default: steps.yaml]. –json=<json_file> Path to the JSON file. –dryrun Perform a dry run without executing commands.

class SequentialExecutor(dryrun=False)[source]

Bases: object

A class for executing steps sequentially.

Usage:

executor = SequentialExecutor() executor.execute_with_yaml(“example.yaml”) executor.execute()

info

Information about the execution.

Type:

dict

steps

List of steps to be executed.

Type:

list

dryrun

Flag indicating whether to perform a dry run.

Type:

bool

load_yaml(yaml_path)[source]

Load execution information from a YAML file.

run(step, **kwargs)[source]

Execute a single run step with optional parameters.

prepare(step)[source]

Execute a single prepare step.

fetch(step)[source]

Execute a single fetch step.

load_json(json_path)[source]

Load data from a JSON file.

execute_with_json(json_path)[source]

Load and process data from a JSON file.

execute_with_yaml(yaml_path)[source]

Load and execute steps from a YAML file.

execute()[source]

Execute all loaded steps.

Example

executor = SequentialExecutor() executor.execute_with_yaml(“example.yaml”) executor.execute()

Initialize the SequentialExecutor.

Sets up logging and initializes attributes.

Parameters:

dryrun (bool) – Flag indicating whether to perform a dry run.

Example

executor = SequentialExecutor(dryrun=True)

execute()[source]

Execute all loaded steps.

Example

executor.execute()

execute_with_json(json_path)[source]

Load and process data from a JSON file.

Parameters:

json_path (str) – Path to the JSON file.

Example

executor.execute_with_json(“data.json”)

execute_with_yaml(yaml_path)[source]

Load and execute steps from a YAML file.

Parameters:

yaml_path (str) – Path to the YAML file.

Example

executor.execute_with_yaml(“example.yaml”)

fetch(step)[source]

Execute a single fetch step.

Parameters:

step (dict) – Fetch step information.

Example

executor.fetch({“name”: “step1”, “type”: “fetch”})

load_json(json_path)[source]

Load data from a JSON file.

Parameters:

json_path (str) – Path to the JSON file.

Returns:

Loaded JSON data.

Return type:

dict

Example

json_data = executor.load_json(“data.json”)

load_yaml(yaml_path)[source]

Load execution information from a YAML file.

Parameters:

yaml_path (str) – Path to the YAML file.

Example

executor.load_yaml(“example.yaml”)

prepare(step)[source]

Execute a single prepare step.

Parameters:

step (dict) – Prepare step information.

Example

executor.prepare({“name”: “step1”, “type”: “prepare”})

run(step, **kwargs)[source]

Execute a single run step with optional parameters.

Parameters:
  • step (dict) – Run step information.

  • **kwargs – Optional parameters to replace placeholders in the command.

Example

executor.run({“name”: “step1”, “host”: “localhost”, “type”: “run”, “command”: “echo ‘{parameters}’”}, parameters=”Hello”)

Module contents