Table Of Contents

This Page

nepi.execution package

Submodules

nepi.execution.attribute module

class nepi.execution.attribute.Attribute(name, help, type='STRING', flags=None, default=None, allowed=None, range=None, set_hook=None)[source]

Bases: object

An Attribute exposes a configuration parameter of a resource

allowed[source]

Returns the set of allowed values for the Attribute

default[source]

Returns the default value of the Attribute

flags[source]

Returns the flags of the Attribute

get_value()[source]

Returns the value of the Attribute

has_changed[source]

Returns True if the value has changed from the default

has_flag(flag)[source]

Returns True if the Attribute has the flag ‘flag’

Parameters:flag (Flags) – Flag to be checked
help[source]

Returns the description of the Attribute

is_valid_value(value)[source]

Attribute subclasses will override this method to add adequate validation

name[source]

Returns the name of the Attribute

range[source]

Returns the range of allowed numerical values for the Attribute

set_value(value)[source]

Configure a new value for the Attribute

type[source]

Returns the type of the Attribute

value

Returns the value of the Attribute

class nepi.execution.attribute.Flags[source]

Flags to characterize the scope of an Attribute

Construct = 8
Credential = 20
Design = 4
Filter = 36
Global = 128
NoRead = 1
NoWrite = 2
Reserved = 64
class nepi.execution.attribute.Types[source]

Allowed types for the Attribute value

Bool = 'BOOL'
Double = 'DOUBLE'
Enumerate = 'ENUM'
Integer = 'INTEGER'
String = 'STRING'

nepi.execution.ec module

class nepi.execution.ec.ECState[source]

Bases: object

Possible states of the ExperimentController

FAILED = 2
RELEASED = 3
RUNNING = 1
TERMINATED = 4
class nepi.execution.ec.ExperimentController(exp_id=None, local_dir=None, persist=False, fm=None, add_node_callback=None, add_edge_callback=None, **kwargs)[source]

Bases: object

An experiment, or scenario, is defined by a concrete set of resources, and the behavior, configuration and interconnection of those resources. The Experiment Description (ED) is a detailed representation of a single experiment. It contains all the necessary information to allow repeating the experiment. NEPI allows to describe experiments by registering components (resources), configuring them and interconnecting them.

A same experiment (scenario) can be executed many times, generating different results. We call an experiment execution (instance) a ‘run’.

The ExperimentController (EC), is the entity responsible of managing an experiment run. The same scenario can be recreated (and re-run) by instantiating an EC and recreating the same experiment description.

An experiment is represented as a graph of interconnected resources. A resource is a generic concept in the sense that any component taking part of an experiment, whether physical of virtual, is considered a resource. A resources could be a host, a virtual machine, an application, a simulator, a IP address.

A ResourceManager (RM), is the entity responsible for managing a single resource. ResourceManagers are specific to a resource type (i.e. An RM to control a Linux application will not be the same as the RM used to control a ns-3 simulation). To support a new type of resource, a new RM must be implemented. NEPI already provides a variety of RMs to control basic resources, and new can be extended from the existing ones.

Through the EC interface the user can create ResourceManagers (RMs), configure them and interconnect them, to describe an experiment. Describing an experiment through the EC does not run the experiment. Only when the ‘deploy()’ method is invoked on the EC, the EC will take actions to transform the ‘described’ experiment into a ‘running’ experiment.

While the experiment is running, it is possible to continue to create/configure/connect RMs, and to deploy them to involve new resources in the experiment (this is known as ‘interactive’ deployment).

An experiments in NEPI is identified by a string id, which is either given by the user, or automatically generated by NEPI. The purpose of this identifier is to separate files and results that belong to different experiment scenarios. However, since a same ‘experiment’ can be run many times, the experiment id is not enough to identify an experiment instance (run). For this reason, the ExperimentController has two identifier, the exp_id, which can be re-used in different ExperimentController, and the run_id, which is unique to one ExperimentController instance, and is automatically generated by NEPI.

abort[source]

Returns True if the experiment has failed and should be interrupted, False otherwise.

