Package org.ggf.drmaa

Examples of org.ggf.drmaa.Session


import org.ggf.drmaa.SessionFactory;

public class Howto4 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         String id = session.runJob(jt);
        
         System.out.println("Your job has been submitted with id " + id);
        
         session.control(id, Session.TERMINATE);
        
         System.out.println("Your job has been deleted");
        
         session.deleteJobTemplate(jt);
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here


import org.ggf.drmaa.SessionFactory;

public class Howto5 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         String id = session.runJob(jt);
        
         System.out.println("Your job has been submitted with id " + id);
        
         try {
            Thread.sleep(20 * 1000);
         } catch (InterruptedException e) {
            // Don't care
         }
        
         int status = session.getJobProgramStatus(id);
        
         switch (status) {
            case Session.UNDETERMINED:
               System.out.println("Job status cannot be determined\n");
               break;
            case Session.QUEUED_ACTIVE:
               System.out.println("Job is queued and active\n");
               break;
            case Session.SYSTEM_ON_HOLD:
               System.out.println("Job is queued and in system hold\n");
               break;
            case Session.USER_ON_HOLD:
               System.out.println("Job is queued and in user hold\n");
               break;
            case Session.USER_SYSTEM_ON_HOLD:
               System.out.println("Job is queued and in user and system hold\n");
               break;
            case Session.RUNNING:
               System.out.println("Job is running\n");
               break;
            case Session.SYSTEM_SUSPENDED:
               System.out.println("Job is system suspended\n");
               break;
            case Session.USER_SUSPENDED:
               System.out.println("Job is user suspended\n");
               break;
            case Session.USER_SYSTEM_SUSPENDED:
               System.out.println("Job is user and system suspended\n");
               break;
            case Session.DONE:
               System.out.println("Job finished normally\n");
               break;
            case Session.FAILED:
               System.out.println("Job finished, but failed\n");
               break;
         } /* switch */
        
         session.deleteJobTemplate(jt);
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto2_1 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         java.util.List ids = session.runBulkJobs(jt, 1, 30, 2);
         java.util.Iterator i = ids.iterator();
        
         while (i.hasNext()) {
            System.out.println("Your job has been submitted with id " + i.next());
         }
        
         session.deleteJobTemplate(jt);
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto1 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto3 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         String id = session.runJob(jt);
        
         System.out.println("Your job has been submitted with id " + id);
        
         session.deleteJobTemplate(jt);
        
         JobInfo info = session.wait(id, Session.TIMEOUT_WAIT_FOREVER);
        
         if (info.wasAborted()) {
            System.out.println("Job " + info.getJobId() + " never ran");
         } else if (info.hasExited()) {
            System.out.println("Job " + info.getJobId() +
                  " finished regularly with exit status " +
                  info.getExitStatus());
         } else if (info.hasSignaled()) {
            System.out.println("Job " + info.getJobId() +
                  " finished due to signal " +
                  info.getTerminatingSignal());
         } else {
            System.out.println("Job " + info.getJobId() +
                  " finished with unclear conditions");
         }
        
         System.out.println("Job Usage:");
        
         Map rmap = info.getResourceUsage();
         Iterator i = rmap.keySet().iterator();
        
         while (i.hasNext()) {
            String name = (String)i.next();
            String value = (String)rmap.get(name);
           
            System.out.println("  " + name + "=" + value);
         }
        
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.Version;

public class Howto6 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         System.out.println("Supported contact strings: \"" +
               session.getContact() + "\"");
         System.out.println("Supported DRM systems: \"" +
               session.getDrmSystem() + "\"");
         System.out.println("Supported DRMAA implementations: \"" +
               session.getDrmaaImplementation() + "\"");
        
         session.init("");
        
         System.out.println("Using contact strings: \"" +
               session.getContact() + "\"");
         System.out.println("Using DRM systems: \"" +
               session.getDrmSystem() + "\"");
         System.out.println("Using DRMAA implementations: \"" +
               session.getDrmaaImplementation() + "\"");
        
         Version version = session.getVersion();
        
         System.out.println("Using DRMAA version " + version.toString());
        
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto3_1 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         List ids = session.runBulkJobs(jt, 1, 30, 2);
         Iterator i = ids.iterator();
        
         while (i.hasNext()) {
            System.out.println("Your job has been submitted with id " + i.next());
         }
        
         session.deleteJobTemplate(jt);
         session.synchronize(Collections.singletonList(Session.JOB_IDS_SESSION_ALL),
               Session.TIMEOUT_WAIT_FOREVER, true);
        
         System.out.println("All jobs have finished.");
        
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto2 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         String id = session.runJob(jt);
        
         System.out.println("Your job has been submitted with id " + id);
        
         session.deleteJobTemplate(jt);
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto3_2 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();
     
      try {
         session.init("");
         JobTemplate jt = session.createJobTemplate();
         jt.setRemoteCommand("sleeper.sh");
         jt.setArgs(Collections.singletonList("5"));
        
         int start = 1;
         int end  = 30;
         int step = 2;
        
         List ids = session.runBulkJobs(jt, start, end, step);
         Iterator i = ids.iterator();
        
         while (i.hasNext()) {
            System.out.println("Your job has been submitted with id " + i.next());
         }
        
         session.deleteJobTemplate(jt);
         session.synchronize(Collections.singletonList(Session.JOB_IDS_SESSION_ALL),
               Session.TIMEOUT_WAIT_FOREVER, false);
        
         for (int count = start; count < end; count += step) {
            JobInfo info = session.wait(Session.JOB_IDS_SESSION_ANY,
                  Session.TIMEOUT_WAIT_FOREVER);
           
            if (info.wasAborted()) {
               System.out.println("Job " + info.getJobId() + " never ran");
            } else if (info.hasExited()) {
               System.out.println("Job " + info.getJobId() +
                     " finished regularly with exit status " +
                     info.getExitStatus());
            } else if (info.hasSignaled()) {
               System.out.println("Job " + info.getJobId() +
                     " finished due to signal " +
                     info.getTerminatingSignal());
            } else {
               System.out.println("Job " + info.getJobId() +
                     " finished with unclear conditions");
            }
           
            System.out.println("Job Usage:");
           
            Map rmap = info.getResourceUsage();
            Iterator r = rmap.keySet().iterator();
           
            while (r.hasNext()) {
               String name = (String)r.next();
               String value = (String)rmap.get(name);
              
               System.out.println("  " + name + "=" + value);
            }
         }
        
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

import org.ggf.drmaa.SessionFactory;

public class Howto1_1 {
   public static void main(String[] args) {
      SessionFactory factory = SessionFactory.getFactory();
      Session session = factory.getSession();

      try {
         session.init("");
         String contact = session.getContact();
         session.exit();
        
         session.init(contact);
         session.exit();
      } catch (DrmaaException e) {
         System.out.println("Error: " + e.getMessage());
      }
   }
View Full Code Here

TOP

Related Classes of org.ggf.drmaa.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.