docroot/WEB-INF/src/it/infn/ct/g_hmmer_portlet.java
void submitJob(AppInput appInput) {         
        //
        // Initialize the GridEngine Multi Infrastructure Job Submission object
        //
        MultiInfrastructureJobSubmission miJobSubmission = new MultiInfrastructureJobSubmission();            
        
        // Assigns all enabled infrastructures
        InfrastructureInfo[] infrastructuresInfo=appPreferences.getEnabledInfrastructures();
        for(int i=0; i<infrastructuresInfo.length; i++) {
            _log.info("Adding infrastructure #"+(i+1)
                     +" - Name: '"+infrastructuresInfo[i].getName()+"'"+LS);
            miJobSubmission.addInfrastructure(infrastructuresInfo[i]);
        }
        
        // Check the enabled infrastructures
        if(infrastructuresInfo.length > 0) {            
            // Application Id
            int applicationId=Integer.parseInt(appPreferences.getGridOperationId());
             
            // Grid Engine' UserTraking needs the portal IP address
            String   portalIPAddress=""; 
            try {
                InetAddress addr = InetAddress.getLocalHost();
                byte[] ipAddr=addr.getAddress();
                portalIPAddress= ""+ipAddr[0]
                               +":"+ipAddr[1]
                               +":"+ipAddr[2]
                               +":"+ipAddr[3];
            }
            catch(Exception e) {
                _log.error("Unable to get the portal IP address");
            }            
            
            // Job details
            String executable="/bin/sh";                       // Application executable
            String arguments =appPreferences.getPilotScript(); // executable' arguments 
            String outputPath="/tmp/";                         // Output Path
            String outputFile="g-hmmer-Output.txt";           // Distributed application standard output
            String errorFile ="g-hmmer-Error.txt";            // Distrubuted application standard error
            String appFile   ="g-hmmer-Files.tar.gz";         // Hostname output files (created by the pilot script)
            
            // InputSandbox (string with comma separated list of file names)
            /*String inputSandbox=appServerPath+"WEB-INF/job/"        //
                               +appPreferences.getPilotScript()     // pilot script
                               +","+appInput.inputSandbox_inputFile // input file
                               ;  
							   */
							   		
		String inputSandbox = appServerPath + "/WEB-INF/job/pilot_script.sh ," +
							  appServerPath + "/WEB-INF/job/hmmer-2.3.2.tar.gz ," +
							  appServerPath + "/WEB-INF/job/secuencia.fasta ," +
						  	  appServerPath + "/WEB-INF/job/secuenciah.hmm";
							  
            // OutputSandbox (string with comma separated list of file names)
            String outputSandbox=appFile;                                     // Output file
             
            // Take care of job requirements
            // More requirements can be specified in the preference value 'jobRequirements'
            // separating each requirement by the ';' character
            String jdlRequirements[] = appPreferences.getJobRequirements().split(";");
            int numRequirements=0;
            for(int i=0; i<jdlRequirements.length; i++) {
                if(!jdlRequirements[i].equals("")) {
                  jdlRequirements[numRequirements] = "JDLRequirements=("+jdlRequirements[i]+")";
                  numRequirements++;
                  _log.info("Requirement["+i+"]='"+jdlRequirements[i]+"'");
                }                
            } // for each jobRequirement
             
            // Other job initialization settings
            miJobSubmission.setExecutable (   executable); // Specify the executeable
            miJobSubmission.setArguments  (    arguments); // Specify the application' arguments
            miJobSubmission.setOutputPath (   outputPath); // Specify the output directory 
            miJobSubmission.setOutputFiles(outputSandbox); // Setup output files (OutputSandbox)
            miJobSubmission.setJobOutput  (   outputFile); // Specify the std-outputr file
            miJobSubmission.setJobError   (    errorFile); // Specify the std-error file
            if(   null != inputSandbox                     // Setup input files (InputSandbox) avoiding empty inputSandboxes
               && inputSandbox.length() > 0)
                miJobSubmission.setInputFiles(inputSandbox);  
            if(numRequirements>0)                          // Setup the JDL requirements
                miJobSubmission.setJDLRequirements(jdlRequirements);
             
            // Submit Job
            miJobSubmission.submitJobAsync(appInput.username, portalIPAddress, applicationId, appInput.jobIdentifier);
            
            // Show log
            // View jobSubmission details in the log
            _log.info(
               LS+"JobSent"
              +LS+"-------"
              +LS+"Portal address: '"+portalIPAddress+"'"
              +LS+"Executable    : '"+executable     +"'"
              +LS+"Arguments     : '"+arguments      +"'"
              +LS+"Output path   : '"+outputPath     +"'"
              +LS+"Output sandbox: '"+outputSandbox  +"'"
              +LS+"Ouput file    : '"+outputFile     +"'"
              +LS+"Error file    : '"+errorFile      +"'"
              +LS+"Input sandbox : '"+inputSandbox   +"'"
              +LS); // _log.info        
             
        } // numInfra > 0
        else {
            _log.warn(
                   LS+"There are no enough enabled infrastructures!"
                  +LS+"It is impossible to send any job"
                  +LS+"Configure the application preferences in order to setup"
                  +LS+"or enable at least one infrastructure."
                  +LS);
        } // numInfra == 0                    
   }
