JSV example for rewriting parallel environment requests

Posted by chris Tue, 22 Dec 2009 16:13:56 GMT

Job Submission Verifiers are expected to be a huge win for Grid Engine users and administrators but the feature is new enough that there is not a lot of best practices and working code "in the wild" that the community can copy and learn from ...

In this mailing list thread, however, we get an actual JSV code snippet showing how one might intercept user "-pe " requests and seamlessly alter the parallel environment request to one that makes use of the wildcard '*' selector:

In the latest SGE, you can use the JSV(1) mechanism to do arbitrary re-writes of the qsub options. I don't remember seeing real examples of this posted, so one that re-writes something like `-pe openmpi' to `-pe openmpi-*' to hide the fact that there are multiple PEs for nodes with different core counts, and you normally don't want the parallel job scheduled across such node groups.
  #!/bin/sh
  jsv_on_start() {
      return
  }
  jsv_on_verify() {
      pe=$(jsv_get_param pe_name)
      case "$pe" in
          openmpi | fluent)
          jsv_set_param pe_name "$pe-*"
          jsv_correct "Job was modified"
          ;;
      esac
      jsv_accept "Job OK"
      return
  }
  . ${SGE_ROOT}/util/resources/jsv/jsv_include.sh
  jsv_main