netunicorn.client.base.BaseClient

class BaseClient[source]

Bases: ABC

Base class for netunicorn client implementations.

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

abstract get_nodes()[source]

Return nodes currently available to the current user.

Returns:

Nodes – Nodes object with available nodes

abstract get_experiments()[source]

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

Returns:

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

abstract 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

abstract healthcheck()[source]

Check if the current netunicorn instance is healthy.

Returns:

bool – True if core service is healthy

abstract 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

abstract 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

abstract 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

abstract 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

abstract 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

abstract 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)

abstract 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