[GE users] anyone have code to print out a drmaa job template?

Daniel Templeton Dan.Templeton at Sun.COM
Wed Aug 23 19:52:05 BST 2006


    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "ISO-8859-10" character set.  ]
    [ Some special characters may be displayed incorrectly. ]

C or Java?

In C, it would look like:

drmaa_job_template_t *jt = ...;
drmaa_attr_names_t *names = NULL;
char[DRMAA_ERROR_STRING_BUFFER+1] error;
char[DRMAA_ATTR_BUFFER+1] buffer;

drmaa_get_attribute_names(&names, error, DRMAA_ERROR_STRING_BUFFER);

while (drmaa_get_next_attr_name(names, buffer, DRMAA_ATTR_BUFFER) == DRMAA_ERRNO_SUCCESS) {
   char[DRMAA_ATTR_BUFFER+1] value;

   drmaa_get_attribute(jt, buffer, value, DRMAA_ATTR_BUFFER, error, DRMAA_ERROR_STRING_BUFFER);
   println("%s = %s\n", buffer, value);
}

drmaa_release_attr_names(names);
names = NULL;

drmaa_get_vector_attribute_names(&names, error, DRMAA_ERROR_STRING_BUFFER);

while (drmaa_get_next_attr_name(names, buffer, DRMAA_ATTR_BUFFER) == DRMAA_ERRNO_SUCCESS) {
   drmaa_attr_values_t *values = NULL;

   drmaa_get_vector_attribute(jt, buffer, &values, error, DRMAA_ERROR_STRING_BUFFER);
   printf("%s = ", buffer);

   while (drmaa_get_next_attr_value(values, buffer, DRMAA_ATTR_BUFFER) == DRMAA_ERRNO_SUCCESS) {
      printf("%s\n", buffer);
   }

   drmaa_release_attr_values(values);
}

drmaa_release_attr_names(names);


and in Java 1.4 it would look like:

JobTemplate jt = ...;
List attrs = jt.getAttributeNames();
Iterator i = attrs.iterator();

while (i.hasNext()) {
   String name = (String)i.next();
   BeanDescriptor bean = new BeanDescriptor(jt.getClass());
   System.out.println(name + " = " + bean.getValue(name).toString());
}

That's all off the top of my head, so there's no guarantee that it work 
work or even compile, but it should get you pointed in the right direction.

Daniel

King, Stefan wrote:
>
> I want to print out a loaded drmaa job submission template right 
> before it gets fired.
>
> Does anyone have a little routine to do this already? 
>
>  
>
> Stefan
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at gridengine.sunsource.net
For additional commands, e-mail: users-help at gridengine.sunsource.net




More information about the gridengine-users mailing list