Post on 13-Jan-2016
ASM Hands-on
What will we learn?
● How to install an ASM-based web-application in gUSE
● How to develop ASM-related parts of an interface for – Importing a workflow– Submiting a workflow – And so on...
AutoDock workflow● Run docking simulations● AutoGrid:
– Role: generator (n job instances)– Creates inputs for AutoDock
● AutoDock:– Runs as a PS job– Performs the docking simulations
● Collector:– Examines the results– Collects m best results
Inputs to be uploadedreceptor.pdb placed
in port 0
Number of job instancesto be created
as Command Line Argument
Output placedto port 1 of
Collector job
IntroductionWould like to have :
4
Open the development framework and Autodock portlet
● Login to your cloud image:
– ssh lpds@<YOUR_CLOUD_IMAGE> 3 times (one for editing, one for commands, one for logs)
– (here you will have a pre-installed WS-PGrade/gUSE 3.5.6)
● Get a copy of ASM based on Maven from Sourceforge
– mkdir asm
– cd asm
– svn export svn://svn.code.sf.net/p/guse/svn/asm/branches/asm-3.4.4_mvn asm-3.4.4_mvn
● Open an exitor (mcedit/nano whatever)
– mcedit asm-3.4.4_mvn/samples/AutoDockPortlet/src/main/java/hu/sztaki/lpds/autodock/AutoDockPortlet.java
6
Implement method for workflow import
//// EXCERCISE 1: Import a workflow, implement doImport method ### ////
// Predefinitely we know on what prefix used for the exported workflow nameString workflowPrefix = "autoDock_" + userId;// Predefinitely we know who exported the workflowString developerID = "10196";// get the type of the workflow exported (it's been exported as Application)String impWfType = RepositoryItemTypeConstants.Application;// get the instance of ASMService singletonASMService asmService = ASMService.getInstance();// get the workflow ID to be importedVector<ASMRepositoryItemBean> list = asmService.getWorkflowsFromRepository(developerID, impWfType);
// it returns a list, grab the last one, the list is ordered according to timeASMRepositoryItemBean workflowToImport= list.lastElement();// invoke ImportWorkflow method with the parametersasmService.ImportWorkflow(userId, workflowPrefix, developerID, impWfType, workflowToImport.getId().toString());
7
Upload an input file//// ### EXCERCISE 2.: Upload and associate inputs and command line interfaces ### ////
// get instance of ASMService singletonASMService asmService = ASMService.getInstance();// get the name of the job which has the input file to be setString jobName = "AutoGrid";// upload the file to the portal server onceFile uploadedFile = asmService.uploadFiletoPortalServer(file,userId,fileName);
// than upload it to the storage and associate it to the given job's given portasmService.placeUploadedFile(userId, uploadedFile, workflowName, jobName, portNumber);
8
Implement a method to submit a workflow
//Implement doSubmit method (can be found by searching for Excercise 3 in the code)try {// get userID from ActionRequest object String userID = (String) request.getRemoteUser();// get the ASMService instance ASMService asmService = ASMService.getInstance(); String workflowName = request.getParameter("selectedWorkflow");// notifytext and notifyType can be added as empty strings. String notifyText = ""; String notifyType = "";// invoke its submit function with the parameters asmService.submit(userID, workflowName, notifyText, notifyType);// catch all exceptions} catch (ClassNotFoundException ex) {Logger.getLogger(AutoDockPortlet.class.getName()).log(Level.SEVERE, null, ex);} catch (InstantiationException ex) {Logger.getLogger(AutoDockPortlet.class.getName()).log(Level.SEVERE, null, ex);} catch (IllegalAccessException ex) {Logger.getLogger(AutoDockPortlet.class.getName()).log(Level.SEVERE, null, ex);}
9
CompilationNavigate to AutoDockPortlet folder (where you can find a pom.xml)
Then type : mvn package
[INFO] Building war: /home/lpds/asm/asm-3.4.4_mvn/samples/AutoDockPortlet/target/AutoDockPortlet.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.809s
[INFO] Finished at: Fri Jul 05 09:38:34 UTC 2013
[INFO] Final Memory: 18M/44M
The web archive will be created in /samples/AutoDockPortlet/target
11
Deployment and execution
Add new page for AutoDock portlet
go to the portal:
– http://<YOUR_CLOUD_IMAGE>:8080/liferay-portal-6.1.0/
Sign in :
– username: test@liferay.com
– Password: lpds
On the upper menu click to Add, then select Page link
Name the page to AutoDock
Import workflow• Get workflow from http://goo.gl/tZMWP• Select „Workflow” / „Upload”• Browse the downloaded workflow file• Click „Upload”
• „The upload is successful!”
Deploy the compiled web archive
Use HotDeploy possibility of Liferay:
Copy AutoDockPortlet.war to $HOME/guse/deploy folder
In target folder type this:
cp AutoDockPortlet.war $HOME/guse/deploy
In the logs you should see something like this:
09:41:39,399 INFO [AutoDeployDir:167] Processing AutoDockPortlet.war
09:41:39,587 INFO [PortletAutoDeployListener:71] Copying portlets for /home/lpds/guse/deploy/AutoDockPortlet.war
Expanding: /home/lpds/guse/deploy/AutoDockPortlet.war into /home/lpds/guse/apache-tomcat-6.0.37/temp/20130705094139625
Copying 1 file to /home/lpds/guse/apache-tomcat-6.0.37/temp/20130705094139625/WEB-INF/classes
Copying 1 file to /home/lpds/guse/apache-tomcat-6.0.37/temp/20130705094139625/WEB-INF/classes
Copying 1 file to /home/lpds/guse/apache-tomcat-6.0.37/temp/20130705094139625/WEB-INF/jsp
Copying 103 files to /home/lpds/guse/apache-tomcat-6.0.37/webapps/AutoDockPortlet
Copying 1 file to /home/lpds/guse/apache-tomcat-6.0.37/webapps/AutoDockPortlet
Deleting directory /home/lpds/guse/apache-tomcat-6.0.37/temp/20130705094139625
09:41:41,552 INFO [PortletAutoDeployListener:81] Portlets for /home/lpds/guse/deploy/AutoDockPortlet.war copied successfully. Deployment will start in a few seconds.
Jul 5, 2013 9:41:48 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory AutoDockPortlet
09:41:55,702 INFO [PluginPackageUtil:1099] Reading plugin package for AutoDockPortlet
09:41:55,712 WARN [PluginPackageUtil:1058] Plugin package on context AutoDockPortlet cannot be tracked because this WAR does not contain a liferay-plugin-package.xml file
09:41:57,581 INFO [PortletHotDeployListener:614] Registering portlets for AutoDockPortlet
09:41:57,736 WARN [PortletLocalServiceImpl:720] Portlet with the name AutoDockPortlet_WAR_AutoDockPortlet is described in portlet.xml but does not have a matching entry in liferay-portlet.xml
09:41:58,185 INFO [PortletHotDeployListener:433] 1 portlet for AutoDockPortlet is available for use
Register AutoDock Portlet as gUSE Component
Note: You must do this only at first time!
Click to Settings, then to Internal Services, finally click New to add new gUSE component represents ASM-based webapp.
Type of component: portal
Service group: guse
URL of Component: http://<YOUR_CLOUD_IMAGE>:8080/AutoDockPortlet
URL to initialize Component: http://<YOUR_CLOUD_IMAGE>:8080/AutoDockPortlet/init
Public URL of Component: http://<YOUR_CLOUD_IMAGE>:8080/AutoDockPortlet
State: active
Click to Save
Register AutoDock Portlet as gUSE Component
Click to Copy component properties
Set Component from to http://<YOUR_CLOUD_IMAGE>:8080/wspgrade
Set Component to to http://<YOUR_CLOUD_IMAGE>:8080/AutoDockPortlet
Click to copy
Don't worry it is the good response :) : Sytem message???servicecall.propertyimport???
In the logs you should see this :http://<YOUR_CLOUD_IMAGE>:8080/AutoDockPortlet--http://<YOUR_CLOUD_IMAGE>:8080/wspgrade
Restart the portal
EXAMPLE:
lpds@ubuntu:~$ ps aux | grep java
lpds 1008 0.0 0.0 8128 616 pts/3 R+ 08:46 0:00 grep --color=auto java
lpds 14882 0.7 66.2 3134236 1358020 ? Sl Jun25 19:15 /usr/bin/java -Djava.util.logging.config.file=/home/lpds/guse/apache-tomcat-6.0.37/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xms256m -Xmx1024m -XX:MaxPermSize=512m -Dfile.encoding=UTF8 -Duser.timezone=UTC -Djava.security.auth.login.config=/home/lpds/guse/apache-tomcat-6.0.37/conf/jaas.config -DcrlUpdateInterval=0s -DcrlEnabled=false -Dorg.globus.tcp.port.range=20000,25000 -Djava.endorsed.dirs=/home/lpds/guse/apache-tomcat-6.0.37/endorsed -classpath /home/lpds/guse/apache-tomcat-6.0.37/bin/bootstrap.jar -Dcatalina.base=/home/lpds/guse/apache-tomcat-6.0.37 -Dcatalina.home=/home/lpds/guse/apache-tomcat-6.0.37 -Djava.io.tmpdir=/home/lpds/guse/apache-tomcat-6.0.37/temp org.apache.catalina.startup.Bootstrap start
lpds@ubuntu:~$ kill -9 14882
go to terminal./guse/apache-tomcat-6.0.37/bin/shutdown.sh ps aux | grep javakill -9 <PROCESS_ID>./guse/apache-tomcat-6.0.37/bin/startup.sh
NOTE : please do not use start.sh
Then start the portal with start.sh
Check startup process: tailf ~/guse/apache-tomcat-6.0.37/logs/catalina.out
After a time you should see this as last line:INFO: Server startup in 116990 ms
Then in the browser the initialization process must be invoked. Please follow its instructions.http://<YOUR_CLOUD_IMAGE>:8080/information
–Username: admin–Password: admin–JDBC Driver: org.gjt.mm.mysql.Driver–URI: jdbc:mysql://localhost:3306/guse (IP must be changed to localhost)–User: guse–Password: guse–Please do NOT accept to provide my portal's location information :)
Then go back to the portal:–http://<YOUR_CLOUD_IMAGE>:8080/liferay-portal-6.1.0/–And sign in...
#Add webapplicationClick to AutoDock menuitemAdd -> More -> undefined --> AutoDockPortlet #Set LayoutManage -> Page Layout -> 1 column -> Save
Finally check your application by
– Uploading receptor.pdb located in /test folder of AutoDock web application
– Creating new measurement
– Executing it
– Checking its status (by clicking to AutoDock link)
– Downloading the results
End of Hands-On
Thanks for your attention!
Questions?