/**
     * This method sends the job into the distributed infrastructure using
     * the GridEngine methods
     * 
     * @param appInput  AppInput instance storing the jobSubmission data
     */
This method sends the job into the distributed infrastructure using
the GridEngine methods

@param appInput  AppInput instance storing the jobSubmission data
This method sends the job into the distributed infrastructure using the GridEngine methods @param appInput AppInput instance storing the jobSubmission data
void submitJob(AppInput appInput) {         
         Initialize the GridEngine Multi Infrastructure Job Submission object
        MultiInfrastructureJobSubmission miJobSubmission = new MultiInfrastructureJobSubmission();            
         Assigns all enabled infrastructures
        InfrastructureInfo[] infrastructuresInfo=appPreferences.getEnabledInfrastructures();
        for(int i=0; i<infrastructuresInfo.length; i++) {
            _log.info("Adding infrastructure #"+(i+1)
                     +" - Name: '"+infrastructuresInfo[i].getName()+"'"+LS);
            miJobSubmission.addInfrastructure(infrastructuresInfo[i]);
        }
         Check the enabled infrastructures
        if(infrastructuresInfo.length > 0) {            
             Application Id
            int applicationId=Integer.parseInt(appPreferences.getGridOperationId());
             Grid Engine' UserTraking needs the portal IP address
            String   portalIPAddress=""; 
            try {
                InetAddress addr = InetAddress.getLocalHost();
                byte[] ipAddr=addr.getAddress();
                portalIPAddress= ""+ipAddr[0]
                               +":"+ipAddr[1]
                               +":"+ipAddr[2]
                               +":"+ipAddr[3];
            }
            catch(Exception e) {
                _log.error("Unable to get the portal IP address");
            }            
             Job details
            String executable="/bin/sh";                        Application executable
            String arguments =appPreferences.getPilotScript();  executable' arguments 
            String outputPath="/tmp/";                          Output Path
            String outputFile="g-hmmer-Output.txt";            Distributed application standard output
            String errorFile ="g-hmmer-Error.txt";             Distrubuted application standard error
            String appFile   ="g-hmmer-Files.tar.gz";          Hostname output files (created by the pilot script)
             InputSandbox (string with comma separated list of file names)
            /*String inputSandbox=appServerPath+"WEB-INF/job/"        
                               +appPreferences.getPilotScript()      pilot script
                               +","+appInput.inputSandbox_inputFile  input file
                               ;  
							   */
		String inputSandbox = appServerPath + "/WEB-INF/job/pilot_script.sh ," +
							  appServerPath + "/WEB-INF/job/hmmer-2.3.2.tar.gz ," +
							  appServerPath + "/WEB-INF/job/secuencia.fasta ," +
						  	  appServerPath + "/WEB-INF/job/secuenciah.hmm";
             OutputSandbox (string with comma separated list of file names)
            String outputSandbox=appFile;                                      Output file
             Take care of job requirements
             More requirements can be specified in the preference value 'jobRequirements'
             separating each requirement by the ';' character
            String jdlRequirements[] = appPreferences.getJobRequirements().split(";");
            int numRequirements=0;
            for(int i=0; i<jdlRequirements.length; i++) {
                if(!jdlRequirements[i].equals("")) {
                  jdlRequirements[numRequirements] = "JDLRequirements=("+jdlRequirements[i]+")";
                  numRequirements++;
                  _log.info("Requirement["+i+"]='"+jdlRequirements[i]+"'");
                }                
            }  for each jobRequirement
             Other job initialization settings
            miJobSubmission.setExecutable (   executable);  Specify the executeable
            miJobSubmission.setArguments  (    arguments);  Specify the application' arguments
            miJobSubmission.setOutputPath (   outputPath);  Specify the output directory 
            miJobSubmission.setOutputFiles(outputSandbox);  Setup output files (OutputSandbox)
            miJobSubmission.setJobOutput  (   outputFile);  Specify the std-outputr file
            miJobSubmission.setJobError   (    errorFile);  Specify the std-error file
            if(   null != inputSandbox                      Setup input files (InputSandbox) avoiding empty inputSandboxes
               && inputSandbox.length() > 0)
                miJobSubmission.setInputFiles(inputSandbox);  
            if(numRequirements>0)                           Setup the JDL requirements
                miJobSubmission.setJDLRequirements(jdlRequirements);
             Submit Job
            miJobSubmission.submitJobAsync(appInput.username, portalIPAddress, applicationId, appInput.jobIdentifier);
             Show log
             View jobSubmission details in the log
            _log.info(
               LS+"JobSent"
              +LS+"-------"
              +LS+"Portal address: '"+portalIPAddress+"'"
              +LS+"Executable    : '"+executable     +"'"
              +LS+"Arguments     : '"+arguments      +"'"
              +LS+"Output path   : '"+outputPath     +"'"
              +LS+"Output sandbox: '"+outputSandbox  +"'"
              +LS+"Ouput file    : '"+outputFile     +"'"
              +LS+"Error file    : '"+errorFile      +"'"
              +LS+"Input sandbox : '"+inputSandbox   +"'"
              +LS);  _log.info        
        }  numInfra > 0
        else {
            _log.warn(
                   LS+"There are no enough enabled infrastructures!"
                  +LS+"It is impossible to send any job"
                  +LS+"Configure the application preferences in order to setup"
                  +LS+"or enable at least one infrastructure."
                  +LS);
        }  numInfra == 0                    
   }
