Redwood Documentation

Product Documentation

 

›Processes and Chains

RunMyJobsProcess and Chain Definitions

Process Definitions

  • Creating Process Definitions
  • Setting Chain Definition and Chain Definition Properties
  • Integrating Redwood Server with Web Services
  • Redwood Definition Types
  • Maintenance Process Definitions
  • Template Process Definitions
  • Top Level Process Definition
  • Submit Form Editor
  • Default System Process Definitions

Processes and Chains

  • Advanced Chain Diagram Quick Reference
  • Chain Diagram Quick Reference
  • Chain Runtime Viewer Quick Reference
  • Advanced Chain Definition Editor Quick Reference
  • Advanced Chain Runtime Viewer Quick Reference
  • Advanced Diagram Quick Reference
  • Parameter Validation using Constraints
  • Processes Waiting on Events
  • Setting the Scheduling Behavior on the Control Tab
  • Setting the Retention Period for Processes
  • Runtime Limits
  • Setting Process Definition Options
  • Defining Parameters
  • Constraint Definitions
  • Constraint Class
  • Raising Events
  • Processes with Locks
  • Reaction Processes
  • Restart Behavior on the Process Status Tab
  • Searching Files
  • Setting the Name and Editing the Process Definition Source
  • Customizing Processes with Specific Actions
  • Using Table Parameters
  • Automatically Deleting Old Processes and Chains
  • Editing Process Definitions Safely
  • Parameter Formats

Chain Definitions

  • Using Chain Definitions
  • Creating Chain Definitions
  • Steps
  • Chain Processes
  • Creating Chain Definitions with Sequential Processes
  • Creating Chain Definitions with Parameter Handling
  • Creating Chain Definitions with Parallel Chain Processes
  • Creating Chain Definitions with Chain Processes Dependencies
  • Creating Chain Definitions for Multiple SAP Systems
  • Precondition Functions

Restart Behavior

  • Controlling Global and Partition Restart Behavior
← Setting the Name and Editing the Process Definition SourceUsing Table Parameters →

Customizing Processes with Specific Actions

Actions allow you to interact with objects while these are doing something, the most common one being setting the final process status. With Actions you can change the status to Completed even if the process reached status Error. You may define a set of conditions that must be met for this change to take place. If you want to interact with processes from many processes, it might be easier to use a trigger. See the Using Triggers and Using Actions sections of the documentation.

note

Actions require RedwoodScript which in turn requires an Module.Scripting license key.

There are three different types of actions that fire at three different times in the life-cycle of a process. The following three actions are available:

  • On Change - When the status of a process changes but has not reached Queued (but does not fire when the status changes to Chained )
  • Pre Running - Before a process has started running
  • Post Running - After a process has completed

Post Running is the only action that allows changing the final status of a process, it is therefore the most used action. The other actions allow you to change the queue, start time or even hold the process if a set of defined conditions are met.

You need to understand the concepts of process states to get a clear understanding of when triggers and actions fire, see the Process States section for more information on the subject.

All actions have a log file, which will be attached to the process if it is not empty. When an error occurs in an action, the process will go to status Error, this can be changed in status handlers.

Since actions are dependent on the process state, you must be familiar with the various process states, see the Process States section for more information.

note

You are not allowed to persist in any of these actions, that is done for you at the end.

The following three Actions are available:

On change

  • Any change before Queued and Dispatched
    • Does not fire on Chained status
  • Can change scheduled start time, queue, or hold the process.

Pre running

  • During Queued, Dispatched, EventWait and LockWait
  • Can change scheduled start time, queue, or hold the process.

Post running

  • Any transition from Running into a final state:
    • Error, Completed, Killed, Unknown, Canceled
  • Can change the final state.

All actions have access to the process changing status, the old and new statuses as well as a jcsSession. The changes that are allowed in the actions are action dependent. You cannot change the scheduled start time in a post-running action, for example, because the process has finished running.

The source of the actions is written in RedwoodScript which allows interacting with the repository. The above uses are only the most common - it is perfectly possible to submit another process in any of the actions or even cancel the process in question if it has not reached status Running.

Contexts

The following predefined objects are available in process actions. These are defined in the Source Stub. You can reload the source tab from the context-menu to display them.

Before Process On Change

ObjectClassExample Code
jcsOutLogcom.redwood.scheduler.infrastructure.logging.api.LoggerjcsOutLog.warning("This is a warning!");
jcsOnChangeContextcom.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObjectjcsOnChangeContext.setFailJobOnError(false);
jcsSessioncom.redwood.scheduler.api.model.SchedulerSessionjcsSession.getUserName()
jcsJobcom.redwood.scheduler.api.model.JobjcsJob.hold();
jcsOutjava.io.PrintWriterjcsOut.println("This text will be printed to a specific output file on the process.");

Before Process Pre Running

ObjectClassExample Code
jcsOutLogcom.redwood.scheduler.infrastructure.logging.api.LoggerjcsOutLog.info("This is an informational message!")
jcsSessioncom.redwood.scheduler.api.model.SchedulerSessionjcsSession.getQueueByName("UNIX_Generic");
jcsJobcom.redwood.scheduler.api.model.JobjcsJob.hold();
jcsPreRunningContextcom.redwood.scheduler.api.scripting.variables.PreExecutingActionScriptObject

jcsOutjava.io.PrintWriterjcsOut.println("This text will be printed to a specific output file on the process.");

Before Process Post Running

ObjectClassExample Code
jcsOutLogcom.redwood.scheduler.infrastructure.logging.api.LoggerjcsOutLog.debug("This is a debug message!")
jcsPostRunningContextcom.redwood.scheduler.api.scripting.variables.PostRunningActionScriptObject

jcsSessioncom.redwood.scheduler.api.model.SchedulerSession

jcsJobcom.redwood.scheduler.api.model.JobjcsJob.restart();
jcsOutjava.io.PrintWriterjcsOut.println("This text will be printed to a specific output file on the process.");

Values

TabFieldDescriptionDefault Value
ActionsTypeThe type of action to create.

ActionsEnabledEnable/disable action

ActionsAction Subject

ActionsSourceSource code of the actions in RedwoodScript

Logging Verbosity

You can set verbosity levels in the submit wizard for the stdout.log and stderr.log files.

Example

A multi-step chain definition has a process in a step that may fail, but the rest of the chain must finish to clean up. The status of the chain should be Completed if all steps reach Completed and Error when a specific step went into error. The status handler on the step for status Error is Continue. The following action is used to check if the step reached status Error, and if so, throws a RuntimeException to force the chain into status Error.

{
  //Check if the first step failed, if it did,
  //throw an exception to put the Jobchain process into Error

  String stepName = "Run SystemBackup";
  String statusName = "Error";

  // Get an iterator over the child processes of the chain process
  for (Job job : jcsJob.getChildJobs())
  {
    String sName = (String) job.getDescription();
    String sStatus = (String) job.getStatus().name();

    if (stepName.equals(sName) && statusName.equals(sStatus))
    {
      throw new RuntimeException();
    }
  }
}

See Also

  • Redwood Script
  • Trigger Examples
  • Triggers
← Setting the Name and Editing the Process Definition SourceUsing Table Parameters →
  • On change
  • Pre running
  • Post running
  • Contexts
  • Before Process On Change
  • Before Process Pre Running
  • Before Process Post Running
  • Values
  • Logging Verbosity
  • Example
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |