---
name: "drmaa_get_next_attr_name"
section: "3"
platform: "linux"
package: "gridengine-drmaa-dev"
version: "6.2u5-7.1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/drmaa_attributes"
---

# drmaa\_get\_next\_attr\_name(3)

DRMAA job template attributes

Part of [drmaa\_attributes(3)](/drmaa_attributes/3.md).

## NAME

drmaa\_get\_attribute\_names, drmaa\_get\_vector\_attribute\_names, drmaa\_get\_next\_attr\_name,  drmaa\_get\_num\_attr\_names, drmaa\_release\_attr\_names - DRMAA job template attributes

## SYNOPSIS

**#include "drmaa.h"**

```
int drmaa_get_attribute_names(
drmaa_attr_names_t **values,
char *error_diagnosis,
size_t error_diag_len
```

**);**

```
int drmaa_get_vector_attribute_names(
drmaa_attr_names_t **values,
char *error_diagnosis,
size_t error_diag_len
```

**);**

```
int drmaa_get_next_attr_name(
drmaa_attr_names_t* values,
char *value,
int value_len
```

**);**

```
int drmaa_get_next_attr_value(
drmaa_attr_values_t* values,
char *value,
int value_len
```

**);**

```
int drmaa_get_num_attr_names(
drmaa_attr_names_t* values,
int *size
```

**);**

```
void drmaa_release_attr_names(
drmaa_attr_names_t* values
```

**);**

```

```

## DESCRIPTION

**The drmaa\_get\_attribute\_names() function returns into** *values* **a DRMAA names** **string vector containing the set of supported non-vector DRMAA job template**  **attribute names. The set includes supported DRMAA reserved attribute names**  **and Sun Grid Engine native attribute names. The names in the names string**  **vector can be extracted using**  [*drmaa\_get\_next\_attr\_name*(3)](/drmaa_get_next_attr_name/3.md). The number of names in the names string vector can be determined using [*drmaa\_get\_num\_attr\_names*(3)](/drmaa_get_num_attr_names/3.md). Note that this function is only available in the 1.0 implementation. The caller is responsible for releasing the names string  vector returned into *values* using  [*drmaa\_release\_attr\_names*(3)](/drmaa_release_attr_names/3.md). Use  [*drmaa\_set\_attribute*(3)](/drmaa_set_attribute/3.md) and  [*drmaa\_get\_attribute*(3)](/drmaa_get_attribute/3.md) for setting and inspecting non-vector attributes.

### drmaa\_get\_vector\_attribute\_names()

The drmaa\_get\_vector\_attribute\_names() function returns into *values* a DRMAA names string vector containing the set of supported vector DRMAA job template  attribute names. The set includes supported DRMAA reserved attribute names  and Sun Grid Engine native attribute names. The names in the names string  vector can be extracted using  [*drmaa\_get\_next\_attr\_name*(3)](/drmaa_get_next_attr_name/3.md). The caller is responsible for releasing the names string  vector returned into *values* using  [*drmaa\_release\_attr\_names*(3)](/drmaa_release_attr_names/3.md). Use  [*drmaa\_set\_vector\_attribute*(3)](/drmaa_set_vector_attribute/3.md) and  [*drmaa\_get\_vector\_attribute*(3)](/drmaa_get_vector_attribute/3.md) for setting and inspecting vector attributes.

### drmaa\_get\_next\_attr\_name()

Each time drmaa\_get\_next\_attr\_name() is called it returns into the buffer, *value*, up to *value\_len*  bytes of the next entry stored in the DRMAA names string vector, *values*. Once the names list has been exhausted, DRMAA\_ERRNO\_NO\_MORE\_ELEMENTS is returned.

### drmaa\_get\_num\_attr\_names()

The drmaa\_get\_num\_attr\_names() returns into *size* the number of entries in the DRMAA names string vector.  This function is only available in the 1.0 implementation.

### drmaa\_release\_attr\_names()

The drmaa\_release\_attr\_names() function releases all resources associated with the DRMAA names string vector, *values*.

### Attribute Priorities

DRMAA job template attributes can be set from six different sources.  In order of precedence, from lowest to highest, these are: options set by DRMAA automatically by default, options set in the [*sge\_request*(5)](/sge_request/5.md) file(s), options set in the script file, options set by the drmaa\_job\_category attribute, options set by the drmaa\_native\_specification attribute, and options set through other DRMAA attributes.

