pynrp.virtual_coach module

Virtual Coach main entry point for interacting with the experiment list and launching simulations.

class VirtualCoach(environment='http://localhost:9000', oidc_username=None, oidc_password=None, storage_username=None, storage_password=None)[source]

Bases: object

Provides the user with methods for interacting with the experiment list, providing functionality similar to the graphical frontend experiment list webpage. Allows the user to view available experiments, query currently running experiments, launch a simulation, and more.

clone_cloned_experiment(experiment_id)[source]

Attempts to clone a cloned experiment to the Storage Server.

Parameters

experiment_id – The id of the cloned experiment to be cloned. E.g. benchmark_p3dx_1

Returns

A dict containing the ID of the cloned experiment and the ID of the original experiment. Dict Keys are: ‘clonedExp’ and ‘originalExp’

clone_experiment_to_storage(exp_id)[source]

Attempts the clone an experiment to the Storage Server. Only works if the Virtual Coach was instantiated with Storage Server support, i.e. Storage Server credentials

Parameters

exp_id – The id of the experiment to be cloned

Returns

The ID of the cloned experiment

delete_cloned_experiment(exp_id)[source]

Attempts to delete a cloned experiment from the storage_server

Parameters

exp_id – The id of the experiment to be deleted

delete_model(model_type, name)[source]

Deletes a model from user storage. :param name: Name of the model to be deleted. :param model_type: Model type to be deleted [‘environments’, ‘robots’, ‘brains’]

get_experiment_run_file(exp_id, file_type, run_id, file_name)[source]

Retrieves a file content

Parameters
  • exp_id – The experiment id

  • file_type – type of files [‘csv’, ‘profiler’]

  • run_id – The run id

  • file_uuid – The file uuid

get_last_run_file(exp_id, file_type, file_name)[source]

Retrieves a file content for the last run

Parameters
  • exp_id – The experiment id

  • file_type – type of files [‘csv’, ‘profiler’]

  • file_name – The file name

import_experiment(path)[source]

Imports an experiment folder, possibly a zipped folder, into user storage

Parameters

path (str) – path to the experiment folder or to the zip file to be imported

import_model(path, model_type)[source]

Imports a model (brain, robot or experiment as folder or zipped folder) into user storage. :param path: Path to the model folder or .zip file to be imported. :param model_type: Model type to be imported [‘environments’, ‘robots’, ‘brains’]

launch_experiment(experiment_id, server=None, reservation=None, cloned=True, brain_processes=1, profiler='disabled', recordingPath=None)[source]

Attempts to launch a simulation with the given parameters. If no server is explicitly given then all available backend servers will be tried. Only cloned experiments to the Storage Server can be launched.

Parameters
  • experiment_id – The short name of the experiment configuration to launch (e.g. ExDTemplateHusky).

  • server – (optional) The full name of the server backend to launch on, if none is provided, then all backend servers will be checked.

  • reservation – (optional) A cluster reservation string if the user has reserved specific resources, otherwise use any available resources.

  • cloned – (optional) True or False depending on if the launched is a cloned experiment or not.

  • brain_processes – (optional) Number of mpi processes in the brain simulation.

  • profiler – (optional) profiler option. Possible values are: disabled, cle_step and cprofile.

  • recordingPath – (optional) the path to a the zip of a recording.

print_available_models(model_type, user='all')[source]

Prints available storage models. :param model_type: type of the models to be shown [‘environments’, ‘robots’, ‘brains’] :param user: username of models owner to be shown

print_available_servers()[source]

Prints a list of the available backend servers that are currently not running a simulation.

print_cloned_experiments()[source]

Prints the list of the cloned experiments’ names. Only works if the Virtual Coach was instantiated with Storage Server support, i.e. with Storage Server credentials

print_experiment_run_files(exp_id, file_type, run_id)[source]

Prints the list of files for a given experiment run

Parameters
  • exp_id – The experiment id for which to retrieve the list of files

  • file_type – type of files [‘csv’, ‘profiler’]

  • run_id – The run id for which to retrieve the list of files

print_experiment_runs_files(exp_id, file_type)[source]

Prints the list of ids of experiment runs that generated files. The ids can be used to retrieve the data

Parameters
  • exp_id – The experiment id for which to retrieve the list of simulation runs

  • file_type – type of files [‘csv’, ‘profiler’]

print_last_run_files(exp_id, file_type)[source]

Prints the list of files for the last run of an experiment

Parameters
  • exp_id – The experiment id for which to retrieve the list of files

  • file_type – type of files [‘csv’, ‘profiler’]

print_running_experiments(cloned=False)[source]

Prints a table of currently running experiments and relevant details (if any).

print_templates(dev=False)[source]

Prints a table of the list of experiments available on the backend environment. The printed list is sorted by the experiment title in the same way as the frontend webpage.

Parameters

dev – (optional) A boolean flag if all development maturity experiments should be printed in addition to the production experiments.

set_experiment_file(exp_id, file_name, file_content)[source]

Create/Update a file with passed file content

Parameters
  • exp_id – The experiment id

  • file_name – The file name

  • file_content – The content of the file