r5420 - in trunk: cumin/bin cumin/python/cumin sage/python/sage/aviary
tmckay at fedoraproject.org
tmckay at fedoraproject.org
Wed Jun 20 12:37:11 UTC 2012
Author: tmckay
Date: 2012-06-20 12:37:10 +0000 (Wed, 20 Jun 2012)
New Revision: 5420
Modified:
trunk/cumin/bin/cumin-web
trunk/cumin/python/cumin/config.py
trunk/cumin/python/cumin/main.py
trunk/sage/python/sage/aviary/aviaryoperations.py
Log:
By default, look for aviary wsdl files in /var/lib/condor/aviary/services before looking at the files bundled with Cumin. This helps avoid minor incompatibilities in wsdl versions.
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-06-19 00:23:53 UTC (rev 5419)
+++ trunk/cumin/bin/cumin-web 2012-06-20 12:37:10 UTC (rev 5420)
@@ -30,6 +30,9 @@
# For development use. Default is False. Undocumented.
cumin.aviary_suds_logs = values.aviary_suds_logs
+ # Defautl is True. Undocumented.
+ cumin.aviary_prefer_condor = values.aviary_prefer_condor
+
def set_wallaby_configs(cumin, values, brokers):
if values.wallaby_broker == "":
cumin.wallaby_broker = brokers[0]
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2012-06-19 00:23:53 UTC (rev 5419)
+++ trunk/cumin/python/cumin/config.py 2012-06-20 12:37:10 UTC (rev 5420)
@@ -186,12 +186,6 @@
param = ConfigParameter(self, "aviary-query-servers", str)
param.default = "http://localhost:9091"
- param = ConfigParameter(self, "server-cert", str)
- param.default = ""
-
- param = ConfigParameter(self, "server-key", str)
- param.default = ""
-
param = ConfigParameter(self, "aviary-locator", str)
param.default = ""
@@ -212,6 +206,21 @@
param = ConfigParameter(self, "aviary-suds-logs", bool)
param.default = False
+ # By default, Cumin will look for aviary wsdl files in
+ # /var/lib/condor/aviary/services before it looks to the
+ # wsdl files bundled with Cumin.
+ # If this flag is set to False, it will look at the files
+ # bundled with Cumin first.
+ # Undocumented.
+ param = ConfigParameter(self, "aviary-prefer-condor", bool)
+ param.default = True
+
+ param = ConfigParameter(self, "server-cert", str)
+ param.default = ""
+
+ param = ConfigParameter(self, "server-key", str)
+ param.default = ""
+
param = ConfigIntervalParameter(self, "update-interval")
param.default = 10
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2012-06-19 00:23:53 UTC (rev 5419)
+++ trunk/cumin/python/cumin/main.py 2012-06-20 12:37:10 UTC (rev 5420)
@@ -105,10 +105,11 @@
self.aviary_root_cert = ""
self.aviary_domain_verify=True
self.aviary_locator = ""
-
+
# For development use only
self.aviary_suds_logs = False
-
+ self.aviary_prefer_condor = True
+
self.wallaby = None
self.wallaby_broker = None
self.wallaby_refresh = 60
@@ -202,12 +203,19 @@
imports_ok = False
if imports_ok:
SudsLogging.set(self.aviary_suds_logs, self.home)
- aviary_dir = os.path.join(self.home, "rpc-defs/aviary")
- # The factory will choose an impl that gives us jobs, queries, or both
- # depending on whether job_servers and query_servers are empty strings.
- # If locator is non empty, their actual values will be overridden
- # but the presence of a value will stole control enable/disable.
+ # By default Cumin uses /var/lib/condor/aviary/services for
+ # aviary wsdl files if it exists.
+ aviary_dir = ["/var/lib/condor/aviary/services",
+ os.path.join(self.home, "rpc-defs/aviary")]
+ if not self.aviary_prefer_condor:
+ aviary_dir = [aviary_dir[1], aviary_dir[0]]
+
+ # The factory will choose an impl that gives us jobs, queries,
+ # or both depending on whether job_servers and query_servers
+ # are empty strings. If locator is non empty, their actual
+ # values will be overridden but the presence of a value will
+ # still control enable/disable.
aviary_itf = AviaryOperationsFactory("aviary", aviary_dir,
self.aviary_locator,
self.aviary_job_servers,
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2012-06-19 00:23:53 UTC (rev 5419)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2012-06-20 12:37:10 UTC (rev 5420)
@@ -224,7 +224,10 @@
"/services/job/",
"JOB")
- job_wsdl = "file:" + os.path.join(datadir, "aviary-job.wsdl")
+
+
+ job_wsdl = "file:" + os.path.join(self.get_datadir(datadir,"job"),
+ "aviary-job.wsdl")
self.job_client_pool = ClientPool(job_wsdl, None)
def set_job_attribute(self, scheduler, job_id, name, value, callback, submission):
@@ -411,7 +414,8 @@
"/services/query/",
"QUERY_SERVER")
- query_wsdl = "file:" + os.path.join(datadir, "aviary-query.wsdl")
+ query_wsdl = "file:" + os.path.join(self.get_datadir(datadir,"query"),
+ "aviary-query.wsdl")
self.query_client_pool = ClientPool(query_wsdl, None)
def fetch_job_data(self, job_server, job_id, ftype, file, start, end,
@@ -639,6 +643,23 @@
self.type_to_aviary = self._type_to_aviary()
self.aviary_to_type = self._aviary_to_type()
+ def get_datadir(self, datadir, subdir):
+ if not type(datadir) in (tuple, list):
+ datadir = [datadir]
+
+ # Find the first element in datadir that is a valid
+ # path. If the path has a subdirectory called
+ # "subdir", consider that part of the path.
+ for d in datadir:
+ if os.path.isdir(d):
+ s = os.path.join(d, subdir)
+ if os.path.isdir(s):
+ return s
+ return d
+ # Hmm, well, just return the first one since we're
+ # going to get an error anyway.
+ return datadir[0]
+
@classmethod
def _type_to_aviary(cls):
# Need to be able to turn simple Python types into Aviary types for attributes
More information about the cumin-developers
mailing list