By default DRMAA sets four options for all jobs.  These are "-p 0", "-b yes", "-shell no", and "-w e".  This means that by default, all jobs will have priority 0, all jobs will be treated as binary, i.e. no scripts args will be parsed, all jobs will be executed without a wrapper shell, and jobs which are unschedulable will cause a submit error.

The [*sge\_request*(5)](/sge_request/5.md) file, found in the $SGE\_ROOT/$SGE\_CELL/common directory, may contain options to be applied to all jobs.  The .sge\_request file found in the user's home directory or the current working directory may also contain options to be applied to certain jobs.  See [*sge\_request*(5)](/sge_request/5.md) for more information.

If the [*sge\_request*(5)](/sge_request/5.md) file contains "-b no" or if the drmaa\_native\_specification attribute is set and contains "-b no", the script file will be parsed for in-line arguments. Otherwise, no scripts args will be interpreted.  See [*qsub*(1)](/qsub/1.md) for more information.

If the drmaa\_job\_category attribute is set, and the category it points to exists in one of the *qtask*(5) files, the options associated with that category will be applied to the job template.  See *qtask*(5) and the drmaa\_job\_category attribute below for more information.

If the drmaa\_native\_specification attribute is set, all options contained therein will be applied to the job template.  See the drmaa\_native\_specification below for more information.

Other DRMAA attributes will override any previous settings.  For example, if the sge\_request file contains "-j y", but the drmaa\_join\_files attribute is set to "n", the ultimate result is that the input and output files will remain separate.

For various reasons, some options are silently ignored by DRMAA.  Setting any of these options will have no effect.  The ignored options are: -cwd, -help, -sync, -t, -verify, -w w, and -w v.  The -cwd option can be re-enabled by setting the environment variable, SGE\_DRMAA\_ALLOW\_CWD.  However, the -cwd option is not thread safe and should not be used in a multi-threaded context.

### Attribute Correlations

The following DRMAA attributes correspond to the following [*qsub*(1)](/qsub/1.md) options:

```
DRMAA Attribute                  qsub Option
-------------------------------------------------------
drmaa_remote_command             script file
drmaa_v_argv                     script file args
drmaa_js_state = "drmaa_hold"    -h
drmaa_v_env                      -v
drmaa_wd = $PWD                  -cwd
drmaa_job_category               (qtsch qtask)*
drmaa_native_specification       ALL*
drmaa_v_email                    -M
drmaa_block_email = "1"          -m n
drmaa_start_time                 -a
drmaa_job_name                   -N
drmaa_input_path                 -i
drmaa_output_path                -o
drmaa_error_path                 -e
drmaa_join_files                 -j
drmaa_transfer_files             (prolog and epilog)*
```

\* See the individual attribute description below

## DRMAA JOB TEMPLATE ATTRIBUTES

### drmaa\_remote\_command - "\<remote\_command\>"

Specifies the remote command to execute. The *remote\_command* must be the path of an  executable that is available at the job's execution host.  If the path is relative, it is assumed to be relative to the working directory, usually set through the drmaa\_wd attribute.  If working directory is not set, the path is assumed to be relative to the user's home directory.

The file pointed to by remote\_command may either be an executable binary or an executable script.  If a script, it must include the path to the shell in a #! line at the beginning of the script.  By default, the remote command will be executed directly, as by *exec*(2). To have the remote command executed in a shell, such as to preserve environment settings, use the drmaa\_native\_specification attribute to include the "-shell yes" option.  Jobs which are executed by a wrapper shell fail differently from jobs which are executed directly.  When a job which contains a user error, such as an invalid path to the executable, is executed by a wrapper shell, the job will execute successfully, but exit with a return code of 1.  When a job which contains such an error is executed directly, it will enter the DRMAA\_PS\_FAILED state upon execution.

### drmaa\_js\_state - "{drmaa\_hold\|drmaa\_active}"

Specifies the job state at submission. The string values 'drmaa\_hold' and 'drmaa\_active' are supported. When 'drmaa\_active' is used the job is submitted in a runnable state.  When 'drmaa\_hold' is used the job is submitted in user hold state (either DRMAA\_PS\_USER\_ON\_HOLD or DRMAA\_PS\_USER\_SYSTEM\_ON\_HOLD). This attribute is largely equivalent to  the [*qsub*(1)](/qsub/1.md) submit option '-h'.

### drmaa\_wd - "\<directory\_name\>"

Specifies the directory name where the job will be executed. A '$drmaa\_hd\_ph$' placeholder  at the beginning of the *directory\_name*  denotes the remaining string portion as a relative directory name that is resolved relative to the job user's home directory at the execution  host. When the DRMAA job template is used for bulk job submission (see also *drmaa\_run\_bulk\_job*(3)) the '$drmaa\_incr\_ph$' placeholder can be used at any position within *directory\_name*  to cause a substitution with the parametric job's index.  The *directory\_name* must be specified in a syntax that is common at the host  where the job is executed. If set to a relative path and no placeholder is used, a path relative to the user's home directory is assumed.  If not set, the working directory will default to the user's home directory.  If set and the given directory does not exist the job will enter the DRMAA\_PS\_FAILED state when run.

Note that the working directory path is the path on the execution host.  If binary mode is disabled, an attempt to find the job script will be made, relative to the working directory path.  That means that the path to the script must be the same on both the submission and execution hosts.

### drmaa\_job\_name - "\<job\_name\>"

Specifies the job's name. Setting the job name is equivalent to use of [*qsub*(1)](/qsub/1.md) submit option '-N' with *job\_name* as option argument.

### drmaa\_input\_path - "\[\<hostname\>\]:\<file\_path\>"

Specifies the standard input of the job. Unless set elsewhere, if not explicitly set in  the job template, the job is started with an empty input stream. If the standard input is set it  specifies the network path of the job's input stream file.

When the 'drmaa\_transfer\_files' job  template attribute is supported and contains the character 'i', the input file will be fetched  by Sun Grid Engine from the specified host or from the submit host if no  *hostname* is specified. When the 'drmaa\_transfer\_files' job template attribute is not  supported or does not contain the character 'i', the input file is always expected at the  host where the job is executed regardless of any *hostname* specified.

If the DRMAA job template will be used for bulk job submission,  (See also *drmaa\_run\_bulk\_job*(3)) the '$drmaa\_incr\_ph$' placeholder can be used at any position  within *file\_path* to cause a substitution with the parametric job's index. A '$drmaa\_hd\_ph$'  placeholder at the beginning of *file\_path* denotes the remaining portion of the  *file\_path* as a relative file specification resolved relative to the job user's home directory  at the host where the file is located. A '$drmaa\_wd\_ph$' placeholder at the beginning of *file\_path* denotes the remaining portion of the *file\_path* as a relative file specification resolved relative  to the job's working directory at the host where the file is located. The *file\_path* must be specified  in a syntax that is common at the host where the file is located. If set and the file can't be read  the job enters the state DRMAA\_PS\_FAILED.

### drmaa\_output\_path - "\[\<hostname\>\]:\<file\_path\>"

Specifies the standard output of the job. If not explicitly set in the job template, the whereabouts of  the job's output stream is not defined. If set, this attribute specifies the network path of the job's output stream file.

When the 'drmaa\_transfer\_files' job template attribute is supported and contains the character 'o', the output file will be transferred by Sun Grid Engine to the specified host or to the submit host if no  *hostname* is specified. When the 'drmaa\_transfer\_files' job template attribute is not supported or  does not contain the character 'o', the output file is always kept at the host where the job is executed  regardless of any *hostname* specified.

If the DRMAA job template will be used for of bulk job submission  (see also  *drmaa\_run\_bulk\_job*(3)) the '$drmaa\_incr\_ph$' placeholder can be used at any position within the *file\_path* to cause a substitution with the parametric job's index.  A '$drmaa\_hd\_ph$' placeholder at the beginning of *file\_path* denotes the remaining portion of the *file\_path* as a relative file specification  resolved relative to the job user's home directory at the host where the file is located. A '$drmaa\_wd\_ph$' placeholder at the beginning of the *file\_path* denotes the remaining portion of *file\_path* as a  relative file specification resolved relative to the job's working directory at the host where the file  is located. The *file\_path* must be specified in a syntax that is common at the host where the file  is located. If set and the file can't be written before execution the job enters the state DRMAA\_PS\_FAILED.

### drmaa\_error\_path - "\[\<hostname\>\]:\<file\_path\>"