deploy(guids=None, wait_all_ready=True, group=None)[source]

Deploys all ResourceManagers in the guids list.

If the argument ‘guids’ is not given, all RMs with state NEW are deployed.

param guids:List of guids of RMs to deploy
type guids:list
param wait_all_ready:
 Wait until all RMs are ready in order to start the RMs
type guid:int
param group:Id of deployment group in which to deploy RMs
type group:int
discover(guid)[source]

Discovers an available resource matching the criteria defined by the RM with guid ‘guid’, and associates that resource to the RM

Not all RM types require (or are capable of) performing resource discovery. For the RM types which are not capable of doing so, invoking this method does not have any consequences.

param guid:Guid of the RM
type guid:int
ecstate[source]

Returns the state of the Experiment Controller

enable_trace(guid, name)[source]

Enables a trace to be collected during the experiment run

Parameters:name (str) – Name of the trace
exp_dir[source]

Local directory to store results and other files related to the experiment.

exp_id[source]

Returns the experiment id assigned by the user

failure_level[source]

Returns the level of FAILURE of th experiment

filter_resources(rtype)[source]

Returns the guids of all ResourceManagers of type rtype

Parameters:rtype (string) – Resource type
Return type:list of guids
fm[source]

Returns the failure manager

get(guid, name)[source]

Returns the value of the attribute with name ‘name’ on the RM with guid ‘guid’

param guid:Guid of the RM
type guid:int
param name:Name of the attribute
type name:str
return:The value of the attribute with name ‘name’
get_attribute(guid, name)[source]

Returns the attribute ‘name’ of the RM with guid ‘guid’

Parameters:
  • guid (int) – Guid of the RM
  • name (str) – Name of the attribute
Returns:

The attribute with name ‘name’

Return type:

Attribute

get_attributes(guid)[source]

Returns all the attributes of the RM with guid ‘guid’

Parameters:guid (int) – Guid of the RM
Returns:List of attributes
Return type:list
get_discover_time(guid)[source]

Returns the discover time of the RM as a timestamp

get_failed_time(guid)[source]

Returns the time failure occured for the RM as a timestamp

get_global(rtype, name)[source]

Returns the value of the global attribute with name ‘name’ on the RMs of rtype ‘rtype’.

param guid:Guid of the RM
type guid:int
param name:Name of the attribute
type name:str
return:The value of the attribute with name ‘name’
get_provision_time(guid)[source]

Returns the provision time of the RM as a timestamp

get_ready_time(guid)[source]

Returns the deployment time of the RM as a timestamp

get_release_time(guid)[source]

Returns the release time of the RM as a timestamp

get_resource(guid)[source]

Returns a registered ResourceManager by its guid

Parameters:guid (int) – Id of the resource
Return type:ResourceManager
get_resources_by_type(rtype)[source]

Returns the ResourceManager objects of type rtype

Parameters:rtype (string) – Resource type
Return type:list of ResourceManagers
get_start_time(guid)[source]

Returns the start time of the RM as a timestamp

get_stop_time(guid)[source]

Returns the stop time of the RM as a timestamp

get_task(tid)[source]

Returns a task by its id

Parameters:tid (int) – Id of the task
Return type:Task
get_traces(guid)[source]

Returns the list of the trace names of the RM with guid ‘guid’

Parameters:guid (int) – Guid of the RM
Returns:List of trace names
Return type:list
inform_failure(guid)[source]

Reports a failure in a RM to the EC for evaluation

Parameters:guid (int) – Resource id
classmethod load(filepath, format='xml')[source]
local_dir[source]

Root local directory for experiment files

logger[source]

Returns the logger instance of the Experiment Controller

netgraph[source]

Return NetGraph instance if experiment description was automatically generated

nthreads[source]

Returns the number of processing nthreads used

persist[source]

If True, persists the ExperimentController to XML format upon experiment completion

plot(dirpath=None, format='figure', show=False)[source]
provision(guid)[source]

Provisions the resource associated to the RM with guid ‘guid’.

