-
Notifications
You must be signed in to change notification settings - Fork 10
restaflib introduction
restaflib is a helper library built on top of restaf to simplify very common scenarios.
- Executing single cas actions
- Scripting multiple cas actions on the CAS server using casl
- Scoring with a model in a CAS server
- Scoring with a model published to a CAS destination
- Scoring with a model published to MAS(MicroAnalytic Service)
- Browsing thru a CAS Table
- Executing a SAS program using compute Service and retrieving the results.
- Upload data to CAS
These scenarios are discussed in this section.
Calls cas server and returns the results(async)
Returns: object
- returns results from cas
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
cas session |
parameters | object |
parameters for the action |
Fetch rows from cas Tables
Returns: object
- see doc. {pagination: {prev: pagePrev, next: pageNext, count: count}, data: {schema: co The prev and next are as follows: Either it is -1 to indicate EOF or a number to start the next obs no to start the fetc from
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
cas session |
table | object |
table {caslib: x, name: y} to read from |
control | object |
what to read {from: n, count:n , format: true |
Calls cas server and returns the results(async)
Returns: object
- returns results from cas
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
cas session |
src | object |
casl src statements |
args | object |
user input args |
Calls cas server and returns the results(async)
Returns: object
- standard return value from apiCall
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
cas session |
src | object |
casl src statements |
args | object |
arguments to pass to on to CAS as args |
Score data in casl
Returns: object
- returns the scores as an object
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
cas session |
scenario | object |
scenario values |
Calls cas server and returns the results(async)
Returns: object
- returns an object {session: xxx, servers: yyy}
Param | Type | Description |
---|---|---|
store | object |
restaf store |
logonPayload | object |
if not null, then use this logon to Viya |
Calls cas server and returns the results(async)
Returns: object
- returns an object {session: xxx, servers: yyy}
Converts a cas table to JSON
Returns: object
- - the new json version
Param | Type | Description |
---|---|---|
result | object |
the raf object retrned from a call to cas |
table | string |
the name of the table |
Fetch data from a SAS Table
Returns: object
- - {columns: , rows: , scrollOptions: }
Param | Type | Description |
---|---|---|
store | object |
restaf store |
computeSummary | object |
Summary object created by computeSummary method |
table | string |
name of the table |
direction | string |
null |
Return Log|listing|ODS|list of tables in the compute service job
Returns: object
| string
- - string for all except tables(array)
Param | Type | Description |
---|---|---|
store | object |
restaf store |
computeSummary | object |
computeSummary object |
type | string |
type of result( log |
Prepare data for runCompute(@async)
Returns: object
- computeSummary object
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
current compute service session |
src | string |
code to execute |
args | object |
args to be passed on as macros |
Reduce compute service to an consummable form(async)
Returns: object
- computeSummary Object
Param | Type | Description |
---|---|---|
store | object |
restaf store |
session | object |
compute service session |
code | code |
SAS code to be executed |
Setup access to compute service
Returns: object
- - returns a compute session
Param | Type | Description |
---|---|---|
store | object |
restaf store |
contextName | string |
name of the context( if null the first context in the list is used) |
payload | object |
logon payload - If null assumes that logon was done earlier. |
Reduce the job information into consummable form(async)
Returns: object
- - the computeSummary object for easy handling of logs,listing,ods, tables
Param | Type | Description |
---|---|---|
store | object |
restaf store |
job | object |
rafObject representing the compute service job |
Search for a named report(async)
Returns: object
- - either null or rafObject for the report
Param | Type | Description |
---|---|---|
store | object |
restaf store |
name | string |
name of the VA report |
Return the svg of the specified report(async)
Returns: string
- - the svg of the report
Param | Type | Description |
---|---|---|
store | object |
restaf store |
name | string |
name of the report |
Generate url for report(async)
Returns: string
- url for the report
Param | Type | Description |
---|---|---|
store | object |
restaf store |
name | string |
name of report |
Convert table to object of the form {var1: value, var2: value,...},....
Returns: object
- - resulting json
Param | Type | Description |
---|---|---|
store | object |
restaf store |
computeSummary | object |
computeSummary |
tableName | string |
name of the table |
Produce a string with casl dictionary suitable for inclusion in casl code
Returns: string
- returns the string containing the casl dictionary
Param | Type | Description |
---|---|---|
obj | object |
the JS object of interest |
name | string |
the name to assign to the dictionary |
Example
obj = {x: 1, b:2, c: ['a','b']};
name ='_appEnv_';
result is a string _appEnv_ = {x=2, b=3, c={"a', "b"}}
Score using MAS
Returns: object
- - return results {name: value, name: value}
Param | Type | Description |
---|---|---|
store | object |
store |
masControl | object |
object from masSetup |
modelName | string |
name of model to be executed |
stepName | string |
if not specified it will default to the first step |
setup access to MAS
Returns: object
- - masControl used in masRun
Param | Type | Description |
---|---|---|
store | object |
restaf store |
models | object |
an array of model names |
logonPayload | object |
restaf logon payload(set to null if already authenticated) |
.... Under construction...
-
restaf
-
restaflib
-
Examples:
- Cas Server
- Compute Server
- Scoring with MAS
- Scoring with CAS
- Utility
-
CAS Related Functions
-
MAS Related Functions
-
Compute Server Related Functions
-
Reports Related Functions
-
Interactive CLI
-
Special Topic