Specifies the standard error of the job. If not explicitly set in the job template, the whereabouts of the  job's error stream is not defined. If set, this attribute specifies the network path of the job's error stream file.

When the 'drmaa\_transfer\_files' job template attribute is supported and contains the character 'e', the output file will be transferred by Sun Grid Engine to the specified host or to the submit host if no  *hostname* is specified. When the 'drmaa\_transfer\_files' job template attribute is not supported  or does not contain the character 'e', the error file is always kept at the host where the job is executed regardless of any *hostname* specified.

If the DRMAA job template will be used for of bulk job submission  (see also  *drmaa\_run\_bulk\_job*(3)) the '$drmaa\_incr\_ph$' placeholder can be used at any position within the *file\_path* to cause a substitution with the parametric job's index.  A '$drmaa\_hd\_ph$' placeholder at the beginning of the *file\_path* denotes the remaining portion of the *file\_path* as a relative file specification resolved relative to the job user's home directory at the host where the file is located. A '$drmaa\_wd\_ph$' placeholder at the beginning of the *file\_path* denotes the remaining portion of the *file\_path* as a relative file specification resolved relative to the job's working directory at the host where the file is located. The *file\_path* must be specified in a syntax that is common at the host where the file is located. If set and the file can't be written before execution the job enters the state DRMAA\_PS\_FAILED. The attribute name is drmaa\_error\_path.

### drmaa\_join\_files - "{y\|n}"

Specifies if the job's error stream should be intermixed with the output stream.  If not explicitly set in the job template the attribute defaults to 'n'. Either 'y' or 'n' can be specified. If 'y' is specified Sun Grid Engine will ignore the value  of the 'drmaa\_error\_path' job template attribute and intermix the standard error  stream with the standard output stream as specified with 'drmaa\_output\_path'.

### drmaa\_v\_argv - "argv1 argv2 ..."

Specifies the arguments to the job.

### drmaa\_job\_category - "\<category\>"

Specifies the DRMAA job category. The *category* string is used  by Sun Grid Engine as a reference into the  *qtask*(5) file. Certain  [*qsub*(1)](/qsub/1.md) options used in the referenced qtask file line are applied to the job template  before submission to allow site-specific resolving of resources and/or policies.  The cluster qtask file, the local qtask file, and the user qtask file are searched. Job settings resulting from job template category are overridden by settings resulting from the job template drmaa\_native\_specification attribute as well as by explicit DRMAA job template settings.

In order to avoid collisions with command names in the qtask files, it is recommended that DRMAA job category names take the form: \<category\_name\>.cat.

The options -help, -sync, -t, -verify, and -w w\|v are ignored.  The -cwd option is ignored unless the $SGE\_DRMAA\_ALLOW\_CWD environment variable is set.

### drmaa\_native\_specification - "\<native\_specification\>"

Specifies Sun Grid Engine native [*qsub*(1)](/qsub/1.md) options which will be interpreted as part of the DRMAA job template.  All options available to [*qsub*(1)](/qsub/1.md) command may be used in the *native\_specification*, except for -help, -sync, -t, -verify, and -w w\|v.  The -cwd option may only be used if the SGE\_DRMAA\_ALLOW\_CWD environment variable is set.  This is because the current parsing algorithm for -cwd is not thread-safe.  Options set in the *native* *specification* will be overridden by the corresponding DRMAA attributes.  See [*qsub*(1)](/qsub/1.md) for more information on qsub options.

### drmaa\_v\_env - "\<name1\>=\<value1\> \<name2\>=\<value2\> ...

Specifies the job environment. Each environment *value* defines the remote  environment. The *value* overrides the remote environment values if there  is a collision.

### drmaa\_v\_email - "\<email1\> \<email2\> ...

Specifies e-mail addresses that are used to report the job completion and status.

### drmaa\_block\_email - "{0\|1}"

Specifies whether e-mail sending shall blocked or not.  By default email is not sent.  If, however, a setting in a cluster or user settings file or the 'drmaa\_native\_specification' or 'drmaa\_job\_category' attribute enables sending email in association with job events, the 'drmaa\_block\_email' attribute will override that setting, causing no email to be sent.

### drmaa\_start\_time - "\[\[\[\[CC\]YY/\]MM/\]DD\] hh:mm\[:ss\] \[{-\|+}UU:uu\]"

