r4876 - in trunk: cumin/python/cumin sage/python/sage sage/python/sage/qmf
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-18 16:29:58 +0000 (Mon, 18 Jul 2011)
New Revision: 4876
Added:
trunk/sage/python/sage/catalog.py
Removed:
trunk/sage/python/sage/remoteoperations.py
Modified:
trunk/cumin/python/cumin/main.py
trunk/sage/python/sage/qmf/qmfoperations.py
Log:
Change name of RemoteOperations to Catalog.
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-07-15 20:23:00 UTC (rev 4875)
+++ trunk/cumin/python/cumin/main.py 2011-07-18 16:29:58 UTC (rev 4876)
@@ -21,7 +21,7 @@
from user import *
from util import *
from widgets import *
-from sage.remoteoperations import RemoteOperations
+from sage.catalog import Catalog
from sage.qmf.qmfoperations import QmfOperations
from wooly import Session
from cumin.stat import PieChartPage
@@ -158,7 +158,7 @@
# Create RPC interfaces for QMF and aviary.
# Aviary takes precedence if added
- self.remote = RemoteOperations()
+ self.remote = Catalog()
ops = [QmfOperations("qmf", self.session)]
if self.use_aviary:
from sage.aviary.aviaryoperations import AviaryOperations
Copied: trunk/sage/python/sage/catalog.py (from rev 4875, trunk/sage/python/sage/remoteoperations.py)
===================================================================
--- trunk/sage/python/sage/catalog.py (rev 0)
+++ trunk/sage/python/sage/catalog.py 2011-07-18 16:29:58 UTC (rev 4876)
@@ -0,0 +1,56 @@
+class Catalog(object):
+ '''
+ Wrapper class that allows multiple interface classes to be grouped
+ together and referenced through a single object. Details of which
+ class provides the implementation of a method can be ignored by the
+ caller. See add_mechanisms comments below.
+ '''
+ def __init__(self):
+ self.mechanisms = []
+
+ def add_mechanisms(self, mechs):
+ '''
+ Add an item or items to the list of supported mechanisms.
+ A mechanism is expected to be an instance of a class containing
+ "public" methods that implement some interface.
+ When attribute access is done on an instance of Catalog,
+ the mechanism list is searched in order for a class which contains
+ a method of the given name (assuming the attribute is not contained
+ directly in the Catalog instance itself). This allows methods
+ on mechanism objects to be called as if they are attributes of
+ Catalog, without the caller having knowledge of which mechanism
+ ultimately provides the method.
+ If a mechanism object has an attribute called 'name', a reference to the
+ object is added as an attribute of Catalog named 'name'. This
+ allows a specific mechamism to be used if desired (for example,
+ the hold_job method might be invoked as catalog.qmf.hold_job(), ensuring
+ that the QMF version is used, rather than catalog.hold_job() which will
+ use the first hold_job method located in the mechanism list).
+ '''
+
+ # Allow mechanism to be specifially chosen by name
+ # rather than determined by precedence order
+ # catalog.qmf.Op() vs catalog.Op(), for example
+ def make_mech_attr(m):
+ if hasattr(m, "name"):
+ setattr(self, m.name, m)
+
+ if type(mechs) in (tuple, list):
+ for m in mechs:
+ self.mechanisms.append(m)
+ make_mech_attr(m)
+ else:
+ self.mechanisms.append(mechs)
+ make_mech_attr(mechs)
+
+ def __getattr__(self, name):
+ # Reminder, __getattr__ is called when an attribute
+ # cannot be found in the object.
+ for m in self.mechanisms:
+ if hasattr(m, name):
+ a = getattr(m, name)
+ if callable(a):
+ return a
+ raise AttributeError("No mechanism has callable %s" % name)
+
+
Modified: trunk/sage/python/sage/qmf/qmfoperations.py
===================================================================
--- trunk/sage/python/sage/qmf/qmfoperations.py 2011-07-15 20:23:00 UTC (rev 4875)
+++ trunk/sage/python/sage/qmf/qmfoperations.py 2011-07-18 16:29:58 UTC (rev 4876)
@@ -22,7 +22,7 @@
def __init__(self, name, session):
'''
- If this object is added to a RemoteOperations object as a mechanism,
+ If this object is added to a Catalog object as a mechanism,
the 'name' parameter will be used to create an attribute which points
to this object.
The 'session' parameter is expected to be an object that defines the
Deleted: trunk/sage/python/sage/remoteoperations.py
===================================================================
--- trunk/sage/python/sage/remoteoperations.py 2011-07-15 20:23:00 UTC (rev 4875)
+++ trunk/sage/python/sage/remoteoperations.py 2011-07-18 16:29:58 UTC (rev 4876)
@@ -1,51 +0,0 @@
-class RemoteOperations(object):
-
- def __init__(self):
- self.mechanisms = []
-
- def add_mechanisms(self, mechs):
- '''
- Add an item or items to the list of supported mechanisms.
- A mechanism is expected to be an instance of a class containing
- methods that implement remote procedure calls.
- When attribute access is done on an instance of RemoteOperations,
- the mechanism list is searched in order for a class which contains
- a method of the given name (assuming the attribute is not contained
- directly in the RemoteOperations instance itself). This allows methods
- on mechanism objects to be called as if they are attributes of
- RemoteOperations, without the caller having knowledge of which mechanism
- ultimately provides the method.
- If a mechanism object has an attribute called 'name', a reference to the
- object is added as an attribute of RemoteOperations named 'name'. This
- allows a specific mechamism to be used if desired (for example,
- the hold_job method might be invoked as remote.qmf.hold_job(), ensuring
- that the QMF version is used, rather than remote.hold_job() which will
- use the first hold_job method located in the mechanism list).
- '''
-
- # Allow mechanism to be specifially chosen by name
- # rather than determined by precedence order
- # remote.qmf.Op() vs remote.Op(), for example
- def make_mech_attr(m):
- if hasattr(m, "name"):
- setattr(self, m.name, m)
-
- if type(mechs) in (tuple, list):
- for m in mechs:
- self.mechanisms.append(m)
- make_mech_attr(m)
- else:
- self.mechanisms.append(mechs)
- make_mech_attr(mechs)
-
- def __getattr__(self, name):
- # Reminder, __getattr__ is called when an attribute
- # cannot be found in the object.
- for m in self.mechanisms:
- if hasattr(m, name):
- a = getattr(m, name)
- if callable(a):
- return a
- raise AttributeError("No mechanism has callable %s" % name)
-
-
12 years, 9 months
r4875 - trunk/sage/rpc-defs/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-15 20:23:00 +0000 (Fri, 15 Jul 2011)
New Revision: 4875
Removed:
trunk/sage/rpc-defs/aviary/axis2.xml
trunk/sage/rpc-defs/aviary/axis2.xml.in
Log:
Don't believe the client needs the axis2 files...
Deleted: trunk/sage/rpc-defs/aviary/axis2.xml
===================================================================
--- trunk/sage/rpc-defs/aviary/axis2.xml 2011-07-15 20:01:36 UTC (rev 4874)
+++ trunk/sage/rpc-defs/aviary/axis2.xml 2011-07-15 20:23:00 UTC (rev 4875)
@@ -1,102 +0,0 @@
-<!--
-/*
- * Copyright 2000-2011 Red Hat, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<!-- Aviary-specific axis2.xml -->
-<axisconfig name="Axis2/C">
- <!-- ================================================= -->
- <!-- Parameters -->
- <!-- ================================================= -->
- <parameter name="libDir">/usr/lib64</parameter>
- <parameter name="servicesDir">/var/lib/condor/aviary/services</parameter>
- <parameter name="enableREST" locked="false">true</parameter>
- <parameter name="persistOperationContext" locked="false">true</parameter>
-
- <!-- ================================================= -->
- <!-- Transport Ins -->
- <!-- ================================================= -->
- <transportReceiver name="http" class="libaxis2_http_receiver.so.0">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver>
-
- <!-- applies to Axis2/C clients only -->
- <transportReceiver name="https" class="libaxis2_http_receiver.so.0">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver>
- <!--transportReceiver name="tcp" class="axis2_tcp_receiver"-->
- <!--parameter name="port" locked="false">6060</parameter-->
- <!--/transportReceiver-->
-
- <!-- ================================================= -->
- <!-- Transport Outs -->
- <!-- ================================================= -->
-
- <transportSender name="http" class="libaxis2_http_sender.so.0">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="xml-declaration" insert="false"/>
- <!--parameter name="Transfer-Encoding">chunked</parameter-->
- <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
- </transportSender>
-
- <!-- applies to Axis2/C clients only -->
- <transportSender name="https" class="libaxis2_http_sender.so.0">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="xml-declaration" insert="false"/>
- </transportSender>
-
- <!-- ================================================= -->
- <!-- SSL -->
- <!-- ================================================= -->
- <!-- NOTE: server-side SSL support currently unavailable for aviary components -->
- <!-- alternatives include the use of a SSL-enabled proxy server such as squid; -->
- <!-- the following settings would apply to Axis2/C clients only if enabled -->
- <!-- set the server's SSL certificate here -->
- <!--parameter name="SERVER_CERT">/path/to/ca/certificate</parameter-->
- <!-- set the client's SSL key file and passphrase here for client auth -->
- <!--parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter-->
- <!--parameter name="SSL_PASSPHRASE">passphrase</parameter-->
-
- <!-- ================================================= -->
- <!-- Phases -->
- <!-- ================================================= -->
- <phaseOrder type="inflow">
- <!-- System pre defined phases -->
- <phase name="Transport"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch"/>
- <phase name="PostDispatch"/>
- <!-- End system pre defined phases -->
- <!-- After PostDispatch phase, module or service author can add any phase as required -->
- <!-- User defined phases could be added here -->
- <phase name="Security"/>
- <phase name="Rahas"/>
- </phaseOrder>
- <phaseOrder type="outflow">
- <!-- User defined phases could be added here -->
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
- <phaseOrder type="INfaultflow">
- <!-- User defined phases could be added here -->
- <!--phase name="userphase1"/-->
- </phaseOrder>
- <phaseOrder type="Outfaultflow">
- <!-- User defined phases could be added here -->
- <!--phase name="userphase1"/-->
- <phase name="MessageOut"/>
- </phaseOrder>
-</axisconfig>
Deleted: trunk/sage/rpc-defs/aviary/axis2.xml.in
===================================================================
--- trunk/sage/rpc-defs/aviary/axis2.xml.in 2011-07-15 20:01:36 UTC (rev 4874)
+++ trunk/sage/rpc-defs/aviary/axis2.xml.in 2011-07-15 20:23:00 UTC (rev 4875)
@@ -1,102 +0,0 @@
-<!--
-/*
- * Copyright 2000-2011 Red Hat, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<!-- Aviary-specific axis2.xml -->
-<axisconfig name="Axis2/C">
- <!-- ================================================= -->
- <!-- Parameters -->
- <!-- ================================================= -->
- <parameter name="libDir">@WS02_LIB_ROOT@</parameter>
- <parameter name="servicesDir">/var/lib/condor/aviary/services</parameter>
- <parameter name="enableREST" locked="false">true</parameter>
- <parameter name="persistOperationContext" locked="false">true</parameter>
-
- <!-- ================================================= -->
- <!-- Transport Ins -->
- <!-- ================================================= -->
- <transportReceiver name="http" class="libaxis2_http_receiver.so.0">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver>
-
- <!-- applies to Axis2/C clients only -->
- <transportReceiver name="https" class="libaxis2_http_receiver.so.0">
- <parameter name="port" locked="false">6060</parameter>
- </transportReceiver>
- <!--transportReceiver name="tcp" class="axis2_tcp_receiver"-->
- <!--parameter name="port" locked="false">6060</parameter-->
- <!--/transportReceiver-->
-
- <!-- ================================================= -->
- <!-- Transport Outs -->
- <!-- ================================================= -->
-
- <transportSender name="http" class="libaxis2_http_sender.so.0">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="xml-declaration" insert="false"/>
- <!--parameter name="Transfer-Encoding">chunked</parameter-->
- <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
- </transportSender>
-
- <!-- applies to Axis2/C clients only -->
- <transportSender name="https" class="libaxis2_http_sender.so.0">
- <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
- <parameter name="xml-declaration" insert="false"/>
- </transportSender>
-
- <!-- ================================================= -->
- <!-- SSL -->
- <!-- ================================================= -->
- <!-- NOTE: server-side SSL support currently unavailable for aviary components -->
- <!-- alternatives include the use of a SSL-enabled proxy server such as squid; -->
- <!-- the following settings would apply to Axis2/C clients only if enabled -->
- <!-- set the server's SSL certificate here -->
- <!--parameter name="SERVER_CERT">/path/to/ca/certificate</parameter-->
- <!-- set the client's SSL key file and passphrase here for client auth -->
- <!--parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter-->
- <!--parameter name="SSL_PASSPHRASE">passphrase</parameter-->
-
- <!-- ================================================= -->
- <!-- Phases -->
- <!-- ================================================= -->
- <phaseOrder type="inflow">
- <!-- System pre defined phases -->
- <phase name="Transport"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch"/>
- <phase name="PostDispatch"/>
- <!-- End system pre defined phases -->
- <!-- After PostDispatch phase, module or service author can add any phase as required -->
- <!-- User defined phases could be added here -->
- <phase name="Security"/>
- <phase name="Rahas"/>
- </phaseOrder>
- <phaseOrder type="outflow">
- <!-- User defined phases could be added here -->
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
- <phaseOrder type="INfaultflow">
- <!-- User defined phases could be added here -->
- <!--phase name="userphase1"/-->
- </phaseOrder>
- <phaseOrder type="Outfaultflow">
- <!-- User defined phases could be added here -->
- <!--phase name="userphase1"/-->
- <phase name="MessageOut"/>
- </phaseOrder>
-</axisconfig>
12 years, 9 months
r4874 - trunk/sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-15 20:01:36 +0000 (Fri, 15 Jul 2011)
New Revision: 4874
Modified:
trunk/sage/python/sage/aviary/aviaryoperations.py
Log:
Fix bugs in OverridesPlugin
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2011-07-15 18:06:32 UTC (rev 4873)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2011-07-15 20:01:36 UTC (rev 4874)
@@ -288,8 +288,6 @@
to the suds message after marshalling.
'''
def __init__(self):
- super(OverridesPlugin, self).__init__()
-
self.allow = False
def marshalled(self, context):
@@ -309,7 +307,7 @@
def __init__(self, *args):
self.override = OverridesPlugin()
try:
- super(OverrideClient, self).__init__(*args, plugins=[self.override])
+ super(OverrideClient, self).__init__(plugins=[self.override], *args)
except:
super(OverrideClient, self).__init__(*args)
12 years, 9 months
r4873 - in trunk: cumin cumin/python/cumin sage/python/sage/aviary sage/python/sage/qmf
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-15 18:06:32 +0000 (Fri, 15 Jul 2011)
New Revision: 4873
Modified:
trunk/cumin/Makefile
trunk/cumin/python/cumin/config.py
trunk/sage/python/sage/aviary/aviaryoperations.py
trunk/sage/python/sage/qmf/qmfoperations.py
Log:
Tweak logging set up for sage, make file for install
Modified: trunk/cumin/Makefile
===================================================================
--- trunk/cumin/Makefile 2011-07-14 21:10:14 UTC (rev 4872)
+++ trunk/cumin/Makefile 2011-07-15 18:06:32 UTC (rev 4873)
@@ -34,6 +34,8 @@
install -pm 0644 etc/cumin.* ${CUMIN_HOME}/etc
install -pm 0755 etc/sysvinit-cumin ${CUMIN_HOME}/etc
install -d ${CUMIN_HOME}/log
+ install -d ${CUMIN_HOME}/rpc-defs/aviary
+ install -pm 0644 ../sage/rpc-defs/aviary/* ${CUMIN_HOME}/rpc-defs/aviary
bin/install-python-code python ${CUMIN_HOME}/python
bin/install-python-code ../wooly/python ${CUMIN_HOME}/python
bin/install-python-code ../rosemary/python ${CUMIN_HOME}/python
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2011-07-14 21:10:14 UTC (rev 4872)
+++ trunk/cumin/python/cumin/config.py 2011-07-15 18:06:32 UTC (rev 4873)
@@ -220,7 +220,7 @@
#
# # start your business
-_logging_modules = "cumin", "mint", "parsley", "rosemary", "wooly, sage"
+_logging_modules = "cumin", "mint", "parsley", "rosemary", "wooly", "sage"
def setup_initial_logging():
for name in _logging_modules:
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2011-07-14 21:10:14 UTC (rev 4872)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2011-07-15 18:06:32 UTC (rev 4873)
@@ -6,6 +6,8 @@
import threading
import logging
+log = logging.getLogger("sage.aviary")
+
#f = open("./suds.client.log", 'a+')
#h = logging.StreamHandler(f)
#logging.getLogger('suds.client').setLevel(logging.DEBUG)
Modified: trunk/sage/python/sage/qmf/qmfoperations.py
===================================================================
--- trunk/sage/python/sage/qmf/qmfoperations.py 2011-07-14 21:10:14 UTC (rev 4872)
+++ trunk/sage/python/sage/qmf/qmfoperations.py 2011-07-15 18:06:32 UTC (rev 4873)
@@ -1,7 +1,7 @@
import logging
from sage.util import CallSync, wait
-log = logging.getLogger("sage.remoteoperations")
+log = logging.getLogger("sage.qmf")
class QmfOperations(object):
'''
@@ -163,6 +163,7 @@
# Secret private implementation stuff, don't look!
def _call(self, obj, meth, cb, dflt, tout, *args):
+
if cb:
self.session.call_method(cb, obj, meth, args)
else:
12 years, 9 months
r4872 - trunk/sage
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-14 21:10:14 +0000 (Thu, 14 Jul 2011)
New Revision: 4872
Modified:
trunk/sage/Makefile
Log:
Fix up local install in sage Makefile
Modified: trunk/sage/Makefile
===================================================================
--- trunk/sage/Makefile 2011-07-14 20:28:37 UTC (rev 4871)
+++ trunk/sage/Makefile 2011-07-14 21:10:14 UTC (rev 4872)
@@ -3,9 +3,7 @@
include ../etc/Makefile.common
name := sage
-
lib := ${PYTHON_LIB_DIR}/${name}
-etc := ${ETC_DIR}/${name}
doc := ${DOC_DIR}/${name}
share := ${SHARE_DIR}/${name}
@@ -15,6 +13,12 @@
install: build
install -d ${lib}
install python/sage/*.py python/sage/*.pyc ${lib}
+ install -d ${lib}/aviary
+ install python/sage/aviary/*.py python/sage/aviary/*.pyc ${lib}/aviary
+ install -d ${lib}/qmf
+ install python/sage/qmf/*.py python/sage/qmf/*.pyc ${lib}/qmf
+ install -d ${share}/rpc-defs/aviary
+ install rpc-defs/aviary/*.xsd rpc-defs/aviary/*.wsdl rpc-defs/aviary/*.xml rpc-defs/aviary/*.xml.* ${share}/rpc-defs/aviary
install -d ${doc}
install LICENSE COPYING ${doc}
12 years, 9 months
r4871 - in trunk/sage: . rpc-defs rpc-defs/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-14 20:28:37 +0000 (Thu, 14 Jul 2011)
New Revision: 4871
Added:
trunk/sage/rpc-defs/
trunk/sage/rpc-defs/aviary/
trunk/sage/rpc-defs/aviary/aviary-common.xsd
trunk/sage/rpc-defs/aviary/aviary-job.wsdl
trunk/sage/rpc-defs/aviary/aviary-job.xsd
trunk/sage/rpc-defs/aviary/aviary-query.wsdl
trunk/sage/rpc-defs/aviary/aviary-query.xsd
trunk/sage/rpc-defs/aviary/axis2.xml
trunk/sage/rpc-defs/aviary/axis2.xml.in
Log:
Forgot to add the aviary interface definitions
Added: trunk/sage/rpc-defs/aviary/aviary-common.xsd
===================================================================
--- trunk/sage/rpc-defs/aviary/aviary-common.xsd (rev 0)
+++ trunk/sage/rpc-defs/aviary/aviary-common.xsd 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://common.aviary.grid.redhat.com" targetNamespace="http://common.aviary.grid.redhat.com">
+ <!-- common types should make use of simple and complex types for reuse -->
+ <xs:simpleType name="StatusCodeType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="OK"/>
+ <xs:enumeration value="FAIL"/>
+ <xs:enumeration value="NO_MATCH"/>
+ <xs:enumeration value="INVALID_OFFSET"/>
+ <xs:enumeration value="UNIMPLEMENTED"/>
+ <xs:enumeration value="UNAVAILABLE"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="Status">
+ <xs:sequence>
+ <xs:element name="code" type="tns:StatusCodeType"/>
+ <xs:element name="text" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="AttributeType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="INTEGER"/>
+ <xs:enumeration value="FLOAT"/>
+ <xs:enumeration value="STRING"/>
+ <xs:enumeration value="EXPRESSION"/>
+ <xs:enumeration value="BOOLEAN"/>
+ <xs:enumeration value="UNDEFINED"/>
+ <xs:enumeration value="ERROR"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="Attribute">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="type" type="tns:AttributeType"/>
+ <xs:element name="value" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <!-- might just want to use the following just for returning data like in getJobDetails -->
+ <xs:complexType name="Attributes">
+ <xs:sequence>
+ <xs:element name="attrs" type="tns:Attribute" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="OSType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="LINUX"/>
+ <xs:enumeration value="WINDOWS"/>
+ <!-- can expand later -->
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ArchType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="INTEL"/>
+ <xs:enumeration value="X86_64"/>
+ <!-- can expand later -->
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:simpleType name="ResourceConstraintType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="OS"/>
+ <xs:enumeration value="ARCH"/>
+ <xs:enumeration value="MEMORY"/>
+ <xs:enumeration value="DISK"/>
+ <xs:enumeration value="FILESYSTEM"/>
+ <!-- when we say MEMORY or DISK we always mean at least the amount provided -->
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="ResourceConstraint">
+ <xs:sequence>
+ <xs:element name="type" type="tns:ResourceConstraintType"/>
+ <xs:element name="value" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="JobConstraintType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="CMD"/>
+ <xs:enumeration value="ARGS"/>
+ <xs:enumeration value="OWNER"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="JobConstraint">
+ <xs:sequence>
+ <xs:element name="type" type="tns:JobConstraintType"/>
+ <xs:element name="value" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="SubmissionID">
+ <xs:sequence>
+ <xs:element name="name" type="xs:string" minOccurs="0"/>
+ <xs:element name="owner" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="JobID">
+ <xs:sequence>
+ <xs:element name="job" type="xs:string"/>
+ <xs:element name="pool" type="xs:string" minOccurs="0"/>
+ <xs:element name="scheduler" type="xs:string" minOccurs="0"/>
+ <xs:element name="submission" type="tns:SubmissionID" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="JobStatusType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="IDLE"/>
+ <xs:enumeration value="RUNNING"/>
+ <xs:enumeration value="REMOVED"/>
+ <xs:enumeration value="COMPLETED"/>
+ <xs:enumeration value="HELD"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <!-- reuse through extension not available for the following related types -->
+ <xs:complexType name="JobStatus">
+ <xs:sequence>
+ <xs:element name="id" type="tns:JobID"/>
+ <xs:element name="status" type="tns:Status"/>
+ <xs:element name="job_status" type="tns:JobStatusType" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="JobSummary">
+ <xs:sequence>
+ <xs:element name="id" type="tns:JobID"/>
+ <xs:element name="status" type="tns:Status"/>
+ <xs:element name="queued" type="xs:dateTime"/>
+ <xs:element name="last_update" type="xs:dateTime"/>
+ <xs:element name="job_status" type="tns:JobStatusType"/>
+ <xs:element name="cmd" type="xs:string"/>
+ <xs:element name="args1" type="xs:string" minOccurs="0"/>
+ <xs:element name="args2" type="xs:string" minOccurs="0"/>
+ <xs:element name="held" type="xs:string" minOccurs="0"/>
+ <xs:element name="released" type="xs:string" minOccurs="0"/>
+ <xs:element name="removed" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="SubmissionSummary">
+ <xs:sequence>
+ <xs:element name="id" type="tns:SubmissionID"/>
+ <xs:element name="status" type="tns:Status"/>
+ <xs:element name="completed" type="xs:int"/>
+ <xs:element name="held" type="xs:int"/>
+ <xs:element name="idle" type="xs:int"/>
+ <xs:element name="removed" type="xs:int"/>
+ <xs:element name="running" type="xs:int"/>
+ <xs:element name="jobs" type="tns:JobSummary" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="JobDetails">
+ <xs:sequence>
+ <xs:element name="id" type="tns:JobID"/>
+ <xs:element name="status" type="tns:Status"/>
+ <xs:element name="details" type="tns:Attributes" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="JobDataType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="ERR"/>
+ <xs:enumeration value="LOG"/>
+ <xs:enumeration value="OUT"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="JobData">
+ <xs:sequence>
+ <xs:element name="id" type="tns:JobID"/>
+ <xs:element name="type" type="tns:JobDataType"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:simpleType name="ResourceType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="COLLECTOR"/>
+ <xs:enumeration value="EXECUTOR"/>
+ <xs:enumeration value="EVENT_SERVER"/>
+ <xs:enumeration value="JOB_SERVER"/>
+ <xs:enumeration value="LOW_LATENCY"/>
+ <xs:enumeration value="MASTER"/>
+ <xs:enumeration value="NEGOTIATOR"/>
+ <xs:enumeration value="SCHEDULER"/>
+ <xs:enumeration value="CUSTOM"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="ResourceID">
+ <xs:sequence>
+ <xs:element name="subsystem_type" type="tns:ResourceType"/>
+ <xs:element name="pool" type="xs:string"/>
+ <xs:element name="name" type="xs:string"/>
+ <xs:element name="custom_name" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
Added: trunk/sage/rpc-defs/aviary/aviary-job.wsdl
===================================================================
--- trunk/sage/rpc-defs/aviary/aviary-job.wsdl (rev 0)
+++ trunk/sage/rpc-defs/aviary/aviary-job.wsdl 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://grid.redhat.com/aviary-job/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:job="http://job.aviary.grid.redhat.com" xmlns:ns="http://common.aviary.grid.redhat.com" targetNamespace="http://grid.redhat.com/aviary-job/" name="aviary-job">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://grid.redhat.com/aviary-job/">
+ <xsd:import schemaLocation="aviary-job.xsd" namespace="http://job.aviary.grid.redhat.com"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="SubmitJobRequest">
+ <wsdl:part name="parameters" element="job:SubmitJob"/>
+ </wsdl:message>
+ <wsdl:message name="SubmitJobResponse">
+ <wsdl:part name="parameters" element="job:SubmitJobResponse"/>
+ </wsdl:message>
+ <wsdl:message name="HoldJobRequest">
+ <wsdl:part name="parameters" element="job:HoldJob"/>
+ </wsdl:message>
+ <wsdl:message name="HoldJobResponse">
+ <wsdl:part name="parameters" element="job:HoldJobResponse"/>
+ </wsdl:message>
+ <wsdl:message name="ReleaseJobRequest">
+ <wsdl:part name="parameters" element="job:ReleaseJob"/>
+ </wsdl:message>
+ <wsdl:message name="ReleaseJobResponse">
+ <wsdl:part name="parameters" element="job:ReleaseJobResponse"/>
+ </wsdl:message>
+ <wsdl:message name="RemoveJobRequest">
+ <wsdl:part name="parameters" element="job:RemoveJob"/>
+ </wsdl:message>
+ <wsdl:message name="RemoveJobResponse">
+ <wsdl:part name="parameters" element="job:RemoveJobResponse"/>
+ </wsdl:message>
+ <wsdl:message name="SetJobAttributeRequest">
+ <wsdl:part name="parameters" element="job:SetJobAttribute"/>
+ </wsdl:message>
+ <wsdl:message name="SetJobAttributeResponse">
+ <wsdl:part name="parameters" element="job:SetJobAttributeResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AviaryJob">
+ <wsdl:operation name="submitJob">
+ <wsdl:input message="tns:SubmitJobRequest"/>
+ <wsdl:output message="tns:SubmitJobResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="holdJob">
+ <wsdl:input message="tns:HoldJobRequest"/>
+ <wsdl:output message="tns:HoldJobResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="releaseJob">
+ <wsdl:input message="tns:ReleaseJobRequest"/>
+ <wsdl:output message="tns:ReleaseJobResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="removeJob">
+ <wsdl:input message="tns:RemoveJobRequest"/>
+ <wsdl:output message="tns:RemoveJobResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="setJobAttribute">
+ <wsdl:input message="tns:SetJobAttributeRequest"/>
+ <wsdl:output message="tns:SetJobAttributeResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AviaryJobSOAPBinding" type="tns:AviaryJob">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="submitJob">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-job/submit"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="holdJob">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-job/hold"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="releaseJob">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-job/release"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="removeJob">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-job/remove"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="setJobAttribute">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-job/set-attr"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AviaryJobService">
+ <wsdl:port name="AviaryJobSOAPPort" binding="tns:AviaryJobSOAPBinding">
+ <soap:address location="http://localhost"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/sage/rpc-defs/aviary/aviary-job.xsd
===================================================================
--- trunk/sage/rpc-defs/aviary/aviary-job.xsd (rev 0)
+++ trunk/sage/rpc-defs/aviary/aviary-job.xsd 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:job="http://job.aviary.grid.redhat.com" xmlns:mrg="http://common.aviary.grid.redhat.com" targetNamespace="http://job.aviary.grid.redhat.com">
+ <xs:import namespace="http://common.aviary.grid.redhat.com" schemaLocation="aviary-common.xsd"/>
+ <!-- declare message-level elements using anonymous complex types for simpler generated types -->
+ <xs:element name="SubmitJob">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="cmd" type="xs:string"/>
+ <xs:element name="args" type="xs:string" minOccurs="0"/>
+ <xs:element name="owner" type="xs:string"/>
+ <xs:element name="iwd" type="xs:string"/>
+ <xs:element name="submission_name" type="xs:string" minOccurs="0"/>
+ <xs:element name="requirements" type="mrg:ResourceConstraint" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="extra" type="mrg:Attribute" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="allowOverrides" type="xs:boolean" default="false"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SubmitJobResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="mrg:JobID" minOccurs="0"/>
+ <xs:element name="status" type="mrg:Status"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="ControlJob">
+ <xs:sequence>
+ <xs:element name="id" type="mrg:JobID"/>
+ <xs:element name="reason" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="ControlJobResponse">
+ <xs:sequence>
+ <xs:element name="status" type="mrg:Status"/>
+ </xs:sequence>
+ </xs:complexType>
+ <!-- these all follow the same type pattern so reuse -->
+ <xs:element name="HoldJob" type="job:ControlJob"/>
+ <xs:element name="HoldJobResponse" type="job:ControlJobResponse"/>
+ <xs:element name="ReleaseJob" type="job:ControlJob"/>
+ <xs:element name="ReleaseJobResponse" type="job:ControlJobResponse"/>
+ <xs:element name="RemoveJob" type="job:ControlJob"/>
+ <xs:element name="RemoveJobResponse" type="job:ControlJobResponse"/>
+ <xs:element name="SetJobAttribute">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="id" type="mrg:JobID"/>
+ <xs:element name="attribute" type="mrg:Attribute"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="SetJobAttributeResponse" type="job:ControlJobResponse"/>
+</xs:schema>
Added: trunk/sage/rpc-defs/aviary/aviary-query.wsdl
===================================================================
--- trunk/sage/rpc-defs/aviary/aviary-query.wsdl (rev 0)
+++ trunk/sage/rpc-defs/aviary/aviary-query.wsdl 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://grid.redhat.com/aviary-query/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:qry="http://query.aviary.grid.redhat.com" xmlns:ns="http://common.aviary.grid.redhat.com" targetNamespace="http://grid.redhat.com/aviary-query/" name="aviary-query">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://grid.redhat.com/aviary-query/">
+ <xsd:import schemaLocation="aviary-query.xsd" namespace="http://query.aviary.grid.redhat.com"/>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="GetJobSummaryRequest">
+ <wsdl:part name="parameters" element="qry:GetJobSummary"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobSummaryResponse">
+ <wsdl:part name="parameters" element="qry:GetJobSummaryResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobStatusRequest">
+ <wsdl:part name="parameters" element="qry:GetJobStatus"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobStatusResponse">
+ <wsdl:part name="parameters" element="qry:GetJobStatusResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobDetailsRequest">
+ <wsdl:part name="parameters" element="qry:GetJobDetails"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobDetailsResponse">
+ <wsdl:part name="parameters" element="qry:GetJobDetailsResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobDataRequest">
+ <wsdl:part name="parameters" element="qry:GetJobData"/>
+ </wsdl:message>
+ <wsdl:message name="GetJobDataResponse">
+ <wsdl:part name="parameters" element="qry:GetJobDataResponse"/>
+ </wsdl:message>
+ <wsdl:message name="GetSubmissionSummaryRequest">
+ <wsdl:part name="parameters" element="qry:GetSubmissionSummary"/>
+ </wsdl:message>
+ <wsdl:message name="GetSubmissionSummaryResponse">
+ <wsdl:part name="parameters" element="qry:GetSubmissionSummaryResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AviaryQuery">
+ <wsdl:operation name="getJobSummary">
+ <wsdl:input message="tns:GetJobSummaryRequest"/>
+ <wsdl:output message="tns:GetJobSummaryResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getJobStatus">
+ <wsdl:input message="tns:GetJobStatusRequest"/>
+ <wsdl:output message="tns:GetJobStatusResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getJobDetails">
+ <wsdl:input message="tns:GetJobDetailsRequest"/>
+ <wsdl:output message="tns:GetJobDetailsResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getJobData">
+ <wsdl:input message="tns:GetJobDataRequest"/>
+ <wsdl:output message="tns:GetJobDataResponse"/>
+ </wsdl:operation>
+ <wsdl:operation name="getSubmissionSummary">
+ <wsdl:input message="tns:GetSubmissionSummaryRequest"/>
+ <wsdl:output message="tns:GetSubmissionSummaryResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AviaryQuerySOAPBinding" type="tns:AviaryQuery">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getJobSummary">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-query/job/summary"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getJobStatus">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-query/job/status"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getJobDetails">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-query/job/details"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getJobData">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-query/job/data"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getSubmissionSummary">
+ <soap:operation soapAction="http://grid.redhat.com/aviary-query/job/submission"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AviaryQueryService">
+ <wsdl:port name="AviaryQuerySOAPPort" binding="tns:AviaryQuerySOAPBinding">
+ <soap:address location="http://localhost"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: trunk/sage/rpc-defs/aviary/aviary-query.xsd
===================================================================
--- trunk/sage/rpc-defs/aviary/aviary-query.xsd (rev 0)
+++ trunk/sage/rpc-defs/aviary/aviary-query.xsd 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:qry="http://query.aviary.grid.redhat.com" xmlns:mrg="http://common.aviary.grid.redhat.com" targetNamespace="http://query.aviary.grid.redhat.com">
+ <xs:import namespace="http://common.aviary.grid.redhat.com" schemaLocation="aviary-common.xsd"/>
+
+ <!-- declare message-level elements using anonymous complex types for simpler generated types -->
+ <!-- use of refs, inheritance into anonymous types, etc. eschewed for simplicity and interop -->
+ <xs:element name="GetJobSummary">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ids" type="mrg:JobID" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="partialMatches" type="xs:boolean" default="true"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobSummaryResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="jobs" type="mrg:JobSummary" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobStatus">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ids" type="mrg:JobID" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="partialMatches" type="xs:boolean" default="true"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobStatusResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="jobs" type="mrg:JobStatus" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobDetails">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ids" type="mrg:JobID" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="partialMatches" type="xs:boolean" default="true"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobDetailsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="jobs" type="mrg:JobDetails" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobData">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="data" type="mrg:JobData"/>
+ <xs:element name="max_bytes" type="xs:integer" default="1024"/>
+ <xs:element name="from_end" type="xs:boolean" minOccurs="0" default="false"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetJobDataResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="data" type="mrg:JobData"/>
+ <xs:element name="status" type="mrg:Status"/>
+ <xs:element name="file_name" type="xs:string" minOccurs="0"/>
+ <xs:element name="file_size" type="xs:integer" minOccurs="0"/>
+ <!-- string for file content...we probably want to keep line feeds, etc. TODO: need to revisit this-->
+ <xs:element name="content" type="xs:string" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetSubmissionSummary">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="ids" type="mrg:SubmissionID" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="partialMatches" type="xs:boolean" default="true"/>
+ <xs:attribute name="includeJobSummaries" type="xs:boolean" default="false"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="GetSubmissionSummaryResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="submissions" type="mrg:SubmissionSummary" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
Added: trunk/sage/rpc-defs/aviary/axis2.xml
===================================================================
--- trunk/sage/rpc-defs/aviary/axis2.xml (rev 0)
+++ trunk/sage/rpc-defs/aviary/axis2.xml 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,102 @@
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<!-- Aviary-specific axis2.xml -->
+<axisconfig name="Axis2/C">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="libDir">/usr/lib64</parameter>
+ <parameter name="servicesDir">/var/lib/condor/aviary/services</parameter>
+ <parameter name="enableREST" locked="false">true</parameter>
+ <parameter name="persistOperationContext" locked="false">true</parameter>
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="libaxis2_http_receiver.so.0">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- applies to Axis2/C clients only -->
+ <transportReceiver name="https" class="libaxis2_http_receiver.so.0">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+ <!--transportReceiver name="tcp" class="axis2_tcp_receiver"-->
+ <!--parameter name="port" locked="false">6060</parameter-->
+ <!--/transportReceiver-->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="http" class="libaxis2_http_sender.so.0">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ <!--parameter name="Transfer-Encoding">chunked</parameter-->
+ <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
+ </transportSender>
+
+ <!-- applies to Axis2/C clients only -->
+ <transportSender name="https" class="libaxis2_http_sender.so.0">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ </transportSender>
+
+ <!-- ================================================= -->
+ <!-- SSL -->
+ <!-- ================================================= -->
+ <!-- NOTE: server-side SSL support currently unavailable for aviary components -->
+ <!-- alternatives include the use of a SSL-enabled proxy server such as squid; -->
+ <!-- the following settings would apply to Axis2/C clients only if enabled -->
+ <!-- set the server's SSL certificate here -->
+ <!--parameter name="SERVER_CERT">/path/to/ca/certificate</parameter-->
+ <!-- set the client's SSL key file and passphrase here for client auth -->
+ <!--parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter-->
+ <!--parameter name="SSL_PASSPHRASE">passphrase</parameter-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="Transport"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch"/>
+ <phase name="PostDispatch"/>
+ <!-- End system pre defined phases -->
+ <!-- After PostDispatch phase, module or service author can add any phase as required -->
+ <!-- User defined phases could be added here -->
+ <phase name="Security"/>
+ <phase name="Rahas"/>
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- User defined phases could be added here -->
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
Added: trunk/sage/rpc-defs/aviary/axis2.xml.in
===================================================================
--- trunk/sage/rpc-defs/aviary/axis2.xml.in (rev 0)
+++ trunk/sage/rpc-defs/aviary/axis2.xml.in 2011-07-14 20:28:37 UTC (rev 4871)
@@ -0,0 +1,102 @@
+<!--
+/*
+ * Copyright 2000-2011 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<!-- Aviary-specific axis2.xml -->
+<axisconfig name="Axis2/C">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="libDir">@WS02_LIB_ROOT@</parameter>
+ <parameter name="servicesDir">/var/lib/condor/aviary/services</parameter>
+ <parameter name="enableREST" locked="false">true</parameter>
+ <parameter name="persistOperationContext" locked="false">true</parameter>
+
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http" class="libaxis2_http_receiver.so.0">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+
+ <!-- applies to Axis2/C clients only -->
+ <transportReceiver name="https" class="libaxis2_http_receiver.so.0">
+ <parameter name="port" locked="false">6060</parameter>
+ </transportReceiver>
+ <!--transportReceiver name="tcp" class="axis2_tcp_receiver"-->
+ <!--parameter name="port" locked="false">6060</parameter-->
+ <!--/transportReceiver-->
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="http" class="libaxis2_http_sender.so.0">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ <!--parameter name="Transfer-Encoding">chunked</parameter-->
+ <!--parameter name="PROXY" proxy_host="127.0.0.1" proxy_port="8080" locked="true"/-->
+ </transportSender>
+
+ <!-- applies to Axis2/C clients only -->
+ <transportSender name="https" class="libaxis2_http_sender.so.0">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="xml-declaration" insert="false"/>
+ </transportSender>
+
+ <!-- ================================================= -->
+ <!-- SSL -->
+ <!-- ================================================= -->
+ <!-- NOTE: server-side SSL support currently unavailable for aviary components -->
+ <!-- alternatives include the use of a SSL-enabled proxy server such as squid; -->
+ <!-- the following settings would apply to Axis2/C clients only if enabled -->
+ <!-- set the server's SSL certificate here -->
+ <!--parameter name="SERVER_CERT">/path/to/ca/certificate</parameter-->
+ <!-- set the client's SSL key file and passphrase here for client auth -->
+ <!--parameter name="KEY_FILE">/path/to/client/certificate/chain/file</parameter-->
+ <!--parameter name="SSL_PASSPHRASE">passphrase</parameter-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="inflow">
+ <!-- System pre defined phases -->
+ <phase name="Transport"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch"/>
+ <phase name="PostDispatch"/>
+ <!-- End system pre defined phases -->
+ <!-- After PostDispatch phase, module or service author can add any phase as required -->
+ <!-- User defined phases could be added here -->
+ <phase name="Security"/>
+ <phase name="Rahas"/>
+ </phaseOrder>
+ <phaseOrder type="outflow">
+ <!-- User defined phases could be added here -->
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="INfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ </phaseOrder>
+ <phaseOrder type="Outfaultflow">
+ <!-- User defined phases could be added here -->
+ <!--phase name="userphase1"/-->
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
12 years, 9 months
r4870 - in trunk: cumin/bin cumin/etc cumin/python/cumin sage/python/sage sage/python/sage/aviary sage/python/sage/qmf
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-14 20:22:03 +0000 (Thu, 14 Jul 2011)
New Revision: 4870
Added:
trunk/sage/python/sage/aviary/
trunk/sage/python/sage/aviary/__init__.py
trunk/sage/python/sage/aviary/aviaryoperations.py
trunk/sage/python/sage/qmf/
trunk/sage/python/sage/qmf/__init__.py
trunk/sage/python/sage/qmf/qmfoperations.py
Removed:
trunk/sage/python/sage/aviaryoperations.py
trunk/sage/python/sage/qmfoperations.py
Modified:
trunk/cumin/bin/cumin-web
trunk/cumin/etc/cumin.conf
trunk/cumin/python/cumin/config.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/task.py
trunk/sage/python/sage/util.py
Log:
Initial pass at aviary job operations integration.
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/cumin/bin/cumin-web 2011-07-14 20:22:03 UTC (rev 4870)
@@ -13,7 +13,15 @@
def restore_IO():
sys.stderr = sys.__stderr__
sys.stdout = sys.__stdout__
-
+
+def set_aviary_configs(cumin, values):
+ cumin.use_aviary = values.use_aviary
+ cumin.aviary_host = values.aviary_host
+ cumin.aviary_job_host = values.aviary_job_host
+ cumin.aviary_query_host = values.aviary_query_host
+ cumin.aviary_job_port = values.aviary_job_port
+ cumin.aviary_query_port = values.aviary_query_port
+
def main():
# Do our own simple option check so we can redirect IO early
# without worrying about other options or the behavior of optParse
@@ -88,8 +96,7 @@
if type(values.sasl_mech_list) == str:
cumin.sasl_mech_list = values.sasl_mech_list.upper()
- cumin.use_aviary = values.use_aviary
-
+ set_aviary_configs(cumin, values)
cumin.debug = opts.debug
cumin.user = values.user
cumin.update_interval = values.update_interval
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/cumin/etc/cumin.conf 2011-07-14 20:22:03 UTC (rev 4870)
@@ -14,6 +14,10 @@
# database: dbname=cumin user=cumin host=localhost
# brokers: localhost:5672
# sasl-mech-list: [allow all available mechanisms]
+# use-aviary: True
+# aviary-host: localhost
+# aviary-job-port: 9090
+# aviary-query-port: 9091
# log-level: info
# log-max-mb: 10
# log-max-archives: 1
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/cumin/python/cumin/config.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -149,6 +149,27 @@
# previous behavior
param = ConfigParameter(self, "sasl-mech-list", str)
+ param = ConfigParameter(self, "use-aviary", bool)
+ param.default = True
+
+ param = ConfigParameter(self, "aviary-host", str)
+ param.default = "localhost"
+
+ # Use aviary-host for all services, unless these are
+ # set explicitly as an override. This allows different
+ # services to be hosted on different machines if desired.
+ param = ConfigParameter(self, "aviary-job-host", str)
+ param.default = ""
+
+ param = ConfigParameter(self, "aviary-query-host", str)
+ param.default = ""
+
+ param = ConfigParameter(self, "aviary-job-port", int)
+ param.default = 9090
+
+ param = ConfigParameter(self, "aviary-query-port", int)
+ param.default = 9091
+
self.log_file = ConfigParameter(self, "log-file", str)
param = ConfigParameter(self, "log-level", str)
@@ -163,9 +184,6 @@
param = ConfigParameter(self, "debug", bool)
param.default = False
- param = ConfigParameter(self, "use-aviary", bool)
- param.default = True
-
class CuminOptionParser(OptionParser,object):
def __init__(self):
OptionParser.__init__(self)
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/cumin/python/cumin/main.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -22,8 +22,7 @@
from util import *
from widgets import *
from sage.remoteoperations import RemoteOperations
-from sage.qmfoperations import QmfOperations
-from sage.aviaryoperations import AviaryOperations
+from sage.qmf.qmfoperations import QmfOperations
from wooly import Session
from cumin.stat import PieChartPage
from cumin.widgets import AboutPage
@@ -81,9 +80,16 @@
self.sasl_mech_list = None
# Whether or not to use Aviary interface for
- # queries and job submissions. May be set via cumin.conf
+ # queries and job submissions plus configs.
+ # These values are expected to be filled in if
+ # use_aviary is left True.
self.use_aviary = True
-
+ self.aviary_host = None
+ self.aviary_job_host = None
+ self.aviary_query_host = None
+ self.aviary_job_port = None
+ self.aviary_query_port = None
+
def server_alive(self):
return self.server.server_alive()
@@ -155,7 +161,20 @@
self.remote = RemoteOperations()
ops = [QmfOperations("qmf", self.session)]
if self.use_aviary:
- ops.insert(0, AviaryOperations("aviary"))
+ from sage.aviary.aviaryoperations import AviaryOperations
+ aviary_dir = os.path.join(self.home, "rpc-defs/aviary")
+
+ # If aviary_job_host or aviary_query_host are "" or
+ # None then they inherit the value of aviary_host.
+ if not self.aviary_job_host:
+ self.aviary_job_host = self.aviary_host
+ if not self.aviary_query_host:
+ self.aviary_query_host = self.aviary_host
+ ops.insert(0, AviaryOperations("aviary", aviary_dir,
+ self.aviary_job_host,
+ self.aviary_job_port,
+ self.aviary_query_host,
+ self.aviary_query_port))
self.remote.add_mechanisms(ops)
self.model.init()
Modified: trunk/cumin/python/cumin/task.py
===================================================================
--- trunk/cumin/python/cumin/task.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/cumin/python/cumin/task.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -173,8 +173,17 @@
def make_callback(self):
def completion(status_code, output_args):
- self.status_code = status_code
- self.output_args = output_args
+ # Make results recorded directly through the callback
+ # match what is done when TaskInvocation values are
+ # set by an ObjectTask or Task on failure
+ # (see Task.invoke() and Task.exception() above)
+ # Previously the different mechanisms produced different results.
+ if status_code not in (0, "OK"):
+ self.status = self.FAILED
+ self.exception = Exception(status_code)
+ else:
+ self.status_code = status_code
+ self.output_args = output_args
self.end()
return completion
Added: trunk/sage/python/sage/aviary/__init__.py
===================================================================
Copied: trunk/sage/python/sage/aviary/aviaryoperations.py (from rev 4863, trunk/sage/python/sage/aviaryoperations.py)
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py (rev 0)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -0,0 +1,331 @@
+import os
+
+from suds import *
+from suds.client import Client
+from sage.util import CallSync, CallThread, ObjectPool
+import threading
+import logging
+
+#f = open("./suds.client.log", 'a+')
+#h = logging.StreamHandler(f)
+#logging.getLogger('suds.client').setLevel(logging.DEBUG)
+
+#f = open("./suds.client.log", 'a+')
+#h = logging.StreamHandler(f)
+#logging.getLogger('suds.client').addHandler(h)
+
+#logging.getLogger('suds.transport').setLevel(logging.DEBUG)
+#f = open("./suds.transport.log", 'a+')
+#h = logging.StreamHandler(f)
+#logging.getLogger('suds.transport').addHandler(h)
+
+#logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
+#f = open("./suds.xsd.log", 'a+')
+#h = logging.StreamHandler(f)
+#logging.getLogger('suds.xsd.schema').addHandler(h)
+
+#logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
+#f = open("./suds.wsdl.log", 'a+')
+#h = logging.StreamHandler(f)
+#logging.getLogger('suds.wsdl').addHandler(h)
+
+'''
+Stuff to do:
+
+- Add logging to Aviary
+
+- See if we can fill in the scheduler/pool information.
+What is cumin passing? (the scheduler object has this stuff,
+but what about hierarchical collectors?)
+
+- get the submission objects passed down if possible
+for job control functions. This would be extra stuff for QMF, but helpful with
+Aviary.
+
+Add a summary comment at the top like QMF opreations
+
+can we use default/timeout with suds?
+yes, there is at least a timeout that can be set once,
+it might be possible to change the timeout per call.
+'''
+
+class AviaryOperations(object):
+ def __init__(self, name, datadir, job_host, job_port, query_host, query_port):
+ assert type(job_host) is str
+ assert type(query_host) is str
+
+ self.name = name
+ self.datadir = datadir
+
+ # Add http:// if there is no protocol...
+ if job_host.find("://") < 0:
+ job_host = "http://" + job_host
+ if query_host.find("://") < 0:
+ query_host = "http://" + query_host
+
+ self.job_url = job_host + ":" + str(job_port) + "/services/job/"
+ self.query_url = query_host + ":" + str(query_port) + "/services/query/"
+
+ job_wsdl = "file:" + os.path.join(self.datadir, "aviary-job.wsdl")
+ query_wsdl = "file:" + os.path.join(self.datadir, "aviary-query.wsdl")
+
+ self.job_client_pool = JobClientPool(job_wsdl, None)
+ self.query_client_pool = QueryClientPool(query_wsdl, None)
+
+ self.type_map = self._type_map()
+
+# scheduler operations
+
+ def set_job_attribute(self, scheduler, job_id, name, value, callback):
+ assert callback
+
+ job_client = self.job_client_pool.get_object()
+
+ def my_callback(result):
+ self.job_client_pool.return_object(job_client)
+ # massage results for use by standard callback
+ cb_args = self._cb_args_dataless(result)
+ callback(*cb_args)
+
+ url = self.job_url + "setJobAttribute"
+ #print "Aviary set job attribute " + url
+
+ # Have to set the URL for the method. This might go away someday...
+ job_client.set_options(location=url)
+
+ # Make a job id parameter (see job wsdl)
+ jobId = job_client.factory.create('ns0:JobID')
+ jobId.job = job_id
+ jobId.pool = scheduler.Pool
+ jobId.scheduler = scheduler.Name
+
+ # Make attribute parameter from name and value
+ aviary_attr = job_client.factory.create('ns0:Attribute')
+ aviary_attr.name = name
+ aviary_attr.type = "STRING"
+ aviary_attr.value = value
+
+ t = CallThread(job_client.service.setJobAttribute, my_callback, jobId, aviary_attr)
+ t.start()
+
+ def submit_job(self, scheduler, ad, callback):
+ assert callback
+
+ job_client = self.job_client_pool.get_object()
+
+ def my_callback(result):
+ # Turn this back off before we put it back in the pool
+ # so allow_overrides isn't set for someone else...
+ job_client.set_allow_overrides(False)
+ self.job_client_pool.return_object(job_client)
+ if isinstance(result, Exception):
+ callback(result, None)
+ else:
+ # the aviary response has the job id available,
+ # we'll pass it anyway even though Cumin does not care
+ # at the present time
+ status = AviaryOperations._get_status(result.status)
+ callback(status, result.id)
+
+ url = self.job_url + "submitJob"
+ #print "Aviary submit job " + url
+
+ # Have to set the URL for the method. This might go away someday...
+ job_client.set_options(location=url)
+
+ # Set basic attributes in the order defined by aviary-job.wsdl.
+ args = list()
+ basic_attrs = ("Cmd", "Args", "Owner", "Iwd", "Submission")
+ for attr in basic_attrs:
+ args.append(ad[attr])
+
+ # Add empty list for Aviary's basic requirement value...
+ args.append([])
+
+ # and let's let Requirements remain an unrestricted expression so that
+ # we can just pass through the value from Cumin without interfering.
+ # To do that, we need to specify Requirements through the
+ # "extras" fields and set allowOverrides to True.
+ # (otherwise, Requirements will be limited to particular
+ # resource constraint types defined by aviary)
+ job_client.set_allow_overrides(True)
+ extras = list()
+ for k, v in ad.iteritems():
+ # We don't need to send descriptors down to aviary
+ # and basic_attrs have already been filled in
+ if k == "!!descriptors" or k in basic_attrs:
+ continue
+
+ extra = job_client.factory.create('ns0:Attribute')
+ extra.name = k
+ # But we do need to look in descriptors to find expressions...
+ if k in ad["!!descriptors"]:
+ extra.type = "EXPRESSION"
+ else:
+ try:
+ extra.type = self.type_map[type(v)]
+ except KeyError:
+ extra.type = "UNDEFINED"
+ extra.value = v
+ extras.append(extra)
+
+ # Important, extras itself must be added as an embedded list or
+ # suds will consider only a single item
+ args.append(extras)
+
+ t = CallThread(job_client.service.submitJob, my_callback, *args)
+ t.start()
+
+ def hold_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._control_job(scheduler, job_id, reason,
+ "holdJob",
+ callback, default, timeout)
+
+ def release_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._control_job(scheduler, job_id, reason,
+ "releaseJob",
+ callback, default, timeout)
+
+ def remove_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._control_job(scheduler, job_id, reason,
+ "removeJob",
+ callback, default, timeout)
+
+# Secret private implementation stuff, don't look!
+
+ @classmethod
+ def _type_map(cls):
+ # Need to be able to turn simple Python types into Aviary types for attributes
+ return {int: "INTEGER", float: "FLOAT", str: "STRING", bool: "BOOLEAN"}
+
+ @classmethod
+ def _get_status(cls, result):
+ # For Aviary operations, if the operation
+ # did not work the reason is in the text field.
+ # In cumin, we want to pass any error text as
+ # the status parameter to callbacks
+ if result.code != "OK":
+ return result.text
+ return result.code
+
+ @classmethod
+ def _cb_args_dataless(cls, result):
+ # Marshal data in result for passing to standard callback.
+ # This routine is for results that contain status only, no data.
+ if isinstance(result, Exception):
+ status = result
+ else:
+ status = AviaryOperations._get_status(result)
+ return (status, None)
+
+ def _call_sync(self, process_results, meth, *meth_args, **meth_kwargs):
+ # Common interface with QMF operations requires that a MethodResult
+ # object (or something just like it) be returned for synchronous calls.
+ # Might as well use the CallSync since the completion() routine
+ # handles status semantics.
+ sync = CallSync()
+ try:
+ result = meth(*meth_args, **meth_kwargs)
+ except Exception, e:
+ result = e
+ cb_args = process_results(result)
+ sync.get_completion()(*cb_args)
+ return sync
+
+ def _control_job(self, scheduler, job_id, reason, meth_name,
+ callback, default, timeout):
+
+ url = self.job_url + meth_name
+ client = self.job_client_pool.get_object()
+ meth = getattr(client.service, meth_name)
+
+ # Have to set the URL for the method. This might go away someday...
+ #print "Aviary control job " + url
+ client.set_options(location=url)
+
+ # Make a job id parameter (see job wsdl)
+ jobId = client.factory.create('ns0:JobID')
+ jobId.job = job_id
+ jobId.pool = scheduler.Pool
+ jobId.scheduler = scheduler.Name
+
+ if callback:
+ def my_callback(result):
+ self.job_client_pool.return_object(client)
+ cb_args = self._cb_args_dataless(result)
+ callback(*cb_args)
+
+ t = CallThread(meth, my_callback, jobId, reason)
+ t.start()
+ else:
+ res = self._call_sync(self._cb_args_dataless, meth, jobId, reason)
+ self.job_client_pool.return_object(client)
+ return res;
+
+try:
+ # Some of this stuff does not exist pre suds 0.4.1
+ # Make it work anyway for testing on such hosts by
+ # declaring simple OverridesPlugin in the exception case.
+ from suds.plugin import MessagePlugin
+ from suds.sax.attribute import Attribute
+ class OverridesPlugin(MessagePlugin):
+ '''
+ Plugin which allows optional addition of attributes
+ to the suds message after marshalling.
+ '''
+ def __init__(self):
+ super(OverridesPlugin, self).__init__()
+
+ self.allow = False
+
+ def marshalled(self, context):
+ if self.allow:
+ sj_body = context.envelope.getChild('Body')[0]
+ sj_body.attributes.append(Attribute("allowOverrides", "true"))
+except:
+ class OverridesPlugin(object):
+ def __init__(self):
+ self.allow = False
+
+class OverrideClient(Client):
+ '''
+ Instantiate a Client object with an OverridesPlugin and
+ retain a pointer to the plugin so that it can be controlled.
+ '''
+ def __init__(self, *args):
+ self.override = OverridesPlugin()
+ try:
+ super(OverrideClient, self).__init__(*args, plugins=[self.override])
+ except:
+ super(OverrideClient, self).__init__(*args)
+
+ def set_allow_overrides(self, truth):
+ self.override.allow = truth
+
+class JobClientPool(ObjectPool):
+ def __init__(self, job_wsdl, max_size):
+ super(JobClientPool, self).__init__(max_size)
+ self.job_wsdl = job_wsdl
+
+ def create_object(self):
+ return OverrideClient(self.job_wsdl)
+
+class QueryClientPool(ObjectPool):
+ def __init__(self, query_wsdl, max_size):
+ super(QueryClientPool, self).__init__(max_size)
+ self.query_wsdl = query_wsdl
+
+ def create_object(self):
+ return Client(self.query_wsdl)
Deleted: trunk/sage/python/sage/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviaryoperations.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/sage/python/sage/aviaryoperations.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -1,4 +0,0 @@
-class AviaryOperations(object):
- def __init__(self, name):
-
- self.name = name
Added: trunk/sage/python/sage/qmf/__init__.py
===================================================================
Copied: trunk/sage/python/sage/qmf/qmfoperations.py (from rev 4863, trunk/sage/python/sage/qmfoperations.py)
===================================================================
--- trunk/sage/python/sage/qmf/qmfoperations.py (rev 0)
+++ trunk/sage/python/sage/qmf/qmfoperations.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -0,0 +1,183 @@
+import logging
+from sage.util import CallSync, wait
+
+log = logging.getLogger("sage.remoteoperations")
+
+class QmfOperations(object):
+ '''
+ Provides an interface to QMF remote procedure calls.
+ Public methods may implement synchronous or asynchronous
+ calling semantics, or may support either one depending on the parameters
+ passed.
+ If a method takes a 'callback' parameter and that parameter is not
+ None, the method will have asynchronous calling semantics. Otherwise,
+ the method will have synchronous calling semantics and the 'default' and
+ 'timeout' parameters will be used.
+ The type of the result returned from all synchronous methods will be
+ sage.util.MethodResult or a descendent.
+ The 'callback' parameter if set is expected to be a reference to a
+ function that can be invoked by self.session.call_method() when an
+ operation is complete.
+ '''
+
+ def __init__(self, name, session):
+ '''
+ If this object is added to a RemoteOperations object as a mechanism,
+ the 'name' parameter will be used to create an attribute which points
+ to this object.
+ The 'session' parameter is expected to be an object that defines the
+ following method:
+
+ def call_method(callback, obj, meth, args)
+
+ session.call_method should be capable of invoking the 'meth' method
+ on the 'obj' object with the tuple 'args' as arguments. It should
+ be capable of passing results to the 'callback' function. Any
+ 'callback' parameter passed to a public method of a QmfOperations object
+ should have a signature that is compatible with that expected by
+ session.call_method().
+ '''
+
+ self.name = name
+ self.session = session
+
+ # Note, methods below were written to be synchronous, asynchronous, or
+ # selectable to reflect existing usage of QMF methods in cumin at
+ # the time 'sage' was created. Any of these methods may be changed to
+ # have synchronous or asynchronous calling semantics by using the callback,
+ # default, and timeout paramters and the self._call method.
+
+# broker operations
+
+ def queue_move_messages(self, broker, src, dst, count, callback):
+ assert callback
+ self._call(broker, "queueMoveMessages", callback, 0, 0, src, dst, count)
+
+# methods on various broker objects. close is implemented on multiple objects
+
+ def close(self, obj, callback):
+ assert callback
+ self._call(obj, "close", callback, 0, 0)
+
+ def detach(self, obj, callback):
+ assert callback
+ self._call(obj, "detach", callback, 0, 0)
+
+ def bridge(self, link, durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync, callback):
+ assert callback
+ self._call(link, "bridge", callback, 0, 0,
+ durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync)
+
+ def connect(self, obj, host, port, durable, mech, username, password, transport, callback):
+ assert callback
+ self._call(obj, "connect", callback, 0, 0,
+ host, port, durable, mech, username, password, transport)
+
+# queue operations
+
+ def purge_queue(self, queue, count, callback):
+ assert callback
+ self._call(queue, "purge", callback, 0, 0, count)
+
+# scheduler operations
+
+ def set_job_attribute(self, scheduler, job_id, name, value, callback):
+ assert callback
+ self._call(scheduler, "SetJobAttribute", callback, 0, 0,
+ job_id, name, value)
+
+ def submit_job(self, scheduler, ad, callback):
+ assert callback
+ self._call(scheduler, "SubmitJob", callback, 0, 0, ad)
+
+ def hold_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "HoldJob", callback, default,
+ timeout, job_id, reason)
+
+ def release_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "ReleaseJob", callback, default,
+ timeout, job_id, reason)
+
+ def remove_job(self, scheduler, job_id, reason,
+ callback=None, default=None, timeout=5):
+ '''
+ This method is asynchronous iff 'callback' is supplied.
+ '''
+ return self._call(scheduler, "RemoveJob", callback, default,
+ timeout, job_id, reason)
+
+# jobserver operations
+
+ def get_job_ad(self, job_server, job_id, default=None, timeout=5):
+ return self._call(job_server, "GetJobAd", 0, default, timeout, job_id)
+
+ def fetch_job_data(self, job_server, job_id, file, start, end,
+ default=None, timeout=5):
+ return self._call(job_server, "FetchJobData", 0, default, timeout,
+ job_id, file, start, end)
+
+# negotiator operations
+
+ def set_limit(self, negotiator, lim_name, lim_max, default=None, timeout=5):
+ return self._call(negotiator, "SetLimit", 0, default, timeout,
+ lim_name, lim_max)
+
+ def get_limits(self, negotiator, callback):
+ assert callback
+ return self._call(negotiator, "GetLimits", callback, 0, 0)
+
+ def reconfig(self, negotiator, default=None, timeout=5):
+ return self._call(negotiator, "Reconfig", 0, default, timeout)
+
+ def set_raw_config(self, negotiator, name, value, default=None, timeout=5):
+ return self._call(negotiator, "SetRawConfig", 0, default, timeout,
+ name, value)
+
+ def get_raw_config(self, negotiator, name, callback):
+ assert callback
+ return self._call(negotiator, "GetRawConfig", callback, 0, 0, name)
+
+# master operations
+
+ def start(self, master, daemon, callback):
+ assert callback
+ return self._call(master, "Start", callback, 0, 0, daemon)
+
+ def stop(self, master, daemon, callback):
+ assert callback
+ return self._call(master, "Stop", callback, 0, 0, daemon)
+
+# submission operations
+
+ def get_job_summaries(self, submission, callback):
+ assert callback
+ return self._call(submission, "GetJobSummaries", callback, 0, 0)
+
+# Secret private implementation stuff, don't look!
+ def _call(self, obj, meth, cb, dflt, tout, *args):
+ if cb:
+ self.session.call_method(cb, obj, meth, args)
+ else:
+ try:
+ sync = CallSync(log, dflt)
+ self.session.call_method(sync.get_completion(),
+ obj, meth, args)
+ except Exception, e:
+ sync.error = e
+ log.exception(e)
+
+ wait(sync.done, timeout=tout)
+ if not sync.got_data and not sync.error:
+ sync.error = Exception("Request timed out")
+ msg = "QMF call %s timed out" % meth
+ log.error(msg)
+ return sync
+
Deleted: trunk/sage/python/sage/qmfoperations.py
===================================================================
--- trunk/sage/python/sage/qmfoperations.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/sage/python/sage/qmfoperations.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -1,181 +0,0 @@
-import logging
-from sage.util import CallSync, wait
-
-log = logging.getLogger("sage.remoteoperations")
-
-class QmfOperations(object):
- '''
- Provides an interface to QMF remote procedure calls.
- Public methods may implement synchronous or asynchronous
- calling semantics, or may support either one depending on the parameters
- passed.
- If a method takes a 'callback' parameter and that parameter is not
- None, the method will have asynchronous calling semantics. Otherwise,
- the method will have synchronous calling semantics and the 'default' and
- 'timeout' parameters will be used.
- The 'callback' parameter if set is expected to be a reference to a
- function that can be invoked by self.session.call_method() when an
- operation is complete.
- '''
-
- def __init__(self, name, session):
- '''
- If this object is added to a RemoteOperations object as a mechanism,
- the 'name' parameter will be used to create an attribute which points
- to this object.
- The 'session' parameter is expected to be an object that defines the
- following method:
-
- def call_method(callback, obj, meth, args)
-
- session.call_method should be capable of invoking the 'meth' method
- on the 'obj' object with the tuple 'args' as arguments. It should
- be capable of passing results to the 'callback' function. Any
- 'callback' parameter passed to a public method of a QmfOperations object
- should have a signature that is compatible with that expected by
- session.call_method().
- '''
-
- self.name = name
- self.session = session
-
- # Note, methods below were written to be synchronous, asynchronous, or
- # selectable to reflect existing usage of QMF methods in cumin at
- # the time 'sage' was created. Any of these methods may be changed to
- # have synchronous or asynchronous calling semantics by using the callback,
- # default, and timeout paramters and the self._call method.
-
-# broker operations
-
- def queue_move_messages(self, broker, src, dst, count, callback):
- assert callback
- self._call(broker, "queueMoveMessages", callback, 0, 0, src, dst, count)
-
-# methods on various broker objects. close is implemented on multiple objects
-
- def close(self, obj, callback):
- assert callback
- self._call(obj, "close", callback, 0, 0)
-
- def detach(self, obj, callback):
- assert callback
- self._call(obj, "detach", callback, 0, 0)
-
- def bridge(self, link, durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync, callback):
- assert callback
- self._call(link, "bridge", callback, 0, 0,
- durable, src, dest, key, tag, excludes, srcIsQueue, srcIsLocal, dynamic, sync)
-
- def connect(self, obj, host, port, durable, mech, username, password, transport, callback):
- assert callback
- self._call(obj, "connect", callback, 0, 0,
- host, port, durable, mech, username, password, transport)
-
-# queue operations
-
- def purge_queue(self, queue, count, callback):
- assert callback
- self._call(queue, "purge", callback, 0, 0, count)
-
-# scheduler operations
-
- def set_job_attribute(self, scheduler, job_id, name, value, callback):
- assert callback
- self._call(scheduler, "SetJobAttribute", callback, 0, 0,
- job_id, name, value)
-
- def submit_job(self, scheduler, ad, callback):
- assert callback
- self._call(scheduler, "SubmitJob", callback, 0, 0, ad)
-
- def hold_job(self, scheduler, job_id, reason,
- callback=None, default=None, timeout=5):
- '''
- This method is asynchronous iff 'callback' is supplied.
- '''
- return self._call(scheduler, "HoldJob", callback, default,
- timeout, job_id, reason)
-
- def release_job(self, scheduler, job_id, reason,
- callback=None, default=None, timeout=5):
- '''
- This method is asynchronous iff 'callback' is supplied.
- '''
- return self._call(scheduler, "ReleaseJob", callback, default,
- timeout, job_id, reason)
-
- def remove_job(self, scheduler, job_id, reason,
- callback=None, default=None, timeout=5):
- '''
- This method is asynchronous iff 'callback' is supplied.
- '''
- return self._call(scheduler, "RemoveJob", callback, default,
- timeout, job_id, reason)
-
-# jobserver operations
-
- def get_job_ad(self, job_server, job_id, default=None, timeout=5):
- return self._call(job_server, "GetJobAd", 0, default, timeout, job_id)
-
- def fetch_job_data(self, job_server, job_id, file, start, end,
- default=None, timeout=5):
- return self._call(job_server, "FetchJobData", 0, default, timeout,
- job_id, file, start, end)
-
-# negotiator operations
-
- def set_limit(self, negotiator, lim_name, lim_max, default=None, timeout=5):
- return self._call(negotiator, "SetLimit", 0, default, timeout,
- lim_name, lim_max)
-
- def get_limits(self, negotiator, callback):
- assert callback
- return self._call(negotiator, "GetLimits", callback, 0, 0)
-
- def reconfig(self, negotiator, default=None, timeout=5):
- return self._call(negotiator, "Reconfig", 0, default, timeout)
-
- def set_raw_config(self, negotiator, name, value, default=None, timeout=5):
- return self._call(negotiator, "SetRawConfig", 0, default, timeout,
- name, value)
-
- def get_raw_config(self, negotiator, name, callback):
- assert callback
- return self._call(negotiator, "GetRawConfig", callback, 0, 0, name)
-
-# master operations
-
- def start(self, master, daemon, callback):
- assert callback
- return self._call(master, "Start", callback, 0, 0, daemon)
-
- def stop(self, master, daemon, callback):
- assert callback
- return self._call(master, "Stop", callback, 0, 0, daemon)
-
-# submission operations
-
- def get_job_summaries(self, submission, callback):
- assert callback
- return self._call(submission, "GetJobSummaries", callback, 0, 0)
-
-# Secret private implementation stuff, don't look!
- def _call(self, obj, meth, cb, dflt, tout, *args):
- if cb:
- self.session.call_method(cb, obj, meth, args)
- else:
- try:
- sync = CallSync(log, dflt)
- self.session.call_method(sync.get_completion(),
- obj, meth, args)
- except Exception, e:
- sync.error = e
- log.exception(e)
-
- wait(sync.done, timeout=tout)
- if not sync.got_data and not sync.error:
- sync.error = Exception("Request timed out")
- msg = "QMF call %s timed out" % meth
- log.error(msg)
- return sync
-
Modified: trunk/sage/python/sage/util.py
===================================================================
--- trunk/sage/python/sage/util.py 2011-07-12 20:02:12 UTC (rev 4869)
+++ trunk/sage/python/sage/util.py 2011-07-14 20:22:03 UTC (rev 4870)
@@ -1,7 +1,26 @@
from time import time, sleep
+from threading import Thread, Lock
-class CallSync(object):
+class MethodResult(object):
'''
+ Base type for synchronous method call results.
+ All synchronous methods that implement remote operations
+ in 'sage' will return a result whose type is this class
+ or a descendent of this class.
+ self.data will contain any data returned from the call
+ self.got_data will be True if the call succeeded
+ self.error will be True if the call raised an error
+ self.status will be 'OK' or 0 if the call succeeded and
+ may contain explanatory text otherwise
+ '''
+ def __init__(self):
+ self.data = None
+ self.got_data = False
+ self.error = False
+ self.status = None
+
+class CallSync(MethodResult):
+ '''
General callback object for asynchronous operations.
The 'get_completion' method will return a function that can be
used as a callback when an asynchronous operation completes.
@@ -11,10 +30,8 @@
The 'done' method can be polled to determine if the operation has completed.
'''
def __init__(self, log=None, default=None):
+ super(CallSync, self).__init__()
self.data = default
- self.got_data = False
- self.error = False
- self.status = None
self.log = log
def get_completion(self):
@@ -71,6 +88,10 @@
return self.syncs
def wait(predicate, timeout=30, args=None):
+ '''
+ Simple wait routine that tests predicate() with timeout.
+ If args is not None, calls predicate(args).
+ '''
start = time()
while True:
if args is not None:
@@ -82,3 +103,65 @@
if time() - start > timeout:
return False
sleep(1)
+
+class CallThread(Thread):
+ '''
+ Simple thread that executes result = routine(args).
+ This thread is useful for calling synchronous routines asynchronously.
+ Result is returned by calling callback(result).
+ If routine raises an exception, callback(exception) is called.
+ '''
+ def __init__(self, routine, callback, *args, **kwargs):
+ super(CallThread, self).__init__()
+
+ self.routine = routine
+ self.callback = callback
+ self.args = args
+ self.kwargs = kwargs
+
+ def run(self):
+ try:
+ result = self.routine(*self.args, **self.kwargs)
+ except Exception, e:
+ result = e
+ self.callback(result)
+
+class ObjectPool(object):
+ '''
+ Simple threadsafe pool class that holds up to max_size objects.
+ If the pool is empty when get_object() is called an object will be
+ created and returned; otherwise an object will be removed from
+ the pool and returned.
+ Objects are returned to the pool by a call to return_object(). If the pool
+ contains less than max_size items, a reference to the object will be
+ added to the pool.
+ ObjectPool must be derived from, and create_object must be overridden.
+ If max_size is set to None, the pool size is unlimited.
+ '''
+ def __init__(self, max_size):
+ self.max_size = max_size
+ self.pool = list()
+ self.lock = Lock()
+
+ def get_object(self):
+ self.lock.acquire()
+ if len(self.pool) == 0:
+ self.lock.release()
+ obj = self.create_object()
+ else:
+ obj = self.pool.pop()
+ self.lock.release()
+ return obj
+
+ def return_object(self, obj):
+ self.lock.acquire()
+ if self.max_size is None or len(self.pool) < self.max_size:
+ self.pool.append(obj)
+ self.lock.release()
+
+ def create_object(self):
+ '''
+ This routine must be overridden in a derived class
+ to create appropriate objects for addition to the pool.
+ '''
+ raise Exception("Not implemented")
12 years, 9 months
r4866 - branches
by croberts@fedoraproject.org
Author: croberts
Date: 2011-07-11 20:42:46 +0000 (Mon, 11 Jul 2011)
New Revision: 4866
Added:
branches/noflash/
Log:
Feature branch for getting rid of flash charts
12 years, 10 months
r4865 - in branches/clarity/cumin: etc python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-07-11 18:17:46 +0000 (Mon, 11 Jul 2011)
New Revision: 4865
Modified:
branches/clarity/cumin/etc/cumin.conf
branches/clarity/cumin/python/cumin/grid/job.py
Log:
Merge revision 4864 from trunk.
Removing the Overview Tab for jobs (attribute fast-view).
Modified: branches/clarity/cumin/etc/cumin.conf
===================================================================
--- branches/clarity/cumin/etc/cumin.conf 2011-07-07 19:52:36 UTC (rev 4864)
+++ branches/clarity/cumin/etc/cumin.conf 2011-07-11 18:17:46 UTC (rev 4865)
@@ -58,7 +58,6 @@
# update-interval: 10
# max-qmf-table-sort: 1000
# persona: default
-# fast-view-attributes: JobStatus,Cmd,Args,ExitStatus,JobStartDate,LastRemoteHost,LastJobStatus,Owner
[data]
# log-file: $CUMIN_HOME/log/data.log
Modified: branches/clarity/cumin/python/cumin/grid/job.py
===================================================================
--- branches/clarity/cumin/python/cumin/grid/job.py 2011-07-07 19:52:36 UTC (rev 4864)
+++ branches/clarity/cumin/python/cumin/grid/job.py 2011-07-11 18:17:46 UTC (rev 4865)
@@ -33,8 +33,6 @@
self.replace_child(self.view)
# view or edit
- self.fast_view = JobAdFastView(app, "fastads")
- self.view.add_tab(self.fast_view)
self.ads = JobAdModes(app, "ads")
self.view.add_tab(self.ads)
12 years, 10 months
r4864 - in trunk/cumin: etc python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-07-07 19:52:36 +0000 (Thu, 07 Jul 2011)
New Revision: 4864
Modified:
trunk/cumin/etc/cumin.conf
trunk/cumin/python/cumin/grid/job.py
Log:
Removing the Overview Tab for jobs (attribute fast-view).
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2011-07-05 15:35:39 UTC (rev 4863)
+++ trunk/cumin/etc/cumin.conf 2011-07-07 19:52:36 UTC (rev 4864)
@@ -58,7 +58,6 @@
# update-interval: 10
# max-qmf-table-sort: 1000
# persona: default
-# fast-view-attributes: JobStatus,Cmd,Args,ExitStatus,JobStartDate,LastRemoteHost,LastJobStatus,Owner
[data]
# log-file: $CUMIN_HOME/log/data.log
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-07-05 15:35:39 UTC (rev 4863)
+++ trunk/cumin/python/cumin/grid/job.py 2011-07-07 19:52:36 UTC (rev 4864)
@@ -32,8 +32,6 @@
self.replace_child(self.view)
# view or edit
- self.fast_view = JobAdFastView(app, "fastads")
- self.view.add_tab(self.fast_view)
self.ads = JobAdModes(app, "ads")
self.view.add_tab(self.ads)
12 years, 10 months