ScripExecOrder

From Request Tracker Wiki
Jump to: navigation, search

Introduction

Term request - EMail message or http request via Web UI.

If you've tried Jumbo page then you should understand that one request could result in more than one transaction. More usual variant is resolve action. You click resolve, fill in comment, submit form(request). RT writes two transactions 'Comment' and 'Status changed'.

Since RT3.0.8 Scrips have new property "stage". In 3.0.8 there is [=TransactionCreate] and [=TransactionBatch] stage, before this version all scrips were at [=TransactionCreate] stage which is default. See TransactionBatchStage for more info.

Since RT3.5.8, Scrips are executed in order alphanumerically by their descriptions, so you can enforce a particular ordering by prepending a number (00, 07, 10, 24...) to the description you give each scrip.

The difference

When you resolve a ticket you usually also comment on it, so your "request" consists of a "resolve"-transaction and a "comment"-transaction

request = resolve + comment

transaction create: resolve, scrips, comment, scrips

transaction batch: resolve, comment, scrips

NOTE: RT from 3.6.x up to 3.6.3 has a bug that creates an extra "correspond"-transaction to fetch the mailaddresses on a correspon-reply in transactionbatch-stage. A patch was posted to the rt-users list for this bug: http://lists.bestpractical.com/pipermail/rt-users/attachments/20070204/4f331f76/rt-3.6.3-transaction_batch.bin

What we have

Ok, we have Tranasction1, Transaction2,...TransactionT

Scrips which triggered Transactions are:

  • Transaction create stage scrips CScrip11...CScrip1T...CScripC1...CScripCT.
  • Transaction batch stage scrips BScrip11...BScrip1T...BScripB1...BScripBT.

Each scrip has preparation and commit phase.

T, C, B are natural numbers.

Tree

  • TransactionCreate stage:
      • Create Transaction1
        • Prepare scrips (order of preparation is unpredictable)
          • Prepare CScrip11
          • Prepare CScrip21
          • ...
          • Prepare CScripC1
        • Commit scrips (in same order as they were prepared)
          • Commit CScrip11
          • Commit CScrip21
          • ...
          • Commit CScripC1
      • Create Transaction2
        • Prepare scrips
          • Prepare CScrip12
          • ...
          • Prepare CScripC2
        • Commit scrips
          • Commit CScrip12
          • ...
          • Commit CScripC2
          • ...
      • Create TransactionT
    ...
  • TransactionBatch stage:
      • Transaction1
        • Prepare scrips
          • Prepare BScrip11
          • ...
          • Prepare BScripB1
        • Commit scrips
          • Commit BScrip11
          • ...
          • Commit BScripB1
      • Transaction2
        • ...
      • TransactionT
        • ...

Caveats

  • Before 3.5.8, triggered scrips were prepared without guaranteed order. Now, scrips are both prepared and executed in alphanumerical order by their descriptions.
  • I don't know whether transactions save same order in batch stage as in create stage or not. If you know then write it here.