Provisioning means making a resource ‘accessible’ to the user. Not all RM types require (or are capable of) performing resource provisioning. For the RM types which are not capable of doing so, invoking this method does not have any consequences.

param guid:Guid of the RM
type guid:int
register_condition(guids1, action, guids2, state, time=None)[source]

Registers an action START, STOP or DEPLOY for all RM on list guids1 to occur at time ‘time’ after all elements in list guids2 have reached state ‘state’.

param guids1:List of guids of RMs subjected to action
type guids1:list
param action:Action to perform (either START, STOP or DEPLOY)
type action:ResourceAction
param guids2:List of guids of RMs to we waited for
type guids2:list
param state:State to wait for on RMs of list guids2 (STARTED, STOPPED, etc)
type state:ResourceState
param time:Time to wait after guids2 has reached status
type time:string
register_connection(guid1, guid2)[source]

Registers a connection between a RM with guid ‘guid1’ and another RM with guid ‘guid2’.

The order of the in which the two guids are provided is not important, since the connection relationship is symmetric.

param guid1:First guid to connect
type guid1:ResourceManager
param guid2:Second guid to connect
type guid:ResourceManager
register_resource(rtype, guid=None)[source]

Registers a new ResourceManager of type ‘rtype’ in the experiment

This method will assign a new ‘guid’ for the RM, if no guid is specified.

param rtype:Type of the RM
type rtype:str
return:Guid of the RM
rtype:int
release(guids=None)[source]

Releases all ResourceManagers in the guids list.

If the argument ‘guids’ is not given, all RMs registered in the experiment are released.

param guids:List of RM guids
type guids:list
remove_resource(guid)[source]
resources[source]

Returns the guids of all ResourceManagers

Returns:Set of all RM guids
Return type:list
run_dir[source]

Local directory to store results and other files related to the experiment run.

run_id[source]

Returns the experiment instance (run) identifier (automatically generated)

save(dirpath=None, format='xml')[source]
schedule(date, callback, track=False)[source]

Schedules a callback to be executed at time ‘date’.

Parameters:
  • date – string containing execution time for the task. It can be expressed as an absolute time, using timestamp format, or as a relative time matching ^d+.d+(h|m|s|ms|us)$
  • callback – code to be executed for the task. Must be a Python function, and receives args and kwargs as arguments.
  • track – if set to True, the task will be retrievable with the get_task() method

:return : The Id of the task :rtype: int

serialize(format='xml')[source]
set(guid, name, value)[source]

Modifies the value of the attribute with name ‘name’ on the RM with guid ‘guid’.

param guid:Guid of the RM
type guid:int
param name:Name of the attribute
type name:str
param value:Value of the attribute
set_global(rtype, name, value)[source]

Modifies the value of the global attribute with name ‘name’ on the RMs of with rtype ‘rtype’.

param guid:Guid of the RM
type guid:int
param name:Name of the attribute
type name:str
param value:Value of the attribute
set_with_conditions(name, value, guids1, guids2, state, time=None)[source]

Modifies the value of attribute with name ‘name’ on all RMs on the guids1 list when time ‘time’ has elapsed since all elements in guids2 list have reached state ‘state’.

param name:Name of attribute to set in RM
type name:string
param value:Value of attribute to set in RM
type name:string
param guids1:List of guids of RMs subjected to action
type guids1:list
param action:Action to register (either START or STOP)
type action:ResourceAction
param guids2:List of guids of RMs to we waited for
type guids2:list
param state:State to wait for on RMs (STARTED, STOPPED, etc)
type state:ResourceState
param time:Time to wait after guids2 has reached status
type time:string
shutdown()[source]

Releases all resources and stops the ExperimentController

start(guid)[source]

Starts the RM with guid ‘guid’

Starting a RM means that the resource it controls will begin taking part of the experiment.

param guid:Guid of the RM
type guid:int
state(guid, hr=False)[source]

Returns the state of a resource

Parameters:
  • guid (integer) – Resource guid
  • hr (boolean) – Human readable. Forces return of a status string instead of a number
stop(guid)[source]

Stops the RM with guid ‘guid’

