Skip to main content

Warden batch framework

This page describes how Warden's periodic and batch processes are built, run and monitored, and lists every one of them. Each process has its own page; this one holds what they share.

Every Warden batch at a glance​

Twenty-five RunBaseBatch classes ship in MGCWarden. Each has an action menu item on System administration → Setup, labeled as below. Nothing in the product schedules any of them.

Order Guard and governance batches​

ProcessClassMenu item labelFeature toggle; stands down when off?Company scopeRun recordSetup-gap rules on its schedulePage
Delta route drainMGCWardenDeltaRouteDrainBatchWarden delta route drainNone; runs regardlessPer legal entityNoneDeltaDrainOwed, DeltaDrainNotScheduled, DeltaDrainStaleRoute drains
Firming route drainMGCWardenFirmingRouteDrainBatchWarden firming route drainNone; runs regardlessPer legal entityNoneFirmingDrainOwed, FirmingDrainNotScheduled, FirmingDrainStaleRoute drains
Trade agreement route drainMGCWardenTARouteDrainBatchWarden trade agreement route drainTrade Agreement Governance; yesPer legal entityNoneTaDrainOwed, TaDrainNotScheduled, TaDrainStaleRoute drains
Journal route drainMGCWardenJournalRouteDrainBatchWarden journal route drainJournal Governance; yesPer legal entityNoneJournalDrainOwed, JournalDrainNotScheduled, JournalDrainStaleRoute drains
Sales governance policy sweepMGCWardenSalesGovSweepSales governance policy sweepSales Governance; yes (Skipped run)Per legal entityMGCWardenSalesGovSweepRun, MGCWardenSalesGovSweepLineNoneSales governance policy sweep
Trade agreement approval sweepMGCWardenTAGovSweepTrade agreement approval sweepTrade Agreement Governance; yes (Skipped run)Per legal entityMGCWardenTAGovSweepRun, MGCWardenTAGovSweepLineNoneTrade agreement approval sweep
Duplicate requisition sweepMGCWardenDuplicateSweepBatchWarden duplicate requisition sweepSales Governance; yes (Skipped run)Per legal entity, or every company when a policy asks for cross-company detectionMGCWardenDuplicateSweepRunNoneDuplicate requisition sweep
Break-glass grant expiryMGCWardenBreakGlassExpiryBatchWarden break-glass grant expiryNone; runs regardlessRole assignments are system-wide; the grant duration is read from the running company's parametersNoneBreakGlassExpiryNotScheduled; BreakGlassGrantNotTimeBoxed watches the durationBreak-glass grant expiry
Count consolidationMGCWardenCountConsolidationRunCount consolidation runCount Governance; yesPer legal entityNone (queue rows show the outcome)NoneCount consolidation run
Aged-MISSING monitorMGCWardenMissingQueueMonitorAged-MISSING monitorCount Governance; yesPer legal entityNoneNoneAged-MISSING monitor
Count case retentionMGCWardenCountRetentionCount case retention cleanupNone; runs regardlessPer legal entityNoneNoneCount case retention cleanup
Retention cleanupMGCWardenRetentionCleanupWarden retention cleanupNone; runs regardlessPer legal entity, plus three shared tables cleaned by any company's runNoneNoneWarden retention cleanup
Setup-gap snapshotMGCWardenSetupGapSnapshotBatchWarden setup-gap snapshotNonePer legal entityNone (the snapshot rows carry their detection time)NoneWarden setup-gap snapshot

The journal reversal router (MGCWardenJournalReversalRouter) is not a batch. It runs when the standard inventory journal Copy process runs; see Journal reversal router. How Warden changes standard periodic processes such as journal posting, trade agreement posting and planned order firming is in Standard batch and periodic processes with Warden installed.

Auditor batches​

These are documented on their own pages.

