Sun N1 Grid Engine 6.1 User's Guide

ProcedureHow To Submit a Simple Job From the Command Line

Before you run any grid engine system command, you must first set your executable search path and other environment conditions properly.

  1. From the command line, type one of the following commands.

    • If you are using csh or tcsh as your command interpreter, type the following:


      % source sge-root/cell/common/settings.csh

      sge-root specifies the location of the root directory of the grid engine system. This directory was specified at the beginning of the installation procedure.

    • If you are using sh, ksh, or bash as your command interpreter, type the following:


      # . sge-root/cell/common/settings.sh

      Note –

      You can add these commands to your .login, .cshrc, or .profile files, whichever is appropriate. By adding these commands, you guarantee proper settings for all interactive session you start later.


  2. Submit a simple job script to your cluster by typing the following command:


    % qsub simple.sh
    

    The command assumes that simple.sh is the name of the script file, and that the file is located in your current working directory.

    You can find the following job in the file /sge-root/examples/jobs/simple.sh.


    #!/bin/sh
    #
    #
    # (c) 2004 Sun Microsystems, Inc. Use is subject to license terms.
    
    # This is a simple example of a SGE batch script
    
    # request Bourne shell as shell for job
    #$ -S /bin/sh
    
    #
    # print date and time
    date
    # Sleep for 20 seconds
    sleep 20
    # print date and time again
    date

    If the job submits successfully, the qsub command responds with a message similar to the following example:


    your job 1 (“simple.sh”) has been submitted
  3. Type the following command to retrieve status information about your job.


    % qstat

    You should receive a status report that provides information about all jobs currently known to the grid engine system. For each job, the status report lists the following items:

    • Job ID, which is the unique number that is included in the submit confirmation

    • Name of the job script

    • Owner of the job

    • State indicator; for example, r means running

    • Submit or start time

    • Name of the queue in which the job runs

    If qstat produces no output, no jobs are actually known to the system. For example, your job might already have finished.

    You can control the output of the finished jobs by checking their stdout and stderr redirection files. By default, these files are generated in the job owner`s home directory on the host that ran the job. The names of the files are composed of the job script file name with a .o extension for the stdout file and a .e extension for the stderr file, followed by the unique job ID. The stdout and stderr files of your job can be found under the names simple.sh.o1 and simple.sh.e1 respectively. These names are used if your job was the first ever executed in a newly installed grid engine system.