analytics

class pilot.api.analytics.Analytics(**kwargs)[source]

Analytics service class.

__init__(**kwargs)[source]

Init function.

Parameters:

kwargs

__module__ = 'pilot.api.analytics'
_fit = None
chi2()[source]

Return the chi2 of the fit.

Raises:

NotDefined – exception thrown if fit is not defined.

Returns:

chi2 (float).

extract_from_table(table, x_name, y_name)[source]
Parameters:
  • table – dictionary with columns.

  • x_name – column name to be extracted (string).

  • y_name – column name to be extracted (may contain ‘+’-sign) (string).

Returns:

x (list), y (list).

fit(x, y, model='linear')[source]

Fitting function. For a linear model: y(x) = slope * x + intersect

Parameters:
  • x – list of input data (list of floats or ints).

  • y – list of input data (list of floats or ints).

  • model – model name (string).

Raises:

UnknownException – in case Fit() fails.

Returns:

get_fitted_data(filename, x_name='Time', y_name='pss+swap', precision=2, tails=True)[source]

Return a properly formatted job metrics string with analytics data. Currently the function returns a fit for PSS+Swap vs time, whose slope measures memory leaks.

Parameters:
  • filename – full path to memory monitor output (string).

  • x_name – optional string, name selector for table column.

  • y_name – optional string, name selector for table column.

  • precision – optional precision for fitted slope parameter, default 2.

  • tails – should tails (first and last values) be used? (boolean).

Returns:

{“slope”: slope, “chi2”: chi2} (float strings with desired precision).

get_table(filename, header=None, separator='\t', convert_to_float=True)[source]
Parameters:
  • filename – full path to input file (string).

  • header – header string.

  • separator – separator character (char).

  • convert_to_float – boolean, if True, all values will be converted to floats.

Returns:

dictionary.

intersect()[source]

Return the intersect of a linear fit, y(x) = slope * x + intersect.

Raises:

NotDefined – exception thrown if fit is not defined.

Returns:

intersect (float).

slope()[source]

Return the slope of a linear fit, y(x) = slope * x + intersect.

Raises:

NotDefined – exception thrown if fit is not defined.

Returns:

slope (float).

class pilot.api.analytics.Fit(**kwargs)[source]

Low-level fitting class.

__dict__ = mappingproxy({'__module__': 'pilot.api.analytics', '__doc__': '\n    Low-level fitting class.\n    ', '_model': 'linear', '_x': None, '_y': None, '_xm': None, '_ym': None, '_ss': None, '_ss2': None, '_slope': None, '_intersect': None, '_chi2': None, '__init__': <function Fit.__init__>, 'fit': <function Fit.fit>, 'value': <function Fit.value>, 'set_chi2': <function Fit.set_chi2>, 'chi2': <function Fit.chi2>, 'set_slope': <function Fit.set_slope>, 'slope': <function Fit.slope>, 'set_intersect': <function Fit.set_intersect>, 'intersect': <function Fit.intersect>, '__dict__': <attribute '__dict__' of 'Fit' objects>, '__weakref__': <attribute '__weakref__' of 'Fit' objects>, '__annotations__': {}})
__init__(**kwargs)[source]

Init function.

Parameters:

kwargs

Raises:

PilotException – NotImplementedError for unknown fitting model, NotDefined if input data not defined.

__module__ = 'pilot.api.analytics'
__weakref__

list of weak references to the object (if defined)

_chi2 = None
_intersect = None
_model = 'linear'
_slope = None
_ss = None
_ss2 = None
_x = None
_xm = None
_y = None
_ym = None
chi2()[source]

Return the chi2 value.

Returns:

chi2 (float).

fit()[source]

Return fitting object.

Returns:

fitting object.

intersect()[source]

Return the intersect value.

Returns:

intersect (float).

set_chi2()[source]

Calculate and set the chi2 value.

Returns:

set_intersect()[source]

Calculate and set the intersect of the linear fit.

Returns:

set_slope()[source]

Calculate and set the slope of the linear fit.

Returns:

slope()[source]

Return the slope value.

Returns:

slope (float).

value(t)[source]

Return the value y(x=t) of a linear fit y(x) = slope * x + intersect.

Returns:

intersect (float).