ProcessClassMenu item labelOverlap guardSetup-gap rules on its schedulePage
Guard event ingestionMGCWardenAuditGuardIngestionGuard event ingestionNo (locks each row)GuardIngestionNotScheduledGuard event ingestion
Audit queue writerMGCWardenAuditWriterAudit queue writerYes, any companyAuditWriterNotScheduledAudit queue writer
Role event captureMGCWardenAuditRoleCaptureRole event captureYes, own companyRoleCaptureNotScheduledRole event capture
Role event retentionMGCWardenAuditRoleEventRetentionRole event retentionNoRoleRetentionNotScheduledRole event retention
Audit chain integrityMGCWardenAuditIntegrityBatchAudit chain integrityYes, any companyAnchorFeedNoDestination, AnchorFeedNeverPublished, AnchorFeedStale watch the feed it publishesAudit chain integrity: anchoring, publication and verification
Audit health monitorMGCWardenAuditHealthBatchAudit health monitorNo (locks each rule)AuditHealthNotScheduledAudit sensor health monitor
Evidence pack builderMGCWardenAuditPackBuilderEvidence pack builderNoPackNoCompletedRun (a legal entity in the audit store with no completed pack) and PackScopeUnmapped; neither checks a scheduleEvidence pack builder
Purge proposalsMGCWardenAuditPurgeProposalGeneratorPropose audit store purgeYes, any companyNoneAudit purge proposals
Purge executionMGCWardenAuditPurgeExecutionBatchExecute approved audit purgesNoPurgeExecutionNotScheduledAudit purge execution
HR deprovisioning scanMGCWardenAuditDeprovisioningHR deprovisioning scanYes, own companyDeprovisioningScanNotScheduledHR deprovisioning scan and leaver intake
Deprovisioning overdue monitorMGCWardenDeprovisioningOverdueMonitorDeprovisioning overdue monitorNoDeprovisioningOverdueNotScheduled, DeprovisioningOverdueNoRecipientsDeprovisioning overdue monitor
Erasure executionMGCWardenErasureExecutionBatchExecute due erasuresNoErasureExecutionNotScheduledErasure execution

Two more action menu items on the same menu run once and are not batches: Initialize Warden (MGCWardenInitialize) and Refresh shipped sensitivity catalog (MGCWardenAuditCatalogSeed).

How a Warden batch is built​

Every batch above follows the same shape.

  • A RunBaseBatch class with main() as new, prompt(), runOperation(). The menu item opens the class's dialog. The dialog has the platform's standard background-processing options, which is where you set the batch group and the recurrence. No Warden class overrides canGoBatch.
  • Dialog fields are packed. What the dialog collects is carried by pack() and unpack(), because the batch framework stores a scheduled task's parameters by packing them and unpacks them to run it. Of the Order Guard batches, only the three sweeps have dialog fields; the other ten take no input and pack conNull().
  • canRunInNewSession() returns true on every Order Guard batch, so Run now from the menu runs through the platform's operation sandbox and shows a progress form. MGCWardenAuditPackBuilder is the one batch that answers false (MGCWardenBatchService summary).
  • No batch implements BatchRetryable. A failed run is recovered by the next recurrence or by running it again, not by a platform retry.
  • No Warden code creates a batch job or a recurrence, and Warden defines no batch group. Every schedule is an administrator's decision.

The fail-open doctrine and what batch history shows​

Most Warden batches follow the product's blocking doctrine: run() does not let an exception out. A failure is caught and recorded as an execution exception, and the run ends. The consequence for operators:

A Warden batch task that failed usually still ends normally in batch job history. The evidence of the failure is on Execution exceptions (System administration → Setup → Execution exceptions), and often in the task's infolog.

The exceptions to this are stated on each page. For example, MGCWardenBatchService records that MGCWardenRetentionCleanup and MGCWardenCountRetention have no fail-open catch, so an error escapes run() and the batch task fails in the usual way.

Batches that process many documents isolate each document in its own failure region, so one bad document does not stop the rest. A batch task starts outside any transaction, so these catch blocks run. Inside a transaction, a catch naming UpdateConflict or DuplicateKeyException runs and every other catch does not; that is why Warden's in-transaction seams hand work to batches instead of doing it themselves.

Execution exceptions: one row per cause​

Unattended batches that meet the same fault on many documents file one row per cause and count the repeats (MGCWardenExecutionExceptionManager::createDeduped). The row's occurrence count is the number of failed attempts, not the number of documents affected.