Stopping a RM means that the resource it controls will no longer take part of the experiment.

param guid:Guid of the RM
type guid:int
trace(guid, name, attr='all', block=512, offset=0)[source]

Returns information on a collected trace, the trace stream or blocks (chunks) of the trace stream

param name:

Name of the trace

type name:

str

param attr:

Can be one of: - TraceAttr.ALL (complete trace content), - TraceAttr.STREAM (block in bytes to read starting

at offset),

  • TraceAttr.PATH (full path to the trace file),
  • TraceAttr.SIZE (size of trace file).
type attr:

str

param block:

Number of bytes to retrieve from trace, when attr is TraceAttr.STREAM

type name:

int

param offset:

Number of ‘blocks’ to skip, when attr is TraceAttr.STREAM

type name:

int

rtype:

str

trace_enabled(guid, name)[source]

Returns True if the trace of name ‘name’ is enabled

Parameters:name (str) – Name of the trace
wait(guids, state, quit)[source]

Blocking method that waits until all RMs in the ‘guids’ list have reached a state >= ‘state’, or until the ‘quit’ callback yields True

param guids:List of guids
type guids:list
wait_deployed(guids)[source]

Blocking method that waits until all RMs in the ‘guids’ list have reached a state >= READY, or until a failure in the experiment occurs (i.e. abort == True)

param guids:List of guids
type guids:list
wait_finished(guids)[source]

Blocking method that waits until all RMs in the ‘guids’ list have reached a state >= STOPPED (i.e. STOPPED, FAILED or RELEASED ), or until a failure in the experiment occurs (i.e. abort == True)

param guids:List of guids
type guids:list
wait_released(guids)[source]

Blocking method that waits until all RMs in the ‘guids’ list have reached a state == RELEASED, or until the EC fails

param guids:List of guids
type guids:list
wait_started(guids)[source]

Blocking method that waits until all RMs in the ‘guids’ list have reached a state >= STARTED, or until a failure in the experiment occurs (i.e. abort == True)

param guids:List of guids
type guids:list
class nepi.execution.ec.FailureLevel[source]

Bases: object

Possible failure states for the experiment

EC_FAILURE = 3
OK = 1
RM_FAILURE = 2
class nepi.execution.ec.FailureManager[source]

Bases: object

The FailureManager is responsible for handling errors and deciding whether an experiment should be aborted or not

abort[source]
ec[source]

Returns the ExperimentController associated to this FailureManager

eval_failure(guid)[source]

Implements failure policy and sets the abort state of the experiment based on the failure state and criticality of the RM

Parameters:guid (int) – Guid of the RM upon which the failure of the experiment is evaluated
set_ec(ec)[source]
set_ec_failure()[source]

nepi.execution.resource module

class nepi.execution.resource.ResourceAction[source]

Action that a user can order to a Resource Manager

DEPLOY = 0
START = 1
STOP = 2
class nepi.execution.resource.ResourceFactory[source]

Bases: object

classmethod create(rtype, ec, guid)[source]

Create a new instance of a Ressource Manager

classmethod get_resource_type(rtype)[source]

Return the type of the Class

classmethod register_type(rclass)[source]

Register a new Ressource Manager

classmethod resource_types()[source]

Return the type of the Class

class nepi.execution.resource.ResourceManager(ec, guid)[source]

Bases: nepi.util.logger.Logger

Base clase for all ResourceManagers.

A ResourceManger is specific to a resource type (e.g. Node, Switch, Application, etc) on a specific platform (e.g. PlanetLab, OMF, etc).

The ResourceManager instances are responsible for interacting with and controlling concrete (physical or virtual) resources in the experimental platforms.

conditions[source]

Returns the conditions to which the RM is subjected to.

This method returns a dictionary of conditions lists indexed by a ResourceAction.

configure(*args, **kwargs)[source]
connections[source]

Returns the set of guids of connected RMs

deploy(*args, **kwargs)[source]
deploy_with_conditions()[source]

Deploy RM when all the conditions in self.conditions for action ‘READY’ are satisfied.

