executeEntryCommand(...)

Sepasoft MES Module Suite

executeEntryCommand( batchQueueEntry, command, timeoutMS=5000, changedBy="operator", blockingCall=False )

Note Available in: version 3.81.12 RC2, 3.81.11 SP9 and later.

Sends a batch-level command to a batch for a BatchQueueEntry (for example Start, Hold, Reset, Abort)

The runtime resolves the command, enforces gateway and signature rules, then routes to the batch execution controller—

  • either asynchronously on a worker (default) or
  • synchronously when blockingCall is true.

Syntax

system.mes.batch.queue.executeEntryCommand( batchQueueEntry, command, timeoutMS=5000, changedBy="operator", blockingCall=False )

Python
system.mes.batch.queue.executeEntryCommand(batchQueueEntry, command)
system.mes.batch.queue.executeEntryCommand(
	batchQueueEntry,
	command,
	timeoutMS=5000,
	changedBy="operator",
	blockingCall=False
)

Required Parameters

Parameter

Type

Required

Description

batchQueueEntry

BatchQueueEntry

object

Required

This parameter expects a BatchQueueEntry object representing the specific queue entry you want to command. This entry must exist on the gateway's batch queue.

command

str

Required

This parameter expects a string representing the batch command you want to execute: Batch command to run.

Use:

See also:

queue.COMMAND_ABORT()

queue.COMMAND_HOLD()

queue.COMMAND_PAUSE()

queue.COMMAND_RESET()

queue.COMMAND_RESTART()

queue.COMMAND_RESUME()


There is no timeoutMS or blockingCall argument; the call is always the asynchronous contract.

Optional Parameters

timeoutMS

long / int

Optional

See notes

Milliseconds to wait for confirmation when a blocking path waits for Hold / Reset–related shutdown. Product documentation describes 5000 ms as the typical default; 0 disables the timeout check during blocking waits. Most other commands do not use this value.

changedBy

str

Optional

None

Optional label stored with the change (operator, screen, or script id).

blockingCall

bool

Optional

False

If False, the command is submitted on a background executor where applicable. If True, the current thread runs the command path directly (and unlocks the per-batch lock before controller work where the implementation requires it).

Return Value

Type

Description

None

indicates that the function call has completed successfully without throwing any errors or exceptions. State transitions and shutdown-style waits (where applicable) continue after the function returns.


If there are still state transitions waiting to be executed, they may continue to finish asynchronously in the background, provided that the blockingCall parameter is set to False

Scope / Availability

  • Registered on system.mes.batch.queue (Sepasoft Batch / MES).

  • Gateway: Executes on the gateway that owns the queue entry and process cell.

  • Designer / Client: Same API; calls go through the production RPC layer to the appropriate gateway (including Enterprise routing when entries are tied to equipment on a peer server).

Excluded / Edge Cases

  • Start and Abort are entry-level commands. Do not use executeStepCommand for them; that API rejects Start / Abort at step scope with IllegalArgumentException.

  • If E-signatures is enabled and the command has a configured Signature Template, scripting does not bypass signatures; the call raises IllegalAccessException with guidance to use the Batch List or Batch Controller Perspective component for authorized execution.

  • If the entry’s process cell is managed by another gateway server, the call raises IllegalAccessException explaining that the equipment path is not on the current server.

  • The gateway must have a process cell and be allowed to run batch execution; otherwise IllegalStateException (for example no process cell) applies, consistent with other queue command APIs.

  • MES / batch subsystem must be started; license and routing checks apply as for other queue operations.

  • Unknown command strings (not present in the loaded batch state/command configuration) raise NoSuchElementException from name resolution.

  • Wrong batch state for the requested command yields Exception with messages such as Unable to … because it is not in the correct state, not currently active, or (for Reset) unsupported transitions from the current state.

  • executeEntryCommandAsync always runs the non-blocking RPC path with no timeoutMS. executeEntryCommandBlocking always blocks. Prefer those when you want a fixed contract instead of toggling blockingCall.

Examples

Minimal example


Python
entry = system.mes.batch.queue.getEntry("BATCH-2026-0042")
system.mes.batch.queue.executeEntryCommand(entry, 
system.mes.batch.queue.COMMAND_START())


Python
entry = system.mes.batch.queue.getEntry('221205_a')
command = system.mes.batch.queue.COMMAND_START()
system.mes.batch.queue.executeEntryCommandAsync(entry, command, 5000)

Complex example

Python
batch_id = "BATCH-2026-0042"
entry = system.mes.batch.queue.getEntry(batch_id)

# Blocking reset with explicit wait budget (Hold/Reset-style waits)
system.mes.batch.queue.executeEntryCommand(
	entry,
	system.mes.batch.queue.COMMAND_RESET(),
	timeoutMS=15000,
	changedBy="cleanupScript",
	blockingCall=True
)

# Fire-and-forget hold (default non-blocking)
system.mes.batch.queue.executeEntryCommand(
	entry,
	system.mes.batch.queue.COMMAND_HOLD(),
	changedBy="alarmHandler"
)

Related Functions

  • system.mes.batch.queue.executeEntryCommandAsync(batchQueueEntry, command, ...) — Always non-blocking; no timeoutMS parameter on the RPC path.

  • system.mes.batch.queue.executeEntryCommandBlocking(batchQueueEntry, command, ...) — Always waits until the blocking command path completes; supports timeoutMS for Hold / Reset-related waits.

  • system.mes.batch.queue.executeStepCommand(batchQueueEntry, stepPath, command, ...) — Step-scoped commands; not for Start / Abort.

  • system.mes.batch.queue.COMMAND_START() / COMMAND_ABORT() / COMMAND_HOLD() / COMMAND_RESET() / other COMMAND_* — Canonical command tokens for command.

  • system.mes.batch.queue.getEntry(batchID) — Obtains the BatchQueueEntry for these calls.

Sepasoft MES Module Suite