swat.cas.results.CASResults

class swat.cas.results.CASResults(*args, **kwargs)

Bases: swat.cas.results.RendererMixin, collections.OrderedDict

Ordered collection of results from a CAS action

The output of all CAS actions is a CASResults object. This is a Python ordered dictionary with a few methods added to assist in handling the output keys, and attributes added to report information from the CAS action.

Parameters
*argsany

Positional argument passed to OrderedDict constructor

**kwargsany

Arbitrary keyword arguments passed to OrderedDict constructor

Returns
CASResults object

Examples

>>> conn = swat.CAS()
>>> out = conn.serverstatus()

Calling standard Python dictionary methods.

>>> print(list(out.keys()))
['About', 'server', 'nodestatus']

Accessing keys.

>>> print(out['About'])
{'license': {'siteNum': 1, 'warningPeriod': 31,
 'expires': '08Sep2016:00:00:00', ... }}

You can also access keys using attribute syntax as long as the key name doesn’t collide with an existing attribute or method.

>>> print(out.About)
{'license': {'siteNum': 1, 'warningPeriod': 31,
 'expires': '08Sep2016:00:00:00', ... }}

Iterating over items.

>>> for key, value in out.items():
...     print(key)
About
server
nodestatus

Display status information and performance metrics for the CAS action.

>>> print(out.status)
None
>>> print(out.severity)
0
>>> print(out.performance)
CASPerformance(cpu_system_time=0.004999, cpu_user_time=0.020997,
               data_movement_bytes=0, data_movement_time=0.0,
               elapsed_time=0.025089, memory=704160, memory_os=9228288,
               memory_quota=19746816, system_cores=24, system_nodes=1,
               system_total_memory=101427879936)
Attributes
performanceCASPerformance object

Performance metrics of the action.

messageslist-of-strings

List of message strings.

signaturedict

The action call’s signature.

sessionstring

Unique identifier of CAS session where action was executed.

updateflagsset-of-strings

Set of resources updated in the last action.

severityint

Severity level of the action response. A value of zero means that no problems were reported. A value of 1 means that warnings were reported. A value of 2 means that errors were reported.

reasonstring

Reason for error.

statusstring

Formatted status message.

status_codeint

Status code for the result.

__init__(self, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, \*args, \*\*kwargs)

Initialize self.

clear()

concat_bygroups(self[, inplace])

Concatenate all tables within a By group into a single table

copy()

fromkeys(iterable[, value])

Create a new ordered dictionary with keys from iterable and values set to value.

get(self, key[, default])

Return the value for key if key is in the dictionary, else default.

get_group(_self_, \*name, \*\*kwargs)

Return a CASResults object of the specified By group tables

get_set(self, num)

Return a CASResults object of the By group set

get_tables(self, name[, set, concat])

Return all tables ending with name in all By groups

items()

keys()

move_to_end(self, /, key[, last])

Move an existing element to the end (or beginning if last is false).

pop()

value.

popitem(self, /[, last])

Remove and return a (key, value) pair from the dictionary.

setdefault(self, /, key[, default])

Insert key with a value of default if key is not in the dictionary.

update()

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()