airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [1/2] airavata git commit: Adding more python samples - AIRAVATA-1643
Date Thu, 30 Apr 2015 14:00:15 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 6c06aaac6 -> 7c1c632b8


Adding more python samples - AIRAVATA-1643


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2f06d276
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2f06d276
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2f06d276

Branch: refs/heads/master
Commit: 2f06d2768fa1c3b12e4ea12f2beb549c83c5b139
Parents: bcc5f58
Author: Suresh Marru <smarru@apache.org>
Authored: Thu Apr 30 09:59:59 2015 -0400
Committer: Suresh Marru <smarru@apache.org>
Committed: Thu Apr 30 09:59:59 2015 -0400

----------------------------------------------------------------------
 .../main/resources/samples/createExperiment.py  | 74 ++++++++++++++++++++
 .../src/main/resources/samples/createProject.py | 70 ++++++++++++++++++
 .../samples/getAllApplicationInterfaces.py      | 64 +++++++++++++++++
 .../samples/getAllComputeResourceNames.py       | 64 +++++++++++++++++
 .../src/main/resources/samples/getProjects.py   | 64 +++++++++++++++++
 5 files changed, 336 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2f06d276/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createExperiment.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createExperiment.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createExperiment.py
new file mode 100644
index 0000000..f6f61a4
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createExperiment.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+import sys, ConfigParser
+
+sys.path.append('../lib')
+
+from apache.airavata.api import Airavata
+from apache.airavata.api.ttypes import *
+from apache.airavata.model.workspace.experiment.ttypes import *
+
+from thrift import Thrift
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+try:
+    # Read Airavata Client properties
+    airavataConfig = ConfigParser.RawConfigParser()
+    airavataConfig.read('../conf/airavata-client.properties')
+
+    # Create a socket to the Airavata Server
+    transport = TSocket.TSocket(airavataConfig.get('AiravataServer', 'host'), airavataConfig.get('AiravataServer',
'port'))
+
+    # Use Buffered Protocol to speedup over raw sockets
+    transport = TTransport.TBufferedTransport(transport)
+
+    # Airavata currently uses Binary Protocol
+    protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+    # Create a Airavata client to use the protocol encoder
+    airavataClient = Airavata.Client(protocol)
+
+    # Connect to Airavata Server
+    transport.open()
+
+    #Create a experiment
+    experiment = Experiment()
+    experiment.userName = "smarru"
+    experiment.name = "cli-test-experiment"
+    experiment.description = "experiment to test python cli"
+    experiment.applicationId = "Echo_b22f2303-a574-43ef-a6f2-ab8e64e2d0a2"
+    #experiment.experimentInputs
+
+
+
+    print 'Created Experiment with Id:', airavataClient.createExperiment("sdsc", experiment)
+
+    print 'Airavata Server Version is:', airavataClient.getAPIVersion()
+
+    # Close Connection to Airavata Server
+    transport.close()
+
+except Thrift.TException, tx:
+    print '%s' % (tx.message)
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2f06d276/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createProject.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createProject.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createProject.py
new file mode 100644
index 0000000..3985b69
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/createProject.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+import sys, ConfigParser
+
+sys.path.append('../lib')
+
+from apache.airavata.api import Airavata
+from apache.airavata.api.ttypes import *
+from apache.airavata.model.workspace.ttypes import *
+
+from thrift import Thrift
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+try:
+    # Read Airavata Client properties
+    airavataConfig = ConfigParser.RawConfigParser()
+    airavataConfig.read('../conf/airavata-client.properties')
+
+    # Create a socket to the Airavata Server
+    transport = TSocket.TSocket(airavataConfig.get('AiravataServer', 'host'), airavataConfig.get('AiravataServer',
'port'))
+
+    # Use Buffered Protocol to speedup over raw sockets
+    transport = TTransport.TBufferedTransport(transport)
+
+    # Airavata currently uses Binary Protocol
+    protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+    # Create a Airavata client to use the protocol encoder
+    airavataClient = Airavata.Client(protocol)
+
+    # Connect to Airavata Server
+    transport.open()
+
+    #Create Project
+    project = Project()
+    project.owner = "smarru"
+    project.name = "CLI-Test"
+    project.description = "Test project to illustrate Python Client"
+
+    print 'Created Project with Id:', airavataClient.createProject("sdsc", project)
+
+    print 'Airavata Server Version is:', airavataClient.getAPIVersion()
+
+    # Close Connection to Airavata Server
+    transport.close()
+
+except Thrift.TException, tx:
+    print '%s' % (tx.message)
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2f06d276/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllApplicationInterfaces.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllApplicationInterfaces.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllApplicationInterfaces.py
new file mode 100644
index 0000000..271d9f5
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllApplicationInterfaces.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+import sys, ConfigParser
+
+sys.path.append('../lib')
+
+from apache.airavata.api import Airavata
+from apache.airavata.api.ttypes import *
+from apache.airavata.model.workspace.ttypes import *
+
+from thrift import Thrift
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+try:
+    # Read Airavata Client properties
+    airavataConfig = ConfigParser.RawConfigParser()
+    airavataConfig.read('../conf/airavata-client.properties')
+
+    # Create a socket to the Airavata Server
+    transport = TSocket.TSocket(airavataConfig.get('AiravataServer', 'host'), airavataConfig.get('AiravataServer',
'port'))
+
+    # Use Buffered Protocol to speedup over raw sockets
+    transport = TTransport.TBufferedTransport(transport)
+
+    # Airavata currently uses Binary Protocol
+    protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+    # Create a Airavata client to use the protocol encoder
+    airavataClient = Airavata.Client(protocol)
+
+    # Connect to Airavata Server
+    transport.open()
+
+    appInterfaceLists = airavataClient.getAllApplicationInterfaces("sdsc");
+
+    print appInterfaceLists
+
+    # Close Connection to Airavata Server
+    transport.close()
+
+except Thrift.TException, tx:
+    print '%s' % (tx.message)
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2f06d276/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllComputeResourceNames.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllComputeResourceNames.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllComputeResourceNames.py
new file mode 100644
index 0000000..65c9e99
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getAllComputeResourceNames.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+import sys, ConfigParser
+
+sys.path.append('../lib')
+
+from apache.airavata.api import Airavata
+from apache.airavata.api.ttypes import *
+from apache.airavata.model.workspace.ttypes import *
+
+from thrift import Thrift
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+try:
+    # Read Airavata Client properties
+    airavataConfig = ConfigParser.RawConfigParser()
+    airavataConfig.read('../conf/airavata-client.properties')
+
+    # Create a socket to the Airavata Server
+    transport = TSocket.TSocket(airavataConfig.get('AiravataServer', 'host'), airavataConfig.get('AiravataServer',
'port'))
+
+    # Use Buffered Protocol to speedup over raw sockets
+    transport = TTransport.TBufferedTransport(transport)
+
+    # Airavata currently uses Binary Protocol
+    protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+    # Create a Airavata client to use the protocol encoder
+    airavataClient = Airavata.Client(protocol)
+
+    # Connect to Airavata Server
+    transport.open()
+
+    computeResourceNames = airavataClient.getAllComputeResourceNames();
+
+    print computeResourceNames
+
+    # Close Connection to Airavata Server
+    transport.close()
+
+except Thrift.TException, tx:
+    print '%s' % (tx.message)
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/2f06d276/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getProjects.py
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getProjects.py
b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getProjects.py
new file mode 100644
index 0000000..9ac115a
--- /dev/null
+++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/getProjects.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+
+import sys, ConfigParser
+
+sys.path.append('../lib')
+
+from apache.airavata.api import Airavata
+from apache.airavata.api.ttypes import *
+from apache.airavata.model.workspace.ttypes import *
+
+from thrift import Thrift
+from thrift.transport import TSocket
+from thrift.transport import TTransport
+from thrift.protocol import TBinaryProtocol
+
+try:
+    # Read Airavata Client properties
+    airavataConfig = ConfigParser.RawConfigParser()
+    airavataConfig.read('../conf/airavata-client.properties')
+
+    # Create a socket to the Airavata Server
+    transport = TSocket.TSocket(airavataConfig.get('AiravataServer', 'host'), airavataConfig.get('AiravataServer',
'port'))
+
+    # Use Buffered Protocol to speedup over raw sockets
+    transport = TTransport.TBufferedTransport(transport)
+
+    # Airavata currently uses Binary Protocol
+    protocol = TBinaryProtocol.TBinaryProtocol(transport)
+
+    # Create a Airavata client to use the protocol encoder
+    airavataClient = Airavata.Client(protocol)
+
+    # Connect to Airavata Server
+    transport.open()
+
+    projectLists = airavataClient.getAllUserProjects("sdsc", "smarru");
+
+    print projectLists
+
+    # Close Connection to Airavata Server
+    transport.close()
+
+except Thrift.TException, tx:
+    print '%s' % (tx.message)
+


Mime
View raw message