Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • $JOB_KEY$ - replaced with the Job ID
  • $JOB_SEQ$ - replaced with the Job Sequence Number
  • $JOB_NAME$ - replaced with the Job Name
  • $WSL_SCRIPT_<host script name in metadata>_CODE$ - Script Sourcing Tokens

RED Parameter tokens are not currently supported:

  • $P<parameter_name>$ - RED Parameter tokens will be supported in a later release, instead please use the parameter read and write functions within your script if required.

Environment Variables

The following RED environment variables are set prior to running the command

  • WSL_META_<variable name> - all the usual metadata environment variables available to scripts
  • WSL_<JOB|TASK>_<KEY|NAME> - Job and Task environment variables
  • WSL_<SEQUENCE|WORKDIR|BINDIR> - Sequence, Work Directory and Bin Directory environment variables
  • WSL_SCH_RESTAPI_<URL|USER|PWD> - The Scheduler REST API URL and credentials

If the Job is executed via Azkaban Scheduler then you will also have the usual Azkaban Environment variables available, the most useful being JOB_NAME

  • JOB_NAME - this equates to the name of the task in the job at the time the Success/Failure command was run, useful to determine the task in the job that has failed.  

Other Credentials

If you need to pass other credentials securely to your scripts or commands such as email server credentials then this can be achieved by utilizing one or more of the Advanced Authentication Parameters on the metadata connection. These fields will be available to the script or command as environment variables:

  • WSL_META_<AUTHTKN_1|AUTHTKN_2|AUTHTKN_3|AUTHCFG>

Success and Failure Command Script Sourcing

RED can reference other scripts form the metadata at run-time, this Script Sourcing feature of RED is also available to be used in the Success and Failure Commands, this allows referencing a Host Script from the RED metadata rather than a script that already exists on the operating system.

In the following example command, you would have a python Host Script in the metadata named 'my_python_notify_script' which performs a notification based on two args, the job status and the email to notify. In the Success command you would pass an arg of 'success' and in the Failure command you can pass an arg of 'failed' so that the script can determine what the status is. The script itself will have access to the appropriate environment variables to construct a suitable email that informs of the failure or success.

Code Block
languageshell
titleScript Sourcing Command Example
python "WSL_SCRIPT_my_python_successnotify_script_CODE" "success" "job-admin@mydomain.com"

When a Success or Failure Command is triggered RED will do the following:

...