netunicorn.client.remote.RemoteClient

class RemoteClient(endpoint, login, password, authentication_context=None)[source]

Bases: BaseClient

Remote client for Unicorn.

Parameters:
  • endpoint (str) – netunicorn endpoint

  • login (str) – netunicorn login

  • password (str) – netunicorn password

  • authentication_context (Optional[Dict[str, Dict[str, str]]], default: None) – authentication context for connectors

Attributes

endpoint

netunicorn installation endpoint.

login

netunicorn user login.

password

netunicorn user password.

authentication_context

Authentication context for connectors.

Methods

cancel_executors

Cancel particular executors.

cancel_experiment

Cancel experiment execution.

delete_experiment

Delete experiment from the system (to release experiment name).

get_experiment_status

get_experiments

Get information about all experiments that belong to the current user.

get_flag_values

Get flag values for a particular flag of the experiment.

get_nodes

Return nodes currently available to the current user.

healthcheck

Check if the current netunicorn instance is healthy.

prepare_experiment

set_flag_values

Set flag values for a particular flag of the experiment.

start_execution

endpoint[source]

netunicorn installation endpoint.

login[source]

netunicorn user login.

password[source]

netunicorn user password.

authentication_context[source]

Authentication context for connectors. E.g., if a connector requires users to provide additional security tokens, it could be specified here. Format: {connector_name: {key: value}}

healthcheck()[source]

Check if the current netunicorn instance is healthy.

Returns:

bool – True if core service is healthy

get_nodes()[source]

Return nodes currently available to the current user.

Returns:

Nodes – Nodes object with available nodes

delete_experiment(experiment_name)[source]

Delete experiment from the system (to release experiment name).

Parameters:

experiment_name (str) – name of the experiment to delete

Return type:

None

get_experiments()[source]

Get information about all experiments that belong to the current user.

Returns:

Dict[str, ExperimentExecutionInformation] – dictionary of {experiment-name: experiment information}

prepare_experiment(experiment, experiment_id, deployment_context=None)[source]
Prepare an Experiment. Server will start compiling and distributing the environment among nodes.
You can check status of preparation by calling ‘get_experiment_status’ function and checking if it’s in “READY” status.
You need to provide a per-user unique experiment name.
This method is network-failure-safe: subsequent calls with the same network name will not create additional deployment processes.
Parameters:
  • experiment (Experiment) – experiment to prepare

  • experiment_id (str) – user-wide unique experiment name

  • deployment_context (Optional[Dict[str, Dict[str, str]]], default: None) – deployment context for connectors specific for each connector, format: {connector_name: {key: value}, …}

Returns:

str – the same experiment_id if everything’s correct

start_execution(experiment_id, execution_context=None)[source]
Start execution of prepared experiment.
You can check status and results of an experiment by calling ‘get_experiment_status’ function and checking if it’s in “FINISHED” status.
You need to provide an experiment_id of prepared experiment to start.
This method is network-failure-safe - subsequent calls with the same experiment id will not create additional start process.
Parameters:
  • experiment_id (str) – prepared experiment id

  • execution_context (Optional[Dict[str, Dict[str, str]]], default: None) – execution context for connectors specific for each connector, format: {connector_name: {key: value}, …}

Returns:

str – the same experiment_id if execution already in progress or finished

get_experiment_status(experiment_id)[source]
Return status and results of experiment.
If experiment preparation succeed, you can explore map to see what nodes are prepared for deployment.
If experiment finished, you can explore results of the experiment
Parameters:

experiment_id (str) – id of the experiment returned by ‘prepare_experiment’ function

Returns:

ExperimentExecutionInformation – current status of the experiment, optionally experiment definition, optionally experiment results

cancel_experiment(experiment_id, cancellation_context=None)[source]

Cancel experiment execution.

Parameters:
  • experiment_id (str) – id of the experiment

  • cancellation_context (Optional[Dict[str, Dict[str, str]]], default: None) – cancellation context for connectors specific for each connector, format: {connector_name: {key: value}, …}

Returns:

str – the same experiment_id if everything’s correct

cancel_executors(executors, cancellation_context=None)[source]

Cancel particular executors.

Parameters:
  • executors (Iterable[str]) – list of executors to cancel

  • cancellation_context (Optional[Dict[str, Dict[str, str]]], default: None) – cancellation context for connectors specific for each connector, format: {connector_name: {key: value}, …}

Returns:

str – the same experiment_id if everything’s correct

get_flag_values(experiment_id, flag_name)[source]

Get flag values for a particular flag of the experiment.

Parameters:
  • experiment_id (str) – id of the experiment

  • flag_name (str) – name of the flag

Returns:

FlagValues – flag values (string, int, or both)

set_flag_values(experiment_id, flag_name, flag_values)[source]

Set flag values for a particular flag of the experiment.

Parameters:
  • experiment_id (str) – id of the experiment

  • flag_name (str) – name of the flag

  • flag_values (FlagValues) – flag values (string, int, or both)

Return type:

None