12.2 Process control features of AIPS

There are a number of tools available to assist you in scheduling and controlling the execution of AIPS tasks. They include taking the input from a text file rather than an interactive terminal, special adverbs to the verb GO, and even one or more detached, batch processing queues.

12.2.1 RUN files

If you have some lengthy sequence of commands to give to AIPS, especially if you will have to give essentially the same sequence more than once, you may find it helpful to prepare the sequence in a text file using your favorite and flexible text editor. In particular, it is cumbersome to write and edit procedures more than about five lines long in AIPS because of its primitive internal editor. Long procedures are best written as text files at your computer’s monitor level, where the editing facilities will usually be much better. These text files can be transferred to AIPS easily using the RUN file facility.

Any commands that can be typed on the terminal to AIPS can be stored in your text file. The text files may be stored in a disk area of your choosing or in a public area identified by the logical name $RUNFIL. The name of the file must be all upper case letters, followed by a period, followed by your user number as a three-digit “extended-hexadecimal” number with leading zeros. (To translate between decimal and extended hexadecimal, use the AIPS procedures or the AIPS verbs called EHEX and REHEX.) To use the RUN file from your own disk area, define a logical name before starting AIPS to point to the area (see §3.10.1). Then start up AIPS under your user number and enter

> VERSION  = ’MYAREA’  C R

where MYAREA is your disk area, or

> VERSION  = ’    C R

if $RUNFIL is to be used

> RUN  FILE  C R

to execute the file named FILE.uuu

where uuu is your user number in extended hexadecimal with leading zeros to make three digits. The file FILE.uuu or, if it does not exist, FILE.001 will be executed by the above command. Note that minimum match also applies to RUN file names.

The first line of a RUN file is ignored by AIPS. You should type comments into your RUN files to remind you what they are doing. The first line, any line which begins with an * in column one, and all text following a $ sign (in any line) are treated as comments which will not be compiled or executed by AIPS. All facilities in AIPS such as GET, SAVE, TGET and TUGET can be used in RUN files. You may even nest RUN files within RUN files up to 20 deep, but remember that the pseudo-verb COMPRESS makes use of the RUN process. The full contents of a SAVE area may be put in a RUN file using SG2RUN.

AIPS programmers also provide a few RUN files for general use in each release e.g.VLACALIB, VLACLCAL and VLARESET. They are normally used to create procedures helpful to some, but not all, AIPS users. These are stored under user number 1, but are available automatically to everyone. To use a procedure from one of them, type, for example:

> RUN VLAPROCS  C R

to read and execute file VLAPROCS in AIPS. The text will be listed as it is read.

This file contains a number of procedure definitions including those named above. To execute the procedure, prepare the input adverbs as needed, and then type

> VLACALIB  C R

to execute the calibration sequence of the simplified procedure.

AIPS programmers will provide a file with the inputs and help information for all canned procedures. Thus you can do

> HELP VLACAL  C R

to see help information on the procedure.

> INP VLACAL  C R

to see the current inputs to the procedure.

The help and inputs functions may require the RUN if special adverbs are used by the procedure, but you must do the RUN to compile the procedure before you can use it.

12.2.2 More about GO

The verb GO is shown in examples throughout this CookBook. Don’t overlook the fact that GO, like all other AIPS verbs, has its own inputs. You will be familiar with the ability to specify which task you want to execute either by an immediate argument, e.g.GO UVSRT  C R, or by the parameter TASK, e.g.TASK UVSRT’ ; GO  C R. GO has three further parameters, DOWAIT,VERSION, and QCREATE. The value of DOWAIT is passed to the task and instructs it to resume AIPS as soon as possible (DOWAIT FALSE  C R) or to resume AIPS only after completing its operations (DOWAIT TRUE  C R). The latter option lets the task return a meaningful error code to which AIPS may respond by aborting the current input line, procedure, FOR loop, etc. Note that the verb WAIT tasknamealso forces AIPS to wait for a task to complete, but it cannot respond to some failure in that task. For example, the line:

> GO UVSRT ; WAIT UVSRT ; GO UVMAP  C R

may cause unwanted images to be generated by UVMAP if UVSRT fails for lack of disk space or some other reason. However, the line:

> DOWAIT TRUE ; GO UVSRT ; GO UVMAP  C R

will not attempt to execute UVMAP if UVSRT fails. Note that AIPS will not get hung up when a task aborts even if DOWAIT is true. This consideration is particularly important when you do multiple runs of FITTP to write your output tape. If one fails, the tape may even be rewound. If the next scheduled FITTP actually runs, it may write at the beginning of tape, destroying all previous data on the tape!

VERSION is used to specify which version of the program you wish to execute. You might use this to select the TST or OLD versions of a task from the NEW version of AIPS, for example. VERSION also allows you to execute private versions of programs and even to check a list of areas for versions of your program. Type HELP VERSION  C R for details. The last adverb, QCREATE = 1, instructs tasks to create files quickly. This can save a lot of time, but does not guarantee that the disk space will be available when the task gets around to needing it.