The route drains also apply a give-up rule: a cause met at least 10 times over at least 15 minutes is treated as exhausted, and the drains stop attempting it (causeIsExhausted). Resolving or dismissing the row re-arms them. See Route drains.

Running a batch​

There are three ways to run one:

WayRuns asNotes
Scheduled batch job (recurrence set in the dialog)The account the batch job runs asThe normal production path.
Run now from the menu itemThe person who pressed itInteractive; the progress form can be canceled.
MGCWardenBatchService over the APIThe API callerSee The batch API.

Whoever runs it is stamped wherever the batch records a user: run records, the event log and, for the route drains, the originator of every workflow they activate. Pick the batch job's account with that in mind.

Company scope​

A batch task runs in the company its batch job was created in (curExt()). The platform's Batch and BatchJob tables are shared across companies, but Warden's working tables are per company, so:

  • Per legal entity batches read only the company they run in. Schedule one job in each legal entity that uses the area. The four route drains are of this kind, and Warden setup gaps asks about their schedule in the current company only.
  • Cross-company batches read shared tables, so one job serves every company. The audit queue, the audit store's anchor chain and the purge proposals are shared tables.

The scope of each batch is in the tables above and on its page.

Choosing a recurrence​

Only one Warden batch has a stated recurrence: the delta route drain, every 5 minutes, a service-level promise (Getting started). For every other batch you choose. Each page says what the choice trades.

Feature toggles and standing down​

Warden's feature toggles are entry-point switches, not stop buttons (Getting started). A batch follows one rule: it raises an owed approval while its feature is off if and only if the document is still blocked while the feature is off.

  • The delta and firming route drains test no toggle, because the purchase gates refuse a held order whatever the Warden Order Guard toggle says.
  • The trade agreement and journal route drains stand down when their toggle is off, because their enforcement seams test the same toggle and nothing refuses the document.
  • Batches with a run record close a stood-down run as Skipped. Others write an infolog line.

Run records​

Three Order Guard sweeps and the purge proposal generator write a run record per run. They share the status enum MGCWardenSweepRunStatus:

ValueLabelMeaning
RunningRunningThe run has started and not closed. A row left here means the run died.
CompletedCompleted (full scope examined)Every document in scope was examined.
PartialPartial (document cap reached)The run stopped at its cap.
FailedFailedThe run hit its own failure handler.
SkippedSkipped (feature off or run refused; nothing examined)The feature was off, a prerequisite was missing, or the overlap guard refused the run.
Run tableWritten byScreen
MGCWardenSalesGovSweepRun (with MGCWardenSalesGovSweepLine)MGCWardenSalesGovSweepSales governance sweep runs
MGCWardenTAGovSweepRun (with MGCWardenTAGovSweepLine)MGCWardenTAGovSweepTrade agreement approval sweep runs
MGCWardenDuplicateSweepRunMGCWardenDuplicateSweepBatchDuplicate requisition sweep runs
MGCWardenAuditPurgeProposalRunMGCWardenAuditPurgeProposalGeneratorAudit purge proposal runs

Each run row carries a RunId, start and end times, the status, the filter and cap the run was given, its counters, a ParameterSnapshot and an OutputSummary. The three sweep tables are per company; MGCWardenAuditPurgeProposalRun is shared (SaveDataPerCompany = No).

Per-document outcomes on the sales governance sweep use MGCWardenSweepOutcome: Re-evaluated: breached and routed, Re-evaluated: compliant under current policy, Skipped: already held, Skipped: no longer an open document, Not evaluated: evaluation failed, Re-evaluated: breached a Warn policy, recorded and not held. The trade agreement sweep's lines use their own enum, MGCWardenTASweepOutcome.

The other batches write no run record. Their evidence is the infolog line in the batch task's log, the rows they write, and any execution exception.

The overlap guard​

MGCWardenBatchOverlapGuard refuses to start a run while another batch task of the same class is executing (status Executing or Canceling in the platform Batch table). It protects exactly the six classes for which reason() returns text, because each has no claim or lock of its own and two overlapping runs would duplicate evidence:

