Knowledge Center         Contents    Previous  Next    
Platform Computing Corp.

lsb_readjobmsg()

Reads messages and data posted to a job.

DESCRIPTION

Use lsb_readjobmsg() to open a TCP connection, receive attached messages and data from the mbatchd, and display the messages posted by lsb_postjobmsg().

By default, lsb_readjobmsg() displays the message "no description" or the message at index position 0 of the specified job. To read other messages, choose another index position. The index is populated by lsb_postjobmsg().

If a data file is attached to a message and the flag EXT_ATTA_READ is set, lsb_readjobmsg() gets the message and copies its data file to the default directory JOB_ATTA_DIR, overwriting the specified file if it already exists. If there is no file attached, the system reports an error.

Users can only read messages and data from their own jobs. Root and LSF administrators can also read messages of jobs submtted by other users, but they cannot read data files attached to jobs owned by other users.

You can read messages and data from a job until it is cleaned from the system. You cannot read messages and data from done or exited jobs.

SYNOPSIS

#include <lsf/lsbatch.h>
#include <time.h> 
int lsb_readjobmsg(struct jobExternalMsgReq *jobExternalMsg, 
    struct jobExternalMsgReply *jobExternalMsgReply) 
struct jobExternalMsgReq {
    int options;
    LS_LONG_INT jobId;
    char *jobName;
    int msgIdx;
    char *desc;
    int userId;
    long dataSize;
    time_t postTime;
    char *userName;
}; 
struct jobExternalMsgReply {
    LS_LONG_INT jobId;
    int msgIdx;
    char *desc;
    int userId;
    long dataSize;
    time_t postTime;
    int dataStatus;
    char *jobName;
}; 

PARAMETERS

jobExternalMsg

This structure contains the information required to define an external message of a job.

options

Specifies if the message has an attachment to be read.

<lsf/lsbatch.h> defines the following flags constructed from bits. These flags correspond to options.

EXT_MSG_READ

Read the external job message. There is no attached data file.

EXT_ATTA_READ

Read the external job message and data file posted to the job.

If there is no data file attached, the error message "The attached data of the message is not available" is displayed, and the external job message is displayed.

jobId

The system generated job Id of the job.

msgIdx

The message index. A job can have more than one message. Use msgIdx in an array to index messages.

desc

Text description of the message

userId

The userId of the author of the message.

dataSize

The size of the data file. If no data file is attached, the size is 0.

postTime

The time the author posted the message.

userName

The author of the message.

jobExternalMsgReply

This structure contains the information required to define an external message reply.

jobId

The system generated job Id of the job associated with the message.

msgIdx

The message index. A job can have more than one message. Use msgIdx in an array to index messages.

desc

The message you want to read.

userId

The user Id of the author of the message.

dataSize

The size of the data file attached. If no data file is attached, the size is 0.

postTime

The time the message was posted.

dataStatus

The status of the attached data file. The status of the data file can be one of the following:

EXT_DATA_UNKNOWN

Transferring the message's data file.

EXT_DATA_NOEXIST

The message does not have an attached data file.

EXT_DATA_AVAIL

The message's data file is available.

EXT_DATA_UNAVAIL

The message's data file is corrupt.

RETURN VALUES

integer:value

The successful function returns a socket number.

integer:0

The EXT_ATTA_READ bit of options is not set or there is no attached data.

integer:-1

The function failed.

ERRORS

If the function fails, lserrno is set to indicate the error.

SEE ALSO

Related APIs

lsb_postjobmsg() - Sends messages and attaches data files to a jobs

Equivalent line command

bread

Files

lsb.params

JOB_ATTA_DIR

LSB_SHAREDIR/info/


Platform Computing Inc.
www.platform.com
Knowledge Center         Contents    Previous  Next