void submitJob ( AppInput appInput ) { MultiInfrastructureJobSubmission miJobSubmission = new MultiInfrastructureJobSubmission ( ) ; InfrastructureInfo [ ] infrastructuresInfo = appPreferences . getEnabledInfrastructures ( ) ; for ( int i = 0 ; i < infrastructuresInfo . length ; i ++ ) { _log . info ( "Adding infrastructure #" + ( i + 1 ) + " - Name: '" + infrastructuresInfo [ i ] . getName ( ) + "'" + LS ) ; miJobSubmission . addInfrastructure ( infrastructuresInfo [ i ] ) ; } if ( infrastructuresInfo . length > 0 ) { int applicationId = Integer . parseInt ( appPreferences . getGridOperationId ( ) ) ; String portalIPAddress = "" ; try { InetAddress addr = InetAddress . getLocalHost ( ) ; byte [ ] ipAddr = addr . getAddress ( ) ; portalIPAddress = "" + ipAddr [ 0 ] + ":" + ipAddr [ 1 ] + ":" + ipAddr [ 2 ] + ":" + ipAddr [ 3 ] ; } catch ( Exception e ) { _log . error ( "Unable to get the portal IP address" ) ; } String executable = "/bin/sh" ; String arguments = appPreferences . getPilotScript ( ) ; String outputPath = "/tmp/" ; String outputFile = "g-hmmer-Output.txt" ; String errorFile = "g-hmmer-Error.txt" ; String appFile = "g-hmmer-Files.tar.gz" ; /*String inputSandbox=appServerPath+"WEB-INF/job/"        //
                               +appPreferences.getPilotScript()     // pilot script
                               +","+appInput.inputSandbox_inputFile // input file
                               ;  
							   */ String inputSandbox = appServerPath + "/WEB-INF/job/pilot_script.sh ," + appServerPath + "/WEB-INF/job/hmmer-2.3.2.tar.gz ," + appServerPath + "/WEB-INF/job/secuencia.fasta ," + appServerPath + "/WEB-INF/job/secuenciah.hmm" ; String outputSandbox = appFile ; String jdlRequirements [ ] = appPreferences . getJobRequirements ( ) . split ( ";" ) ; int numRequirements = 0 ; for ( int i = 0 ; i < jdlRequirements . length ; i ++ ) { if ( ! jdlRequirements [ i ] . equals ( "" ) ) { jdlRequirements [ numRequirements ] = "JDLRequirements=(" + jdlRequirements [ i ] + ")" ; numRequirements ++ ; _log . info ( "Requirement[" + i + "]='" + jdlRequirements [ i ] + "'" ) ; } } miJobSubmission . setExecutable ( executable ) ; miJobSubmission . setArguments ( arguments ) ; miJobSubmission . setOutputPath ( outputPath ) ; miJobSubmission . setOutputFiles ( outputSandbox ) ; miJobSubmission . setJobOutput ( outputFile ) ; miJobSubmission . setJobError ( errorFile ) ; if ( null != inputSandbox && inputSandbox . length ( ) > 0 ) miJobSubmission . setInputFiles ( inputSandbox ) ; if ( numRequirements > 0 ) miJobSubmission . setJDLRequirements ( jdlRequirements ) ; miJobSubmission . submitJobAsync ( appInput . username , portalIPAddress , applicationId , appInput . jobIdentifier ) ; _log . info ( LS + "JobSent" + LS + "-------" + LS + "Portal address: '" + portalIPAddress + "'" + LS + "Executable    : '" + executable + "'" + LS + "Arguments     : '" + arguments + "'" + LS + "Output path   : '" + outputPath + "'" + LS + "Output sandbox: '" + outputSandbox + "'" + LS + "Ouput file    : '" + outputFile + "'" + LS + "Error file    : '" + errorFile + "'" + LS + "Input sandbox : '" + inputSandbox + "'" + LS ) ; } else { _log . warn ( LS + "There are no enough enabled infrastructures!" + LS + "It is impossible to send any job" + LS + "Configure the application preferences in order to setup" + LS + "or enable at least one infrastructure." + LS ) ; } }
This method sends the job into the distributed infrastructure using
 the GridEngine methods
This method sends the job into the distributed infrastructure using the GridEngine methods
// // Initialize the GridEngine Multi Infrastructure Job Submission object // // Assigns all enabled infrastructures // Check the enabled infrastructures // Application Id // Grid Engine' UserTraking needs the portal IP address // Job details // Application executable // executable' arguments  // Output Path // Distributed application standard output // Distrubuted application standard error // Hostname output files (created by the pilot script) // InputSandbox (string with comma separated list of file names) // OutputSandbox (string with comma separated list of file names) // Output file // Take care of job requirements // More requirements can be specified in the preference value 'jobRequirements' // separating each requirement by the ';' character // for each jobRequirement // Other job initialization settings // Specify the executeable // Specify the application' arguments // Specify the output directory  // Setup output files (OutputSandbox) // Specify the std-outputr file // Specify the std-error file // Setup input files (InputSandbox) avoiding empty inputSandboxes // Setup the JDL requirements // Submit Job // Show log // View jobSubmission details in the log // _log.info         // numInfra > 0 // numInfra == 0                    