Displaying a Graphical User Interface in Platform LSF with Microsoft Terminal Services

How Platform LSF works with Terminal Services

It is possible to run jobs to display GUI (graphic user interface) on remote hosts in LSF by using Microsoft Terminal Services.

Environment variables

The following environment variables are available for Terminal Services jobs:
LSF_LOGON_DESKTOP

When LSF_LOGON_DESKTOP=1, jobs run in interactive foreground sessions. This allows GUIs to be displayed on the execution host. If this parameter is not defined, jobs run in the background.

LSB_TSJOB

When the LSB_TSJOB variable is defined to any value, it indicates to LSF that the job is a Terminal Services job.

LSF_TS_LOGON_TIME

Specifies the time to create a Windows Terminal Service session. You should configure LSF_TS_LOGON_TIME according to your network environment.

The default, 300000 milliseconds is suitable for most environments. For a congested network. set LSF_TS_LOGON_TIME=1000000

Job submission

  1. Submit the job with tssub instead of bsub. tssub is a wrapper around the bsub command which only submits jobs to hosts that have the msts resource.

  2. tssub sets the LSB_TSJOB and LSF_LOGON_DESKTOP environment variables. These variables are then transferred to the execution host.

    • If the job is dispatched to a host in which Terminal Services is not installed or properly configured, the job is set to the PEND state and a pending reason is written in sbatchd.log.host_name.

    • If tssub -I is specified, a terminal display is visible on the submission host after the job has been started.

    • If the job is not a GUI job, LSF runs a command window and output is displayed in the command window when something is written to stdout.

    • Pre- and post-execution commands are executed within the terminal session. The job does not complete until post-execution commands complete.

  3. View job output with the command tspeek. If the terminal window is closed, the job remains running. You can reconnect to view the job with tspeek.

Limitations

  • A job submitted as a Terminal Services job cannot be modified to become a non-Terminal Services job with bmod.

  • The bsub option -o out_file is not supported for tssub.

  • Compound resource requirements are not supported for Terminal Services jobs.

  • Only Windows bsub options are supported for tssub. For example, you cannot use the options -Ip, -Is, -L login_shell of bsub with tssub.

  • If user mapping is defined, the user who invokes tspeek must have the required privileges to access the session.

  • MultiCluster is not supported.

Requirements

  • All submission hosts must have the Terminal Services Full Client Windows Installer (MSI) package installed. This package contains the required Microsoft Terminal Services Advanced Client ActiveX Control. Download it from the Microsoft web site.

  • All execution server hosts must have the Terminal Services and Terminal Services Full Client Windows Installer (MSI) packages installed.

  • Terminal Services server hosts can be in a different domain from submission hosts as long as the user can be authenticated by both domains.

  • The service account on Terminal Services server hosts must be a member of the local administrators group.

  • Your LSF cluster must be working properly.

  • All submission (client) hosts need the ActiveX control, but you don't necessarily have to use the specified MSI, it can also be there if Remote Desktop Connection software is installed (part of the OS installation).

  • To run applications from a Terminal Services client, the FEATURE lines in your LSF license must contain the TS_OK keyword. FlexNet detects when a node-locked uncounted license is running under Windows Terminal Server. Without TS_OK, a user running on a Terminal Server client is denied a license. See the FlexNet End User Guide for more information.

Register the Microsoft Terminal Services Advanced Client ActiveX Control

You must be a Local Administrator on the host to register the control.

For clients running Windows 2000 or earlier with Remote Desktop Connection, the necessary ActiveX control is installed, but it is not registered by default. The LSF tssub command registers the control automatically.

The problem does not occur with the Terminal Service Full Client installation, or on newer versions of Windows or Windows XP.

  • Submit any job with tssub. If you have administrator privileges, tssub registers the ActiveX control automatically.
  • Register the ActiveX control manually. Type the following Windows command at an MS-DOS prompt:
    C:\regsvr32.exe mstscax.dll

    Once the control is registered on the host, the error does not occur. Non-administrator users can run tssub with no errors.