ClassWhat an overlap would duplicateScope of the check
MGCWardenAuditWriterA capture stored twiceAny company
MGCWardenAuditRoleCaptureRole events, store rows and sensitive-role alertsOwn company
MGCWardenAuditIntegrityBatchAn anchoring failure and double attestationAny company
MGCWardenAuditPurgeProposalGeneratorTwo undecided proposals for one partitionAny company
MGCWardenDuplicateSweepBatchOne duplicate pair filed as two audit casesOwn company, or any company when a policy asks for cross-company detection (MGCWardenDuplicateDetector::detectionIsCrossCompany) in either company
MGCWardenAuditDeprovisioningOne user proposed twiceOwn company

How it decides:

  • A scheduled task excludes itself (ownTask), otherwise it would find its own Executing row and refuse for ever.
  • Of two tasks claimed at the same time, the one claimed earlier proceeds; in the same second, the lower RecId proceeds (yieldsTo). Two jobs that share a recurrence therefore do not refuse each other every time.
  • Run now and API runs are not batch tasks. They yield to any running task, and a scheduled task cannot see them.
  • A task left at Executing by a server that died blocks every other run of the class until the platform's dead-task cleanup resets it.

What a refusal leaves:

  • A warning in the batch log that names the running task (caption, batch job, task, company, start time, account) and quotes the reason.
  • For the two classes with a run record, a run closed as Skipped with the refusal as its summary.
  • For the four without one, one open execution exception per class and company (Warning, cause key BATCHOVERLAP:<class>), whose occurrence count rises with each further refusal (createOncePerOpenCause).

The remedy the refusal names: space the schedules out, or chain the tasks as dependent tasks of one batch job. That section also lists the steps the X++ suite now automates: MGCWardenBatchOverlapRuntimeTest schedules real one-off audit writer jobs on the batch server. These tests have not yet run on the UDE.

Batches that protect themselves instead​

The other batches carry no overlap guard because concurrent runs cannot duplicate their work (MGCWardenBatchService summary):

  • the four route drains claim each document before routing it;
  • audit ingestion re-reads each event-log row under a pessimistic lock;
  • the trade agreement sweep supersedes through a conditional update in one transaction;
  • the sales governance sweep goes through the same evaluation engine as interactive edits, whose hold placement resolves the race;
  • the health monitor decides each alert inside a transaction on the locked rule row;
  • the pack builder shares no mutable state between runs;
  • the purges, the missing-queue monitor, break-glass expiry, count consolidation and the setup-gap refresh each write inside one transaction whose locks make a concurrent loser roll back. The loser may then read as failed.

Setup gaps that watch schedules​

Warden setup gaps (System administration → Setup → Warden setup gaps) lists batch jobs Warden depends on that are not scheduled or have stopped. The page treats a batch as scheduled when the platform Batch table has a task of that class whose job is Waiting, Ready or Executing and carries recurrence data; a one-off run does not count.

BatchRulesCompany
Delta, firming, trade agreement and journal route drains*DrainOwed (no recurrence and records owed; names the count), *DrainNotScheduled (no recurrence; only when the area is in use), *DrainStale (recurrence, but a record owed 4 hours or more)A task in this company only
Purge executionPurgeExecutionNotScheduledSee Audit purge execution
HR deprovisioning scanDeprovisioningScanNotScheduledSee HR deprovisioning scan and leaver intake
Deprovisioning overdue monitorDeprovisioningOverdueNotScheduled, DeprovisioningOverdueNoRecipientsSee Deprovisioning overdue monitor
Audit queue writerAuditWriterNotScheduled: Warden Auditor is on with an Active register entry, or captured reads wait in the queueA task in any company
Guard event ingestionGuardIngestionNotScheduled: a governance event-log row here is not yet forwardedA task in this company only
Role event captureRoleCaptureNotScheduled: Warden Evidence & Compliance is onA task in this company only
Role event retentionRoleRetentionNotScheduled: Warden Evidence & Compliance is on, or role events are kept hereA task in this company only
Audit health monitorAuditHealthNotScheduled: an audit health rule is enabledA task in any company
Erasure executionErasureExecutionNotScheduled: an erasure request is Approved or DeferredA task in any company
Break-glass grant expiryBreakGlassExpiryNotScheduled: a security role carries the break-glass release privilege, even with nobody assignedA task in any company

