Creating started tasks for ML for IBM z/OS scoring services

After you have successfully installed and configured ML for IBM z/OS®, consider running the scoring services as z/OS started tasks.

Before you begin

About this task

You can quickly create started tasks to manage the WLP and Gunicorn Python scoring server processes by customizing the ALNSCSV and ALNSCPY sample JCL jobs.

Note:

You can globally replace:

  • <core_install_dir> with the MLz Core installation directory. The default value is /usr/lpp/IBM/aln/v3r2/core.
  • <ent_install_dir> with the MLz Enterprise installation directory. The default value is /usr/lpp/IBM/aln/v3r2/ent.
  • <java_install_dir> with the IBM Java 17 or Java 21 installation directory.
  • <aie_install_dir> with the IBM Z Deep Neural Network Library (zDNN) installation directory.
    • The default directory for z/OS V2.5 is: /usr/lpp/IBM/aie
    • The default directory for z/OS V3.1 or higher is: /usr/lpp/aie

Procedure

  1. Locate the following files in the $IML_INSTALL_DIR/alnsamp/started-task-samples directory on the z/OS system where your MLz runs:
    • ALNSCSV (sample JCL job)
    • ALNSCPY (sample JCL job)
    • SCSVPARM-STDPARM.template (sample MVS™ data set content)
    • SCPYSTRT-STDPARM.template (sample MVS data set content)
    • SCPYSTOP-STDPARM.template (sample MVS data set content)
    • stdenvs-STDENV.template (sample z/OS Unix text file content)
  2. Copy ALNSCSV and ALNSCPY into a data set in your PROCLIB concatenation, such as SYS1.PROCLIB, and customize them based on your system environment.

    Make sure that you set IMLHOME to the $IML_HOME directory and INSTDIR to the $IML_INSTALL_DIR directory where your MLz is installed.

  3. Define a new MVS data set to be used by ddname STDPARM.
    1. Create member SCSVPARM for ALNSCSV by copying the following lines from SCSVPARM-STDPARM.template:
      PGM <core_install_dir>/iml-zostools/bin/bash
      <core_install_dir>/bin/server.sh config <scoring-name>
       

      where <scoring-name> is the name of the scoring server of your MLz.

    2. Create member SCPYSTRT for ALNSCPY by copying the following lines from SCPYSTRT-STDPARM.template:
      PGM <core_install_dir>/iml-zostools/bin/bash
      <core_install_dir>/bin/server.sh start-python <scoring-name>

      where <scoring-name> is the name of your Gunicorn Python server.

    3. Create member SCPYSTOP for ALNSCPY by copying the following lines from SCPYSTOP-STDPARM.template:
      PGM <core_install_dir>/iml-zostools/bin/bash
      <core_install_dir>/bin/server.sh stop-python <scoring-name>

      where <scoring-name> is the name of your Gunicorn Python server.

  4. Create a new z/OS Unix text file stdenvs that ddname STDENV uses.
    1. Copy the following lines from stdenvs-STDENV.template:
      
      IML_INSTALL_DIR=<core_install_dir>
      IML_INSTALL_ENT_DIR=<ent_install_dir>
      IML_HOME=/my/iml-home
      IML_JOBNAME_PREFIX=ALN
      SPARK_HOME=<core_install_dir>/spark
      JAVA_HOME=<java_install_dir>
      WLP_INSTALL_DIR=/usr/lpp/liberty_zos/current
      AIE_INSTALL_DIR=<aie_install_dir>
      PATH=<core_install_dir>/iml-zostools/bin:/bin:<java_install_dir>/bin:<core_install_dir>/spark/bin:<core_install_dir>/spark/sbin:<core_install_dir>/nodejs/bin:<ent_install_dir>/pyz/pyz-313/bin
      LIBPATH=/lib:/usr/lib:/usr/lib/java_runtime:<core_install_dir>/iml-services/utils:<core_install_dir>/spark/lib:<java_install_dir>/bin/classic:<java_install_dir>/bin/j9vm:<ent_install_dir>/pyz/pyz-313/lib:<aie_install_dir>/zdnn/lib
      _BPXK_AUTOCVT=ON
      _BPX_BATCH_UMASK=0022
      IBM_JAVA_OPTIONS=-Dfile.encoding=UTF-8 -Dibm.racfkeystore.trustchaincheck=false
      _TAG_REDIR_ERR=txt
      _TAG_REDIR_IN=txt
      _TAG_REDIR_OUT=txt
      _BPX_SHAREAS=NO
      _CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)
       
    2. Set all environment variables on basis of the z/OS system environment and the MLz installation. For more information, see Configuring user ID for setting up Machine Learning for IBM z/OS Enterprise Edition.
    Note:

    You can use the STDENV file for all the MLz started tasks.

  5. Define a RACF® profile for the new ALNSCSV and ALNSCPY started tasks and assign <mlz_setup_userid> as the owner by issuing the following commands:
    RDEFINE STARTED ALNSCSV.* STDATA(USER(<mlz_setup_userid>) GROUP(<mlz_group>))
    RDEFINE STARTED ALNSCPY.* STDATA(USER(<mlz_setup_userid>) GROUP(<mlz_group>))
    SETROPTS RACLIST(STARTED) REFRESH
  6. Run started task ALNSCSV to start the scoring WLP server as shown in the following example:
    /S ALNSCSV,PARMS=’<server_name>’

    where server_name is the name of your MLz WLP scoring server.

    If necessary, you can run the ALNSCSV started task to stop the WLP server by issuing the following command:

    /P ALNSCSV

    The value for the PARMS parameter is case-sensitive. Make sure that you issue the command in your SDSF system command extension to retain the lower case of your input.

  7. Run started task ALNSCPY to start the Gunicorn Python scoring server as shown in the following example:
    /S ALNSCPY

    If necessary, you can run the ALNSCPY started task to stop the Gunicorn Python server by issuing the following command:

    /S ALNSCPY,OPTION='SCPYSTOP'

    The OPTION value is case-sensitive. Make sure that you issue the command in your SDSF system command extension to retain the lower case of your input.

Monitoring service startup and shutdown with WTO messages

To provide additional information about service statuses, write to operator (WTO) messages are written to the operator console during normal operation.

To enable this feature, the user ID from which the service processes are initialized must have READ access to the BPX.CONSOLE general resource profile in the FACILITY class. This access is required for the messages to be considered authorized when issued.

A message indicating the start-up result of the scoring service server will be issued to the SYSLOG.
  • If the scoring service starts successfully, an informational message with ID ALNB401 will be issued.
  • If the scoring service fails to start, an error message with ID ALNB403 will be issued.
A message indicating the shutdown result of the scoring service server will be issued to the SYSLOG.
  • When the scoring service is shut down, an informational message with ID ALNB402 will be issued.
Note: If the invoker does not have appropriate privileges, a message ID (BPXM023I) and login name of the invoker are prefixed to the specified message text. An invoker is deemed to have appropriate privileges for this service if the BPX.CONSOLE resource in the FACILITY class is defined and the invoker is permitted to that resource, or if the invoker is running with an effective UID of 0.

For more information on authorization, see https://www.ibm.com/docs/en/zos/3.1.0?topic=services-authorization.

For more details on the informational message, see https://www.ibm.com/docs/en/zos/3.1.0?topic=messages-bpxm023i.