Configure Terminal Services for Platform LSF

  1. Start the Microsoft Management Console (MMC) Terminal Services Configuration snap-in (Start > Programs > Administrative Tools > Terminal Services Configuration).
  2. Right-click the configuration for which you want to disable the default password setting, and select Properties.
  3. Change the logon information.
    1. Select Logon Settings > Use client provided logon information.

      This ensures you are not using a predefined user to log on to Terminal Services.

    2. Clear the Always prompt for password check box.
    Future connections no longer force a password entry.
  4. Click Apply, then click OK and close the dialog.

Configure Platform LSF to run Terminal Services jobs

  1. Define the msts static resource.
    Edit LSF_CONFDIR\lsf.shared and define the msts static resource. Note that the resource name must be msts and values for the resource must be exactly as shown.
    Begin Resource
    RESOURCENAME TYPE  INTERVAL INCREASING DESCRIPTION
    ...
    msts         Boolean  ()    ()        (Windows Terminal Server)
    ...
    End Resource
  2. Add the msts resource to hosts.
    Edit LSF_CONFDIR\lsf.cluster.cluster_name and add the msts resource to each host on which Terminal Server is installed. For example:
    Begin Host
    HOSTNAME   model   type   server r1m pg tmp RESOURCES
    ...
    hostA      !       NTX86    1     -   -   - (msts)
    ...
    End Host
  3. (Optional) Create job starters to preserve a user’s environment settings.

    You may need to create a job starter script to preserve a user’s environment settings on the execution host.

Submit Platform LSF jobs to Terminal Services hosts (tssub)

Terminal Services Full Client Windows Installer (MSI) package must be installed on submission hosts.

  1. Submit a job to a host with Terminal Services installed by using the tssub command:

    tssub myjob

    The bsub option -o out_file is not supported for tssub.

    Only Windows bsub options are supported for tssub. For example, you cannot use the options -Ip, -Is, -L login_shell of bsub with tssub.

  2. View job output:

    tspeek job_ID

    You can use tspeek from any LSF Windows to view the output of a Terminal Services job:

    You can also use tspeek to monitor job output from a Linux host with rdesktop installed. You cannot use tspeek to monitor job output from UNIX.

  3. Monitor the job:

    bjobs -l

    If you use to monitor the job, you see a message:
    External Message 2 was posted from LSF\lsfadmin to message box 2

    The body of the message contains the ID of the terminal session that was created.

Limit the number of Terminal Services jobs on a host

The msts resource indicates to LSF whether an execution host has Terminal Server installed or not.

To limit the number of Terminal Services jobs that run on a host and keep track of how many jobs are running, define a numeric resource in addition to the msts boolean resource. You can alternatively use an elim to report how many terminal servers are available for each host.

  1. Configure a numeric Terminal Server resource.

    Define the resource in LSF_CONFDIR\lsf.shared. For example:

    Begin Resource
    RESOURCENAME TYPE  INTERVAL INCREASING DESCRIPTION
    ...
    term_server   Numeric 60      N         (Terminal Server)
    ...
    End Resource
  2. Submit a job with rusage.

    When submitting a job, use the rusage resource requirement string:

    tssub -R"rusage[term_server=1]" myjob

Submit a Terminal Services job from UNIX

In mixed cluster environments, it is possible to submit a Terminal Services job with bsub from a UNIX host. You can use tspeek to monitor job output from a Linux host with rdesktop installed. You cannot use tspeek to monitor job output from UNIX.

  1. On the UNIX submission host, define the environment variables LSF_LOGON_DESKTOP=1 and LSB_TSJOB=1.
    • When LSF_LOGON_DESKTOP=1, it allows GUIs to be displayed on the execution host.

    • When the LSB_TSJOB variable is defined to any value, it indicates the job is a Terminal Services job.

  2. Submit the job with bsub and indicate the msts resource requirement. For example:

    bsub -R"msts" myjob