SAS Viya. Kevin D. Smith

Чтение книги онлайн.

Читать онлайн книгу SAS Viya - Kevin D. Smith страница 19

Автор:
Жанр:
Серия:
Издательство:
SAS Viya - Kevin D. Smith

Скачать книгу

actionSetInfo Shows the build information from loa...

      0 addNode Adds a machine to the server

      16 casCommon Provides parameters that are common ...

      18 echo Prints the supplied parameters to th...

      20 getLicenseInfo Shows the license information for a ...

      2 help Shows the parameters for an action o...

      15 history Shows the actions that were run in t...

      22 httpAddress Shows the HTTP address for the serve...

      5 installActionSet Loads an action set in new sessions ...

      3 listNodes Shows the host names used by the server

      4 loadActionSet Loads an action set for use in this ...

      6 log Shows and modifies logging levels

      19 modifyQueue Modifies the action response queue s...

      17 ping Sends a single request to the server...

      7 queryActionSet Shows whether an action set is loaded

      8 queryName Checks whether a name is an action o...

      9 reflect Shows detailed parameter information...

      21 refreshLicense Refresh SAS license information from...

      1 removeNode Remove one or more machines from the...

      10 serverStatus Shows the status of the server

      12 shutdown Shuts down the server

      13 userInfo Shows the user information for your ...

      If we wanted to combine all of the output DataFrames into one DataFrame, we can use the concat function in the Pandas package. We use the values method of the CASResults object to get all of the values in the dictionary (which are DataFrames, in this case). Then we concatenate them using concat with the ignore_index=True option so that it creates a new unique index for each row.

      In [40]: import pandas as pd

      In [41]: pd.concat(out.values(), ignore_index=True)

       Out[41]:

      name description

      0 assumeRole Assumes a role

      1 dropRole Relinquishes a role

      2 showRolesIn Shows the currently active role

      3 showRolesAllowed Shows the roles that a user is a mem...

      4 isInRole Shows whether a role is assu...

      137 queryCaslib Checks whether a caslib exists

      138 partition Partitions a table

      139 recordCount Shows the number of rows in a Cloud ...

      140 loadDataSource Loads one or more data source interf...

      141 update Updates rows in a table

      [142 rows x 2 columns]

      In addition to result values, the CASResults object also contains information about the return status of the action. We look at that in the next section.

      Checking the Return Status of CAS Actions

      In a perfect world, we always get the parameters to CAS actions correct and the results that we want are always returned. However, in the real world, errors occur. There are several attributes on the CASResults object that can tell you the return status information of a CAS action. They are described in the following table:

Attribute Name Description
severity An integer value that indicates the severity of the return status. A zero status means that the action ran without errors or warnings. A value of 1 means that warnings were generated. A value of 2 means that errors were generated.
reason A string value that indicates the class of error that occurred. Reason codes are described in the “Details” section later in this chapter.
status A text message that describes the error that occurred.
status_code An encoded integer that contains information that can be used by Technical Support to help determine the cause of the error.

      In addition to the attributes previously described, the messages attribute contains any messages that were printed during the execution of the action. While you likely saw the messages as they were being printed by the action, it can sometimes be useful to have them accessible on the CASResults object for programmatic inspection. Let’s use the help action for help on an action that does exist and also an action that doesn’t exist to see the status information attributes in action.

      The first example, as follows, asks for help on an existing action. The returned status attributes are all zeros for numeric values and None for reason and status. The messages attribute contains a list of all messages that are printed by the server.

      In [42]: out = conn.help(action='help')

      NOTE: Information for action 'builtins.help':

      NOTE: The following parameters are accepted.

      Default values are shown.

      NOTE: string action=NULL,

      NOTE: specifies the name of the action for which you want help.

      The name can be in the form 'actionSetName.actionName'

      or just 'actionName'.

      NOTE: string actionSet=NULL,

      NOTE: specifies the name of the action set for which you

      want help. This parameter is ignored if the action

      parameter is specified.

      NOTE: boolean verbose=true

      NOTE: when set to True, provides more detail for each parameter.

      In [43]: print(out.status)

      None

      In [44]: out.status_code

      Out[44]: 0

      In

Скачать книгу