Search in sources :

Example 26 with ResourceBroker

use of org.gridlab.gat.resources.ResourceBroker in project compss by bsc-wdc.

the class SubmitRemoteJob method main.

public static void main(String[] args) throws Exception {
    SoftwareDescription sd = new SoftwareDescription();
    sd.setExecutable("/bin/hostname");
    File stdout = GAT.createFile("hostname.txt");
    sd.setStdout(stdout);
    JobDescription jd = new JobDescription(sd);
    Preferences prefs = new Preferences();
    /*
        prefs.put("VirtualOrganisation", "pvier");
        prefs.put("vomsServerURL", "voms.grid.sara.nl");
        prefs.put("vomsServerPort", "30000");
        prefs.put("vomsHostDN", "/O=dutchgrid/O=hosts/OU=sara.nl/CN=voms.grid.sara.nl");
        */
    CertificateSecurityContext ctxt = new CertificateSecurityContext(new URI(System.getProperty("user.home") + "/.globus/userkey.pem"), new URI(System.getProperty("user.home") + "/.globus/usercert.pem"), getPassphrase());
    GATContext context = new GATContext();
    context.addPreferences(prefs);
    context.addSecurityContext(ctxt);
    ResourceBroker broker = GAT.createResourceBroker(context, new URI(args[0]));
    Job job = broker.submitJob(jd);
    while ((job.getState() != JobState.STOPPED) && (job.getState() != JobState.SUBMISSION_ERROR)) {
        System.out.println("State: " + job.getState());
        Thread.sleep(1000);
    }
}
Also used : JobDescription(org.gridlab.gat.resources.JobDescription) GATContext(org.gridlab.gat.GATContext) CertificateSecurityContext(org.gridlab.gat.security.CertificateSecurityContext) ResourceBroker(org.gridlab.gat.resources.ResourceBroker) Preferences(org.gridlab.gat.Preferences) Job(org.gridlab.gat.resources.Job) File(org.gridlab.gat.io.File) URI(org.gridlab.gat.URI) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription)

Aggregations

URI (org.gridlab.gat.URI)26 JobDescription (org.gridlab.gat.resources.JobDescription)26 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)26 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)24 Job (org.gridlab.gat.resources.Job)19 GATInvocationException (org.gridlab.gat.GATInvocationException)18 URISyntaxException (java.net.URISyntaxException)17 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)16 Preferences (org.gridlab.gat.Preferences)8 IOException (java.io.IOException)6 File (org.gridlab.gat.io.File)6 BufferedReader (java.io.BufferedReader)4 InputStreamReader (java.io.InputStreamReader)4 GATContext (org.gridlab.gat.GATContext)3 HashMap (java.util.HashMap)2 WrapperJobDescription (org.gridlab.gat.resources.WrapperJobDescription)2 CertificateSecurityContext (org.gridlab.gat.security.CertificateSecurityContext)2 File (java.io.File)1 InputStream (java.io.InputStream)1 AdvertService (org.gridlab.gat.advert.AdvertService)1