---
name: "seg_api"
section: "3"
platform: "linux"
package: "libglobus-scheduler-event-generator-doc"
version: "4.6-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/seg_api"
---

# seg\_api(3)

## NAME

Scheduler Implementation API -

### Enumerations

enum **globus\_scheduler\_event\_generator\_error\_t** { **GLOBUS\_SEG\_ERROR\_TYPE\_NULL** =  1024, **GLOBUS\_SEG\_ERROR\_TYPE\_ALREADY\_SET**, **GLOBUS\_SEG\_ERROR\_TYPE\_INVALID\_MODULE**, **GLOBUS\_SEG\_ERROR\_TYPE\_INVALID\_FORMAT**, **GLOBUS\_SEG\_ERROR\_TYPE\_OUT\_OF\_MEMORY**, **GLOBUS\_SEG\_ERROR\_TYPE\_LOADING\_MODULE** }\

### Functions

globus\_result\_t **globus\_scheduler\_event** (const char \*format,...)\
 globus\_result\_t **globus\_scheduler\_event\_pending** (time\_t timestamp, const char \*jobid)\
 globus\_result\_t **globus\_scheduler\_event\_active** (time\_t timestamp, const char \*jobid)\
 globus\_result\_t **globus\_scheduler\_event\_failed** (time\_t timestamp, const char \*jobid, int failure\_code)\
 globus\_result\_t **globus\_scheduler\_event\_done** (time\_t timestamp, const char \*jobid, int exit\_code)\
 globus\_result\_t **globus\_scheduler\_event\_generator\_get\_timestamp** (time\_t \*timestamp)\

## Detailed Description

Scheduler-specific SEG module implementations use this API to issue events to the Job State Monitor.

Events occur whenever a job is placed in the scheduler's queue (PENDING), begins execution (ACTIVE), terminates successfully (DONE), or ends abnormally (FAILED).

A SEG module should register an event with the Globus event driver (most likely using either the Globus Callback or Globus XIO interfaces) in its activation function and then return. All events should be triggered from callbacks. When the SEG detects that it should terminate, it will deactivate the SEG module it started. The SEG module should wait for any outstanding callbacks to subside and before returning from its deactivation function to ensure that all events will be properly dispatched. After deactivation is complete, the SEG will unload the shared module and terminate.

## Enumeration Type Documentation

### enum globus\_scheduler\_event\_generator\_error\_t

Error types used by the SEG.

**Enumerator:**

- *GLOBUS\_SEG\_ERROR\_TYPE\_NULL*

  *NULL Parameter.*

- *GLOBUS\_SEG\_ERROR\_TYPE\_ALREADY\_SET*

  *Already called a one-time function.*

- *GLOBUS\_SEG\_ERROR\_TYPE\_INVALID\_MODULE*

  *Shared module missing descriptor.*

- *GLOBUS\_SEG\_ERROR\_TYPE\_INVALID\_FORMAT*

  *Invalid printf format for SEG protocol message.*

- *GLOBUS\_SEG\_ERROR\_TYPE\_OUT\_OF\_MEMORY*

  *Out of memory.*

- *GLOBUS\_SEG\_ERROR\_TYPE\_LOADING\_MODULE*

  *Unable to load scheduler module.*

## Function Documentation

### globus\_result\_t globus\_scheduler\_event (const char \*format, ...)

*Send an arbitrary SEG notification.* **Parameters:**

*format Printf-style format of the SEG notification message* \
 *... Varargs which will be interpreted as per format.*

**Return values:**

*GLOBUS\_SUCCESS Scheduler message sent or queued.* \
 *GLOBUS\_SEG\_ERROR\_NULL Null format.* \
 *GLOBUS\_SEG\_ERROR\_INVALID\_FORMAT Unable to determine length of formatted string.*

### globus\_result\_t globus\_scheduler\_event\_pending (time\_ttimestamp, const char \*jobid)

*Send a job pending event to the JobSchedulerMonitor implementation.* **Parameters:**

*timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used.* \
 *jobid String indicating the scheduler-specific name of the job.*

**Return values:**

*GLOBUS\_SUCCESS Scheduler message sent or queued.* \
 *GLOBUS\_SEG\_ERROR\_NULL Null jobid.* \
 *GLOBUS\_SEG\_ERROR\_INVALID\_FORMAT Unable to determine length of formatted string.*

### globus\_result\_t globus\_scheduler\_event\_active (time\_ttimestamp, const char \*jobid)

*Send a job active event to the JobSchedulerMonitor implementation.* **Parameters:**

*timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used.* \
 *jobid String indicating the scheduler-specific name of the job.*

**Return values:**

*GLOBUS\_SUCCESS Scheduler message sent or queued.* \
 *GLOBUS\_SEG\_ERROR\_NULL Null jobid.* \
 *GLOBUS\_SEG\_ERROR\_INVALID\_FORMAT Unable to determine length of formatted string.*

### globus\_result\_t globus\_scheduler\_event\_failed (time\_ttimestamp, const char \*jobid, intfailure\_code)

*Send a job failed event to the JobSchedulerMonitor implementation.* **Parameters:**

*timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used.* \
 *jobid String indicating the scheduler-specific name of the job.* \
 *failure\_code Failure code of the process if known.*

**Return values:**

*GLOBUS\_SUCCESS Scheduler message sent or queued.* \
 *GLOBUS\_SEG\_ERROR\_NULL Null jobid.* \
 *GLOBUS\_SEG\_ERROR\_INVALID\_FORMAT Unable to determine length of formatted string.*

### globus\_result\_t globus\_scheduler\_event\_done (time\_ttimestamp, const char \*jobid, intexit\_code)

*Send a job done event to the JobSchedulerMonitor implementation.* **Parameters:**

*timestamp Timestamp to use for the event. If set to 0, the time which this function was called is used.* \
 *jobid String indicating the scheduler-specific name of the job.* \
 *exit\_code Exit code of the process if known.*

**Return values:**

*GLOBUS\_SUCCESS Scheduler message sent or queued.* \
 *GLOBUS\_SEG\_ERROR\_NULL Null jobid.* \
 *GLOBUS\_SEG\_ERROR\_INVALID\_FORMAT Unable to determine length of formatted string.*

### globus\_result\_t globus\_scheduler\_event\_generator\_get\_timestamp (time\_t \*timestamp)

*Get the timestamp for the earliest event an SEG module should send.* **Parameters:**

*timestamp Pointer to a time\_t which will be set to the timestamp passed to the SEG executable. The module should not send any events which occur prior to this timestamp.*

**Return values:**

*GLOBUS\_SEG\_ERROR\_NULL Null timestamp.* \
 *GLOBUS\_SUCCESS Timestamp value updated. If the timestamp was not set on the SEG command-line, then the value pointed to by timestamp will be set to 0.*

## Author

*Generated automatically by Doxygen for globus scheduler event generator from the source code.*
