diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2021-04-26 08:55:36 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2021-04-26 08:55:36 +0200 |
commit | cc9f8a00c0a843fd6b50d09fc60cd32222732be8 (patch) | |
tree | 83baf9285dd576944e7cacf8febbae660fb79535 /drmaa | |
parent | 0d64ab8a41e500d46d61b1304d3734bbfd38bdf2 (diff) |
high: Try to use native specs on unsupported attributes.
* drmaa/v1/high.scm (lower-job-template): Use new
inner procedure implemented-attributes to check for unsupported
attributes; add native fallback for some Grid Engine attributes.
Diffstat (limited to 'drmaa')
-rw-r--r-- | drmaa/v1/high.scm | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/drmaa/v1/high.scm b/drmaa/v1/high.scm index 042f404..f3edda9 100644 --- a/drmaa/v1/high.scm +++ b/drmaa/v1/high.scm @@ -299,6 +299,13 @@ (define-method (lower-job-template (instance <job-template>)) (define klass (class-of instance)) + (define implemented-attributes + (let ((result #false)) + (lambda () + (or result + (begin + (set! result (low:get-attribute-names)) + result))))) (define t #false) (catch #true (lambda () @@ -321,7 +328,31 @@ ((pair? transformed) (apply low:set-vector-attribute! t drmaa transformed)) (else - (low:set-attribute! t drmaa transformed))))))) + (if (member drmaa (implemented-attributes)) + (low:set-attribute! t drmaa transformed) + ;; Use native specification if possible + (cond + ((and (grid-engine?) + (eq? drmaa (low:DRMAA 'DURATION_HLIMIT))) + (add-to-native-specification! t + (format #false "-h_rt ~a" transformed))) + ((and (grid-engine?) + (eq? drmaa (low:DRMAA 'DURATION_SLIMIT))) + (add-to-native-specification! t + (format #false "-s_rt ~a" transformed))) + ((and (grid-engine?) + (eq? drmaa (low:DRMAA 'WCT_HLIMIT))) + (add-to-native-specification! t + (format #false "-h_rt ~a" transformed))) + ((and (grid-engine?) + (eq? drmaa (low:DRMAA 'WCT_SLIMIT))) + (add-to-native-specification! t + (format #false "-s_rt ~a" transformed))) + (else + (raise (condition + (&formatted-message + (format "This DRMAA implementation does not support the attribute `~a'.~%") + (arguments (list drmaa)))))))))))))) (class-slots klass)) t) (lambda (key . args) |