discover(*args, **kwargs)[source]
discover_time[source]

Returns the discover time of the RM as a timestamp

do_configure()[source]
do_connect(guid)[source]

Performs actions that need to be taken upon associating RMs. This method should be redefined when necessary in child classes.

do_deploy()[source]
do_disconnect(guid)[source]

Performs actions that need to be taken upon disassociating RMs. This method should be redefined when necessary in child classes.

do_discover()[source]
do_fail()[source]
do_provision()[source]
do_release()[source]
do_reserve()[source]
do_start()[source]
do_stop()[source]
ec[source]

Returns the Experiment Controller of the RM

enable_trace(name)[source]

Explicitly enable trace generation

Parameters:name (str) – Name of the trace
fail()[source]

Sets the RM to state FAILED.

This method should not be overridden directly. Specific functionality should be added in the do_fail method.

failed_time[source]

Returns the time failure occurred for the RM as a timestamp

get(name)[source]

Returns the value of the attribute

Parameters:name (str) – Name of the attribute
Return type:str
classmethod get_attribute(name)[source]

Returns a copy of the attribute with name ‘name’

classmethod get_attributes()[source]

Returns a copy of the attributes

get_connected(rtype=None)[source]

Returns the list of RM with the type ‘rtype’

Parameters:rtype (str) – Type of the RM we look for
Returns:list of guid
classmethod get_global(name)[source]
Returns the value of a global attribute
Global attribute meaning an attribute for all the resources from a rtype
Parameters:name (str) – Name of the attribute
Return type:str
classmethod get_help()[source]

Returns the description of the type of Resource

classmethod get_platform()[source]

Returns the identified of the platform (i.e. testbed type) for the Resource

classmethod get_rtype()[source]

Returns the type of the Resource Manager

classmethod get_traces()[source]

Returns a copy of the traces

guid[source]

Returns the global unique identifier of the RM

has_attribute(name)[source]

Returns true if the RM has an attribute with name

Parameters:name (string) – name of the attribute
has_changed(name)[source]
Returns the True is the value of the attribute
has been modified by the user.
Parameters:name (str) – Name of the attribute
Return type:str
has_flag(name, flag)[source]

Returns true if the attribute has the flag ‘flag’

Parameters:flag (Flags) – Flag to be checked
is_rm_instance(rtype)[source]

Returns True if the RM is instance of ‘rtype’

Parameters:rtype (str) – Type of the RM we look for
Returns:True|False
log_message(msg)[source]

Returns the log message formatted with added information.

Parameters:msg (str) – text message
Return type:str
provision(*args, **kwargs)[source]
provision_time[source]

Returns the provision time of the RM as a timestamp

ready_time[source]

Returns the deployment time of the RM as a timestamp

register_condition(action, group, state, time=None)[source]

Registers a condition on the resource manager to allow execution of ‘action’ only after ‘time’ has elapsed from the moment all resources in ‘group’ reached state ‘state’

Parameters:
  • action (str) – Action to restrict to condition (either ‘START’ or ‘STOP’)
  • group (int or list of int) – Group of RMs to wait for (list of guids)
  • state (str) – State to wait for on all RM in group. (either ‘STARTED’, ‘STOPPED’ or ‘READY’)
  • time (str) – Time to wait after ‘state’ is reached on all RMs in group. (e.g. ‘2s’)
register_connection(guid)[source]

Registers a connection to the RM identified by guid

This method should not be overridden. Specific functionality should be added in the do_connect method.

Parameters:guid (int) – Global unique identified of the RM to connect to
release()[source]

Perform actions to free resources used by the RM.

This method is responsible for releasing resources that were used during the experiment by the RM.

This method should not be overridden directly. Specific functionality should be added in the do_release method.

release_time[source]

Returns the release time of the RM as a timestamp

reschedule_delay[source]

Returns default reschedule delay

reserve(*args, **kwargs)[source]
reserved_time[source]

Returns the reserved time of the RM as a timestamp

set(name, value)[source]

Set the value of the attribute

Parameters:
  • name (str) – Name of the attribute
  • name – Value of the attribute
