MMG Scheduler Shell Utility (mmg_scheduler.sh)

The mmg_scheduler.sh utility provides a command-line interface to trigger and monitor OFS MMG batches or batch group executions. Use this utility to perform the following tasks
  • Trigger an immediate batch or batch group execution by name.
  • Include, exclude, or hold certain selected tasks within the execution.
  • Optionally, specify custom batch parameters.
  • Query the execution status of any batch or batch group by using its run ID.
  • Monitor the progress batch automatically or check its status as needed.
The following is the typical work flow of the utility:
  1. Trigger a batch or group job. This will return the batch run ID.
  2. Auto-follow or manually follow and monitor the batch or batch group status. This will return the task or batch progress and results in real time.
  3. Optionally, you can re-query the job status any time by using the batch run ID.

Errors are reported for invalid credentials, unreachable APIs or servers, or invalid batches or run IDs. For failed tasks, status and errors can be found in the command output.

The following is the general format for triggering a batch or a group of batches:
  • Batch

    ./mmg_scheduler.sh -m trigger -b <BATCH_NAME> -u <USER> -w <WORKSPACE> -c <CLIENT_ID> -s <CLIENT_SECRET> -B <BASE_URL>

  • Group of Batches

    ./mmg_scheduler.sh -m trigger -b <BATCH_GROUP_NAME> -u <USER> -w <WORKSPACE> -c <CLIENT_ID> -s <CLIENT_SECRET> -B <BASE_URL> -t group

The following is an example of triggering a batch and automatically following its progress:

./mmg_scheduler.sh -m trigger -b Batch_Model1 -u mmgadmin -w CS -c ofsauser -s secret -B "https://<your-server:mmguiport>/mmg8133/"

The following table provides information on the actions that can be performed by this utility:

Table 12-7 Actions performed by the mmg_scheduler.sh Utility

Action Script
Customize Task Execution Include, Exclude, or Hold specific tasks:
  • -i TaskA,TaskB - Use this to include only specified tasks
  • -e TaskC - Use this to exclude specified tasks
  • -H TaskD -Use this to keep specified tasks on hold
Pass Custom Parameters Use the following script to pass custom parameters:

-v '{"batchParams":

{"param1":"value"}

,"taskRuntimeParams":{"Task1":

{"param":"value"}

Monitor Batch/Group Status Use the following query to monitor or check the status by the run ID:

./mmg_scheduler.sh -m status -r <BATCH_RUN_ID> -u <USER> -w <WORKSPACE> -c <CLIENT_ID> -s <CLIENT_SECRET> -B <BASE_URL>

Filter status by individual tasks Use this to filter the status for individual selected tasks:

-k TaskA,TaskB

Monitoring & Polling Options
  • --follow (default) - This script will poll the execution status automatically after being triggered.
    • Use -T <seconds> to adjust the auto-follow timeout. The default timeout value is 20 seconds.
    • Use -n <seconds> to change the polling interval. The default interval is 10 seconds.
  • --no-follow - Only triggers the batch and does not monitor its status.
   
   
   
   
   

Note:

The script requires valid OFS MMG credentials, workspace, and user identity, as it has been configured in your OFS MMG deployment.

Note:

Note the following limitations of the utility:
  • The default polling automatically times out after 20 seconds unless it has been overridden.
  • Filtering and custom param support for batch groups might be limited.
  • Always use the correct client ID or secret and ensure that the API is connected for operations to succeed.
  • For failures or unexpected results, check the command output for error messages.