What the expected response(s) are by Moab for these scripts:
CREATEURL, STARTURL, PAUSEURL, RESUMEURL, UPDATEURL, CONTINUEURL, ENDURL, DELETEURL, and QUERYURL


Problem:

I need to know for each of the following, what the expected response(s) are by Moab for these scripts:

CREATEURL, STARTURL, PAUSEURL, RESUMEURL, UPDATEURL, CONTINUEURL, ENDURL, DELETEURL, and QUERYURL

 

In native mode, actions default to using the following scripts:

 

Create:        usage.quote.mam.pl

Start:                usage.reserve.mam.pl

Pause:                usage.charge.mam.pl

Resume:        usage.reserve.mam.pl

Update:        usage.charge.mam.pl

Continue:        usage.reserve.mam.pl

End:                usage.charge.mam.pl

Delete:                lien.delete.mam.pl

Query:                account.query.mam.pl

 

Of course, any of these can be changed to point to any compatible script.

 

SOLUTION:

The duty of the script is to:

 

1) read the request XML from stdin,

2) parse the request,

3) interact as necessary with the accounting manager, and

4) return (a) an exit code indicating success or failure of the request, with (b) any necessary XML data on stdout and (c) any message on stderr.

 

The purposes of the various actions are described in the Moab documentation.

 

The exit codes are a decade-version of the SSSRMAP exit codes (using the exit code / 10), i.e.:

 

  ms3cSuccess                       = 0,        /* Success */

  ms3cUsage                         = 1,        /* Help/Usage Reply */

  ms3cStatus                        = 2,        /* Status Reply */

  ms3cSubsriptionOK                 = 3,        /* Subscription Reply */

  ms3cRegistrationOK                = 4,        /* Registration Reply */

  ms3cWarning                       = 10,   /* General Warning */

  ms3cProtocolWarning               = 11,   /* Wire Protocol Warning */

  ms3cFormatWarning                 = 12,   /* Message Format Warning */

  ms3cSecurityWarning               = 13,   /* Security Warning */

  ms3cContentWarning                = 14,   /* Content or Action Warning */

  ms3cWireProtocol                  = 20,   /* General Wire Protocol or Network Error */

  ms3cNetwork                       = 21,   /* Network Error */

  ms3cConnection                    = 22,   /* Connection Failure */

  ms3cTimeOut                       = 23,   /* Connection Timed Out */

  ms3cFraming                       = 24,   /* Framing Failure */

  ms3cMessageFormat                 = 30,   /* General Message Format Error */

  ms3cSyntaxRequest                 = 31,   /* Syntax Error in Request */

  ms3cSyntaxResponse                = 32,   /* Syntax Error in Response */

  ms3cPipeline                      = 33,   /* Pipelining Failure */

  ms3cSecurity                      = 40,   /* General Security Error */

  ms3cNegotiation                   = 41,   /* Negotiation Failure */

  ms3cAuthentication                = 42,   /* Authentication Failure */

  ms3cEncryption                    = 43,   /* Encryption Failure */

  ms3cAuthorization                 = 44,   /* Authorization Failure */

  ms3cEventManagement       = 50,   /* General Event Management Error */

  ms3cSubscription                  = 51,   /* Subscription Failed */

  ms3cNotification                  = 52,   /* Notification Failed */

  ms3cServerApplication             = 70,   /* General Server-side Application-specific Error */

  ms3cServerUnsupported             = 71,   /* Not Supported by Server */

  ms3cServerInternalError           = 72,   /* Internal Error at Server */

  ms3cServerResourceUnavailable = 73,   /* Resource Unavailable at Server */

  ms3cServerBusinessLogic   = 74,   /* Business Logic Error at Server */

  ms3cNoFunds                       = 78,   /* Insufficient Funds */

  ms3cClientApplication             = 80,   /* General Client-side Application-specific Error */

  ms3cClientUnsupported             = 81,   /* Not Supported by Client */

  ms3cClientInternalError           = 82,   /* Internal Error at Client */

  ms3cClientResourceUnavailable = 83,   /* Resource Unavailable at Client */

  ms3cClientBusinessLogic           = 84,   /* Business Logic Error at Client */

  ms3cMiscellaneous                 = 90,   /* Miscellaneous Failure */

  ms3cUnknown                       = 99,   /* Unknown Failure */

 

Although 0 is the quintessential success, exit codes in the range 0-19 are all considered successful as these are all in the success or warning response code ranges. All other exit codes are considered failures, with exit codes outside of this range being mapped to 99 (an unknown failure).

 