set_discovered(time=None)[source]

Mark ResourceManager as DISCOVERED

set_failed(time=None)[source]

Mark ResourceManager as FAILED

classmethod set_global(name, value)[source]

Set value for a global attribute

Parameters:
  • name (str) – Name of the attribute
  • name – Value of the attribute
set_provisioned(time=None)[source]

Mark ResourceManager as PROVISIONED

set_ready(time=None)[source]

Mark ResourceManager as READY

set_released(time=None)[source]

Mark ResourceManager as REALEASED

set_reserved(time=None)[source]

Mark ResourceManager as RESERVED

set_started(time=None)[source]

Mark ResourceManager as STARTED

set_state(state, state_time_attr, time=None)[source]

Set the state of the RM while keeping a trace of the time

set_state_time(state, state_time_attr, time)[source]

Set the time for the RM state change

set_stopped(time=None)[source]

Mark ResourceManager as STOPPED

set_with_conditions(name, value, group, state, time)[source]

Set value ‘value’ on attribute with name ‘name’ when ‘time’ has elapsed since all elements in ‘group’ have reached state ‘state’

Parameters:
  • name (str) – Name of the attribute to set
  • name – Value of the attribute to set
  • group (int or list of int) – Group of RMs to wait for (list of guids)
  • state (str) – State to wait for on all RM in group. (either ‘STARTED’, ‘STOPPED’ or ‘READY’)
  • time (str) – Time to wait after ‘state’ is reached on all RMs in group. (e.g. ‘2s’)
start(*args, **kwargs)[source]
start_time[source]

Returns the start time of the RM as a timestamp

start_with_conditions()[source]

Starts RM when all the conditions in self.conditions for action ‘START’ are satisfied.

state[source]

Get the current state of the RM

stop(*args, **kwargs)[source]
stop_time[source]

Returns the stop time of the RM as a timestamp

stop_with_conditions()[source]

Stops RM when all the conditions in self.conditions for action ‘STOP’ are satisfied.

trace(name, attr='all', block=512, offset=0)[source]

Get information on collected trace

Parameters:
  • name (int) – Name of the trace
  • attr (str) – Can be one of: - TraceAttr.ALL (complete trace content), - TraceAttr.STREAM (block in bytes to read starting at offset), - TraceAttr.PATH (full path to the trace file), - TraceAttr.SIZE (size of trace file).
  • block – Number of bytes to retrieve from trace, when attr is TraceAttr.STREAM
  • offset – Number of ‘blocks’ to skip, when attr is TraceAttr.STREAM
Return type:

str

trace_enabled(name)[source]

Returns True if trace is enables

Parameters:name (str) – Name of the trace
unregister_condition(group, action=None)[source]

Removed conditions for a certain group of guids

Parameters:
  • action (str) – Action to restrict to condition (either ‘START’, ‘STOP’ or ‘READY’)
  • group (int or list of int) – Group of RMs to wait for (list of guids)
unregister_connection(guid)[source]

Removes a registered connection to the RM identified by guid

This method should not be overridden. Specific functionality should be added in the do_disconnect method.

Parameters:guid (int) – Global unique identified of the RM to connect to
valid_connection(guid)[source]

Checks whether a connection with the other RM is valid. This method need to be redefined by each new Resource Manager.

Parameters:guid (int) – Guid of the current Resource Manager
Return type:Boolean
class nepi.execution.resource.ResourceState[source]

State of a Resource Manager

DISCOVERED = 1
FAILED = 7
NEW = 0
PROVISIONED = 3
READY = 4
RELEASED = 8
RESERVED = 2
STARTED = 5
STOPPED = 6
nepi.execution.resource.clsinit(cls)[source]

Initializes template information (i.e. attributes and traces) on classes derived from the ResourceManager class.

It is used as a decorator in the class declaration as follows:

@clsinit class MyResourceManager(ResourceManager):

...
nepi.execution.resource.clsinit_copy(cls)[source]

Initializes template information (i.e. attributes and traces) on classes derived from the ResourceManager class. It differs from the clsinit method in that it forces inheritance of attributes and traces from the parent class.

It is used as a decorator in the class declaration as follows:

@clsinit class MyResourceManager(ResourceManager):

...

clsinit_copy should be prefered to clsinit when creating new ResourceManager child classes.

nepi.execution.resource.failtrap(func)[source]

Decorator function for instance methods that should set the RM state to FAILED when an error is raised. The methods that must be decorated are: discover, reserved, provision, deploy, start, stop.

nepi.execution.resource.find_types()[source]

Look into the different folders to find all the availables Resources Managers

nepi.execution.resource.populate_factory()[source]

Find and rgister all available RMs

nepi.execution.runner module

class nepi.execution.runner.ExperimentRunner[source]

Bases: object

The ExperimentRunner entity is responsible of re-running an experiment described by an ExperimentController multiple time

evaluate_normal_convergence(ec, run, metrics)[source]

Returns True when the confidence interval of the sample mean is less than 5% of the mean value, for a 95% confidence level, assuming normal distribution of the data

run(ec, min_runs=1, max_runs=-1, wait_time=0, wait_guids=[], compute_metric_callback=None, evaluate_convergence_callback=None)[source]

Run a same experiment independently multiple times, until the evaluate_convergence_callback function returns True

Parameters:
  • ec (ExperimentController) – Description of experiment to replicate. The runner takes care of deploying the EC, so ec.deploy() must not be invoked directly before or after invoking runner.run().
  • min_runs (int) – Minimum number of times the experiment must be replicated
  • max_runs (int) – Maximum number of times the experiment can be replicated
  • wait_time (float) – Time to wait in seconds on each run between invoking ec.deploy() and ec.release().
  • wait_guids (list) – List of guids wait for finalization on each run. This list is passed to ec.wait_finished()
  • compute_metric_callback (function) –

    User defined function invoked after each experiment run to compute a metric. The metric is usually a network measurement obtained from the data collected during experiment execution. The function is invoked passing the ec and the run number as arguments. It must return the value for the computed metric(s) (usually a single numerical value, but it can be several).

    metric = compute_metric_callback(ec, run)
  • evaluate_convergence_callback (function) –

    User defined function invoked after computing the metric on each run, to evaluate the experiment was run enough times. It takes the list of cumulated metrics produced by the compute_metric_callback up to the current run, and decided whether the metrics have statistically converged to a meaningful value or not. It must return either True or False.

    stop = evaluate_convergence_callback(ec, run, metrics)

    If stop is True, then the runner will exit.

run_experiment(filepath, wait_time, wait_guids)[source]

Run an experiment based on the description stored in filepath.

nepi.execution.scheduler module

class nepi.execution.scheduler.HeapScheduler[source]

Bases: object

Create a Heap Scheduler

Note

This class is thread safe. All calls to C Extensions are made atomic by the GIL in the CPython implementation. heapq.heappush, heapq.heappop, and list access are therefore thread-safe.

next()[source]

Get the next task in the queue by timestamp and arrival order

pending[source]

Returns the list of pending task ids

remove(tid)[source]

Remove a task form the queue

Parameters:tid (int) – Id of the task to be removed
schedule(task)[source]

Add a task to the queue ordered by task.timestamp and arrival order

Parameters:task (task) – task to schedule
class nepi.execution.scheduler.Task(timestamp, callback)[source]

Bases: object

A Task represents an operation to be executed by the ExperimentController scheduler

class nepi.execution.scheduler.TaskStatus[source]

Execution state of the Task

DONE = 1
ERROR = 2
NEW = 0

nepi.execution.tags module

nepi.execution.trace module

class nepi.execution.trace.Trace(name, help, enabled=False)[source]

Bases: object

A Trace represents information about a Resource that can be collected

help[source]

Returns the help of the trace

name[source]

Returns the name of the trace

class nepi.execution.trace.TraceAttr[source]

A Trace attribute defines information about a Trace that can be queried

ALL = 'all'
PATH = 'path'
SIZE = 'size'
STREAM = 'stream'

Module contents