GO has another useful capability. Normally, in order to invoke a verb, you simply type its name, e.g.,:

> PRTMSG  C R

to print the message file contents.

However, if you type, instead:

> GO PRTMSG  C R

having forgotten that PRTMSG is a verb, then AIPS will actually execute:

> TPUT PRTMSG ; PRTMSG  C R

to save the current PRTMSG inputs and then print the contents of the message file.

You can recover those inputs at a later time with TGET PRTMSG  C R.

12.2.3 Batch jobs

The AIPS batch processor can be used to run jobs outside interactive AIPS. The job consists of a set of AIPS instructions which do not need user interaction. This excludes the TV, the Tektronix, and the tape-drive oriented tasks and verbs. RUN files may be used in batch jobs — as the batch editor facility is also primitive, they are particularly attractive to batch users. Older restrictions on which tasks may be run in queue 1 have been removed in the 15JAN96 release.

The instructions to be executed in the batch processor are prepared in a “workfile.” The workfile can be made while in AIPS and detailed instructions are given by typing:

> HELP BATCHJOB  C R

A simple example is given here:

> BATQUE = 2 ; BATCLEAR  C R

to select queue 2 and clear its workfile.

> BATCH  C R

to enter batch preparation mode.

< TASK = ’UVSRT  C R

(Notice < prompt. Begin typing as in AIPS.)

< INN = ’3C16’ ; INCL = ’UVDATA’  C R

< INSEQ 1 ; OUTN INN ; OUTCL INCL  C R

< OUTSEQ = 0 ; SORT = ’XY’  C R

< GO  C R

(Batch AIPS always waits for a task to finish before continuing.)

< RUN XXXXX  C R

(RUN files are good to use in a batch job.)

< GO  C R

< ENDBATCH  C R

to leave batch preparation mode type in ENDBATCH spelled out in full.

> 

(Resume normal interactive processing.)

To list a batch file, type:

> BATFLINE = 0 ; BATLIST  C R

To edit line n in a batch file, type:

> BATEDIT n  C R

< put text here  C R

to replace old line n.

< some more text  C R

to insert more commands between old lines n and n+1.

< ENDBATCH  C R

(spelled out in full.)

> 

(Resume normal interactive processing.)

As with procedures (§12.3.2), if n is an integer, the existing line n is overwritten with the line or lines typed before ENDBATCH. If n is not an integer, the new lines are simply inserted between lines n and n+1. BAMODIFY provides, for workfiles, the same functions as MODIFY does for procedures.

Finally, the workfile can be submitted to the batch processor by typing:

> SUBMIT  C R

The instructions are sent to a checking program which checks that the input is free of obvious errors. All RUN files are expanded and checked. If Checker (the task AIPSCm where m is some extended hexadecimal number < Z) approves, the job goes into the AIPS job queue, which is managed by QMNGRn. If you change your mind, the job can be removed from the queue and returned to the workfile with the verb UNQUE. The batch job may be submitted to any local computer, not just the one on which the current AIPS session is running. Adverbs REMHOST and REMQUE control this option. The remote host must be one sharing the same AIPS installation as the current session. Note that the data must also be available to the remote host, but verb ADDDISK may be useful either within the batch job or in preparing the data files for the job. REMOST is supported by all relevant batch-related verbs.

Batch has several limitations. First, devices which require interactive use (TV device, Tektronix device, and the tape drives) cannot be used in batch. Also, batch uses a different set of TPUT and TGET files. Thus, a TGET in batch does not get the adverbs from your last interactive use of the specified task. However, the AIPS facilities GET and SAVE are particularly useful for batch. You can use interactive AIPS to set up and test set(s) of procedures and adverb values and SAVE them in named files. These files may then be recovered by batch for the routine processing of large sets of data. This is considerably more convenient than using the batch editor. Note that SAVE / GET files may become obsolete with new AIPS releases, but that improvements to the POPS language have made this quite unlikely.

At present, batch jobs are run after a short delay, on a first-come, first-served basis. After your job has been submitted successfully, type:

> QUEUES  C R

to list jobs in the queue.

Note the SUBMITTIME for your job. It will not start before that time. The messages generated by your batch job will be printed automatically into a text file. They are kept in your message file, however, and can be reprinted or examined later via PRTMSG with PRNUMB set to the AIPS number of the batch queue. Printer output for batch jobs is concatenated into a file either specified by the user with OUTPRINT or a file named PRTFIL:BATCHjjj.nnn, where jjj is the job number and nnn the user number both in extended hexadecimal. Note, this means batch job printouts are concatenated in (normally) one file and are not automatically printed. An interactive AIPS can interact with a batch job via TELL; see §5.3.1.