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:
*args : any

Positional argument passed to OrderedDict constructor

**kwargs : any

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:
performance : CASPerformance object

Performance metrics of the action.

messages : list-of-strings

List of message strings.

signature : dict

The action call’s signature.

session : string

Unique identifier of CAS session where action was executed.

updateflags : set-of-strings

Set of resources updated in the last action.

severity : int

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.

reason : string

Reason for error.

status : string

Formatted status message.

status_code : int

Status code for the result.

__init__(*args, **kwargs)

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

Methods

__init__(*args, **kwargs) Initialize self.
clear()
concat_bygroups([inplace]) Concatenate all tables within a By group into a single table
copy()
fromkeys(S[, v]) If not specified, the value defaults to None.
get(k[,d])
get_group(*name, **kwargs) Return a CASResults object of the specified By group tables
get_set(num) Return a CASResults object of the By group set
get_tables(name[, set, concat]) Return all tables ending with name in all By groups
items()
keys()
move_to_end Move an existing element to the end (or beginning if last==False).
pop(k[,d]) value.
popitem() Pairs are returned in LIFO order if last is true or FIFO order if false.
setdefault(k[,d])
update([E, ]**F) 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()