The last seven rows are raised by MGCWardenUnscheduledBatchSetupGaps. Each row appears only while its area is in use, and the company column follows what the batch sweeps: a batch over shared tables is covered by one recurrence in any company.

The drain rules are explained in Route drains. No setup-gap rule watches the schedule of any other batch: the sweeps, count consolidation, the aged-MISSING monitor, count case retention, retention cleanup, the setup-gap snapshot, audit chain integrity, the evidence pack builder and the purge proposal generator. Some rules watch their prerequisites instead, for example the break-glass grant duration (BreakGlassGrantNotTimeBoxed) and the count consolidation journal (CountNoConsolidationJournal, CountConsolidationJournalUnusable); each page names them.

The Stranded hold rule (StrandedHold) watches the whole recovery layer: it lists a held document that has had nothing routing it for 4 hours, whatever the reason.

The batch API: MGCWardenBatchService​

MGCWardenBatchService is a custom service in the MGCWardenServices service group (AutoDeploy = Yes), shipped in the product package. It has 27 operations, one per action menu item on the Setup menu that starts a process: runInitialize, runAuditCatalogSeed and one run… operation for each of the 25 batches. Its purpose, stated in the class summary, is backend test automation: run a batch now, synchronously, so a test can act, run the drain or sweep, and assert.

What it does and does not do:

  • It starts batches; it does not schedule or inspect them. No operation creates a batch job, sets a recurrence or reads batch history.
  • Same permission as the menu item. Each operation first refuses inside a transaction, then checks that the caller could run the menu item (MGCWardenApiDispatch::canRun) and returns Denied if not. The service operations are granted in the same privileges as their menu items.
  • Same code path as a scheduled task. For the 25 batches it builds the class, sets the dialog parameters through the class's own parmScope(), round-trips them through pack() and unpack(), calls validate(), asks the overlap guard, then calls run() in the caller's session. runInitialize and runAuditCatalogSeed run their menu items directly.
  • Stricter overlap check. For the six guarded classes it refuses when a task of the class is executing in any company, whatever the class's own scope.
  • Parameters. Only the three Order Guard sweeps and two Auditor batches take any: runDuplicateSweep(customerAccount, maxIndexRows, resumeFromLastRun), runSalesGovSweep(customerAccount, maxDocuments, includeUnstamped), runTAGovSweep(journalFilter, maxJournals, includeUnstamped), and the pack builder and purge proposal operations (see their pages).
  • Session company. Every operation runs in the session's company; none takes a company parameter.
  • Result. MGCWardenApiResult with status Denied, Refused (invalid parameter, the batch's own refusal such as a feature that is off, or the overlap guard), Failed (an exception escaped, the batch's own failure handler fired, or its parameters did not survive pack()/unpack()) or Completed. Completed does not mean anything was done: a drain with nothing to drain completes. The result carries the run record key where one exists, the batch's infolog summary and the number of execution exceptions the call raised.
  • Long runs. The calls are synchronous. Several batches grow with the estate, so a call can outlast an HTTP client's timeout; the run continues on the server.

Two points from the class summary are out of date: it says 26 operations and 23 RunBaseBatch classes. The service has 27 operations, 25 of them batches, since runErasureExecute was added.

Security​

Each batch is secured by its action menu item. For the Order Guard batches:

Menu itemsPrivilegeDutyRole
The four route drains, break-glass expiry, retention cleanup, setup-gap snapshot, count consolidation, count retention, aged-MISSING monitorMGCWardenPolicyAuthorPrivMGCWardenPolicyAuthoringDutyWarden guard administrator
Sales governance policy sweepMGCWardenSalesGovSweepPrivMGCWardenPolicyActivationDutyWarden controls owner
Trade agreement approval sweepMGCWardenTAGovSweepPrivMGCWardenPolicyActivationDutyWarden controls owner
Warden duplicate requisition sweepMGCWardenDuplicateSweepPrivMGCWardenPolicyActivationDutyWarden controls owner

The three sweeps sit on the activation duty, not the authoring duty, because a sweep re-governs live documents across the estate (the privilege descriptions say so). Scheduling a batch job starts from the menu item's dialog, so the person who schedules it needs the menu item. The full role design is in Security model.