Skip to content
Snippets Groups Projects
Commit acdba3fa authored by Nicola Vigano's avatar Nicola Vigano
Browse files

OAR/Python: disable monitoring if oar modules cannot be imported properly

parent 27f19ce8
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,13 @@ import sys
import dct_io_xml
import dct_notification
from oar import oar_utils
try:
from oar import oar_utils
oar_available = True
except ImportError as exc:
dct_io_xml.DCTOutput.printWarning(exc)
print("Turning of OAR services")
oar_available = False
class DCTBatchConf(dct_io_xml.DCTXMLBase):
......@@ -168,6 +174,9 @@ class DCTBatch(object):
return functions
def monitor_array(self, array, delay = 10, timeout = None):
if oar_available is not True:
raise EnvironmentError("OAR service is not available!")
monitor = oar_utils.OARMonitorArray(array=array)
result = monitor.monitor(delay=delay, timeout=timeout)
if result is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment