4.2 Defining analysis batch queues

Analysis batch queues are used to configure the way that Abaqus analysis jobs are run. They are particularly useful for integrating Abaqus with third-party batch queueing systems.

Two pieces of information are needed to run an Abaqus job: the syntax of the command used to execute the job and the job-specific information. The command used to execute the job is obtained from a queue definition in the Abaqus environment file. The job-specific information is obtained from the command line options and the analysis parameters defined in the Abaqus environment file. The command line options are described in Chapter 3, Job Execution,” of the Abaqus Analysis User's Guide.

The command syntax and the job-specific information are used to construct a command to run an Abaqus job in an analysis queue. An object-oriented interface and a string-based interface are available for defining the analysis batch queues. The object-oriented interface is preferred because it is easily customized and extended. This section discusses the object-oriented interface; see String-based batch queue parameters, Section 4.1.9, for information on the string-based interface.

A set of predefined (built-in) queue classes is available within an Abaqus environment file. These classes can be instantiated to create user-defined queue objects. See Object-oriented batch queue parameter, Section 4.1.8, for information on the queues environment file parameter. In addition to the predefined queue classes, users can create their own queue classes to customize the way analysis jobs are executed. The new queue classes can be derived from the predefined queue classes to minimize coding by the user. The driverQueues module must be imported to instantiate a predefined queue or to derive a custom queue class. The predefined classes are described in Queue class, Section 4.2.1, and Predefined derived classes, Section 4.2.2. In addition, examples that illustrate how to extend predefined classes and create custom queue classes are provided in Using predefined derived classes, Section 4.3.5, and Deriving and using custom queue classes, Section 4.3.6, respectively.


4.2.1 Queue class

The Queue class is an abstract base class. All other analysis batch queue classes are derived from it. The class has no explicit constructor or members. The following methods of the Queue class are common to all derived classes:

__repr__(...)

This method returns the class name as a string. The string is printed as a description for the queue when abaqus information=environment is executed. Derived classes should override this method to provide a useful description of the queue objects instantiated from them.

createScript(...)

This method creates a Python script named job-name.com in the current working directory. This script is used to run the analysis. This method is called by the analysis execution procedure prior to the submit method. If the job-name.com file cannot be written in the current working directory, a FileCreationError exception is raised. The following argument is required:

options

A dictionary containing the analysis options.

getDriverName(...)

This method returns the name of the command used to invoke the Abaqus execution procedure.

getPython(...)

This method returns the absolute path to the Abaqus Python interpreter as a string.

getNumRequiredTokens(...)

This method returns the number of license tokens required for an analysis as an integer. The following argument is required:

options

A dictionary containing the analysis options.

spawn(...)

This method executes a command in a new process, waits for it to complete, and returns an integer representing the exit status of the command. If the command cannot be executed, a SpawnError exception is raised. The following arguments are required:

cmd

A valid command string to be executed in the new process. If analyses are submitted to this queue from Abaqus/CAE, the command must return the status immediately; otherwise, the ability to monitor the progress of the analysis jobs in Abaqus/CAE may fail. Examples of commands that return the status immediately are qsub, bsub, at, batch, etc.

env

A dictionary of environment variables available to the process.

The following argument is optional:
verbose

A Boolean specifying whether the command string is printed to stdout. The default value is OFF.

submit(...)

This abstract method must be implemented by a derived class. This method is called by the analysis execution procedure to submit the analysis to a queue. The submit method must return an integer; a value of 0 indicates success, and a nonzero value indicates failure. When this method is called, the analysis execution procedure supplies the following required arguments:

options

A dictionary containing the analysis options.

env

A dictionary of environment variables available to the process.

Most derived classes call the spawn method from this method and return its exit status.


4.2.2 Predefined derived classes

The following analysis batch queue classes are derived from the Queue base class:

AtQueue class

The AtQueue class executes an analysis using the Linux at command. This class overrides the following base class methods:

__repr__(...)

This method returns a string describing the class.

submit(...)

This method executes the Linux at command to run the job-name.com analysis script at the time specified on the command line after option. If the after option is not specified on the command line, a QueueError exception is raised.

BatchQueue class

The BatchQueue class executes an analysis using the Linux batch command. This class overrides the following base class methods:

__repr__(...)

This method returns a string describing the class.

submit(...)

This method executes the job-name.com analysis script under the Linux batch command.

HoldQueue class

The HoldQueue class creates a job-name.com file and exits. This class overrides the following base class methods:

__repr__(...)

This method is reimplemented to provide a useful description.

submit(...)

This method prints a message stating that the job-name.com script was not submitted and returns a value of 0.

LSFQueue class

The LSFQueue class submits an analysis to the LSF queue named when the object was instantiated. If a name was not specified, the analysis is submitted to the default LSF queue. The following constructor argument is optional:

name

Name of a valid LSF queue.

This class overrides the following base class method:

submit(...)

This method invokes the LSF bsub command to submit the job-name.com analysis script to an LSF batch cluster and returns the exit status of the bsub command.

NQSQueue class

The NQSQueue class submits an analysis to the NQS queue named when the object was instantiated. If a name was not specified, the analysis is submitted to the default NQS queue. The following constructor argument is optional:

name

Name of a valid NQS queue.

This class overrides the following base class method:

submit(...)

This method invokes the NQS qsub command to submit the job-name.com analysis script to an NQS system and returns the exit status of the qsub command.

PBSQueue class

Queues instantiated from the PBSQueue class will create a job-name.pbs script and run the command qsub job-name.pbs. The job-name.inp and job-name.com files will be copied to the execution host, where the job-name.com script will be executed. After job completion, all output files will be copied back to the submission host. The following constructor argument is optional:

name

Name of a valid PBS queue.

This class overrides the following base class method:

submit(...)

This method invokes the PBS qsub command to submit the job-name.pbs script to a PBS system and returns the exit status of the qsub command.