Specifies the earliest time when the job may be eligible to be run where

```
CC is the first two digits of the year (century-1)
YY is the last two digits of the year
MM is the two digits of the month [01,12]
DD is the two digit day of the month [01,31]
hh is the two digit hour of the day [00,23]
mm is the two digit minute of the day [00,59]
ss is the two digit second of the minute [00,61]
UU is the two digit hours since (before) UTC
uu is the two digit minutes since (before) UTC
```

If the optional UTC-offset is not specified, the offset associated with the local timezone will be  used. If the day (DD) is not specified, the current day will be used unless the  specified hour:mm:ss has already elapsed, in which case the next day will be used.  Similarly for month (MM), year (YY), and century-1 (CC).  Example: The time: Sep 3 4:47:27 PM PDT 2002, could be represented as: 2002/09/03 16:47:27 -07:00.

### drmaa\_transfer\_files - "\[i\]\[o\]\[e\]"

Specifies, which of the standard I/O files (stdin, stdout and stderr) are to be  transferred to/from the execution host. If not set, defaults to "". Any combination of 'e', 'i' and 'o' may be specified. See drmaa\_input\_path, drmaa\_output\_path and drmaa\_error\_path for information about  how to specify the standard input file, standard output file and standard error file. The file transfer mechanism itself must be configured by the administrator (see  [*sge\_conf*(5)](/sge_conf/5.md) ). When it is configured, the administrator has to enable drmaa\_transfer\_files. If it is not configured, "drmaa\_transfer\_files" is not enabled and can't be used.

## ENVIRONMENTAL VARIABLES

- **SGE\_DRMAA\_ALLOW\_CWD**

  Enables the parsing of the -cwd option from the sge\_request file(s), job category, and/or the native specification attribute.  This option is disabled by default because the algorithm for parsing the -cwd option is not thread-safe.

- **SGE\_ROOT**

  Specifies the location of the Sun Grid Engine standard configuration files.

- **SGE\_CELL**

  If set, specifies the default Sun Grid Engine cell to be used. To address a Sun Grid Engine cell Sun Grid Engine uses (in the order of precedence):

  The name of the cell specified in the environment variable SGE\_CELL, if it is set.

  The name of the default cell, i.e. **default**.

- **SGE\_DEBUG\_LEVEL**

  If set, specifies that debug information should be written to stderr. In addition the level of detail in which debug information is generated is defined.

- **SGE\_QMASTER\_PORT**

  If set, specifies the tcp port on which [*sge\_qmaster*(8)](/sge_qmaster/8.md) is expected to listen for communication requests. Most installations will use a services map entry instead to define that port.

## RETURN VALUES

Upon successful completion, drmaa\_get\_attribute\_names(),  drmaa\_get\_vector\_attribute\_names(), and drmaa\_get\_next\_attr\_name() return DRMAA\_ERRNO\_SUCCESS. Other values indicate an error. Up to *error\_diag\_len* characters of error related diagnosis  information is then provided in the buffer *error\_diagnosis*.

## ERRORS

The drmaa\_get\_attribute\_names(), drmaa\_get\_vector\_attribute\_names(), and drmaa\_get\_next\_attr\_name() functions will fail if:

### DRMAA\_ERRNO\_INTERNAL\_ERROR

Unexpected or internal DRMAA error, like system call failure, etc.

### DRMAA\_ERRNO\_DRM\_COMMUNICATION\_FAILURE

Could not contact DRM system for this request.

### DRMAA\_ERRNO\_AUTH\_FAILURE

The specified request is not processed successfully due to authorization failure.

### DRMAA\_ERRNO\_INVALID\_ARGUMENT

The input value for an argument is invalid.

### DRMAA\_ERRNO\_NO\_ACTIVE\_SESSION

Failed because there is no active session.

### DRMAA\_ERRNO\_NO\_MEMORY

Failed allocating memory.

The drmaa\_get\_next\_attr\_name() will fail if:

### DRMAA\_ERRNO\_INVALID\_ATTRIBUTE\_VALUE

When there are no more entries in the vector.

## SEE ALSO

[*drmaa\_jobtemplate*(3)](/drmaa_jobtemplate/3.md)and [*drmaa\_submit*(3)](/drmaa_submit/3.md).