An exit code of 21 or 22 will result in marking AM in the Down state. An exit code in the range of 24-39 will result in the AM being marked in the Corrupt state.

 

Moab uses certain exit code ranges to trigger failure actions from a reserve call (Start, Resume, or Continue action). An exit code of 78 will trigger the Funds Failure Action. An exit code of 21 or 22 will trigger the Connection Failure Action. All other failure codes (anything other than 0-19), will trigger the General Failure Action.

 

Messages are placed on stderr. Failure messages associated with a job action will often be added to the job's message buffer.

 

Data on stdout is in XML format such as in the following sample output:

 

<Data><Charge><UsageRecord>64</UsageRecord><Instance>j1</Instance><Amount>20</Amount><Balance>49998045</Balance></Charge></Data>.

 

If the UsageRecord element is specified, this will be injected into the job as the value of the UsageRecord job variable.

 

If using the fast-allocation accounting mode and the Balance element is specified, this will be used to update the Moab internal cached balance for the job's account. Adaptive Computing does not support the use of fast-allocation when not using the MAM accounting manager.

 

Here are some example responses:

 

Successful reservation call (Start, Resume or Continue action):

Exit code: 0

Stdout: <Data><Charge><Lien>18</Lien><UsageRecord>28</UsageRecord><Instance>27</Instance><Amount>0.08</Amount></Charge></Data>

Stderr: Successfully reserved 0.08 credits with lien id 18 for instance 27 and created usage record 28

 

Insufficient funds in a reserve call (Start, Resume or Continue action):

Exit code: 78

Stderr: Insufficient balance to reserve usage (Instance 28)

 

User not member of account in a reserve call (Start, Resume or Continue action):

Exit code: 74

Stderr: User adaptive is not a valid member of Account film

 

Accounting Manager not running:

Exit code: 22

Stderr: Failed sending message: (Unable to connect to socket (Connection refused)).

 

Successful charge call (Pause, Update or End action):

Exit code: 0

Stdout: <Data><Charge><UsageRecord>31</UsageRecord><Instance>28</Instance><Amount>0.01</Amount></Charge></Data>

Stderr: Successfully charged 0.01 credits for instance 28 and created usage record 31

 

Successful quote call (Create action):

Exit code: 0

Stdout: <Data><Charge><Instance>Moab.22</Instance><Amount>0.08</Amount></Charge></Data>

Stderr: Successfully quoted 0.08 credits for instance Moab.22

 

User not member of account in quote call (Create action):

Exit code: 74

Stderr: User adaptive is not a valid member of Account film

 

Successful response to lien delete call (Delete action):

Exit code: 0

Stdout: <Data><Lien><Id>18</Id><Instance>27</Instance><UsageRecord>28</UsageRecord><StartTime>1509576419</StartTime><EndTime>1509576719</EndTime><Duration>300</Duration><Description></Description></Lien></Data>

Stderr: Successfully deleted 1 lien and 1 association

 

Successful response to account query call (Query action):

Exit code: 0

Stdout: <Data><Account_User_AccountUser><Account>chemistry</Account><User>amy</User><DefaultAccount>chemistry</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>biology</Account><User>amy</User><DefaultAccount>chemistry</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>film</Account><User>bob</User><DefaultAccount>biology</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>biology</Account><User>bob</User><DefaultAccount>biology</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>film</Account><User>dave</User><DefaultAccount>film</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>chemistry</Account><User>dave</User><DefaultAccount>film</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>biology</Account><User>adaptive</User><DefaultAccount>chemistry</DefaultAccount></Account_User_AccountUser><Account_User_AccountUser><Account>chemistry</Account><User>adaptive</User><DefaultAccount>chemistry</DefaultAccount></Account_User_AccountUser></Data>

 

The message sent to stderr is usually not parsed. It is usually just passed along to the job messages. The data sent on stdout for non-query calls is probably not that important for non-MAM accounting managers because it is primarily used for fast-allocation accounting mode where Moab caches intermediate balance data from MAM.

 

The query action is only used if the AMCFG[] CREATECRED=TRUE parameter is set in moab.cfg. This is used to synchronize account,user,user::account information from MAM into Moab.

 

The quote call will only be issued if the AMCFG[] VALIDATEJOBSUBMISSION=TRUE parameter is set in moab.cfg.

Tags: mam, nativerm
Last update:
2017-11-02 23:26
Author:
Shawn Hoopes
Revision:
1.1
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags