From cc9f8a00c0a843fd6b50d09fc60cd32222732be8 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 26 Apr 2021 08:55:36 +0200 Subject: 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. --- drmaa/v1/high.scm | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) 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 )) (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) -- cgit v1.2.3