Search in sources :

Example 51 with URI

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

the class LfnFileCopy method main.

/**
 * @param args
 */
public static void main(String[] args) throws Exception {
    String lfnroot = "lfn:/grid/pvier/ceriel/";
    // Create a new CertificateSecurityContext containing the globus certificates
    // and the user password.
    CertificateSecurityContext securityContext = new CertificateSecurityContext(new URI(System.getProperty("user.home") + "/.globus/userkey.pem"), new URI(System.getProperty("user.home") + "/.globus/usercert.pem"), getPassphrase());
    // Store this SecurityContext in a GATContext
    GATContext context = new GATContext();
    context.addSecurityContext(securityContext);
    context.addPreference("VirtualOrganisation", "pvier");
    context.addPreference("vomsServerUrl", "voms.grid.sara.nl");
    context.addPreference("vomsServerPort", "30000");
    context.addPreference("vomsHostDN", "/O=dutchgrid/O=hosts/OU=sara.nl/CN=voms.grid.sara.nl");
    context.addPreference("LfcServer", "lfc.grid.sara.nl");
    context.addPreference("bdiiURI", "ldap://bdii.grid.sara.nl:2170");
    // context.addPreference("ftp.connection.passive", "false");
    // context.addPreference("ftp.server.noauthentication", "true");
    // context.addPreference("gridftp.authenticate.retry", "5");
    // context.addPreference("preferredSEID", "srm.grid.sara.nl");
    GAT.setDefaultGATContext(context);
    File exampleFile = GAT.createFile(lfnroot + "text.txt");
    exampleFile.copy(new URI("localtext.txt"));
    File exampleFile2 = GAT.createFile("localtext.txt");
    exampleFile2.copy(new URI(lfnroot + "data"));
    GAT.end();
}
Also used : GATContext(org.gridlab.gat.GATContext) CertificateSecurityContext(org.gridlab.gat.security.CertificateSecurityContext) URI(org.gridlab.gat.URI) File(org.gridlab.gat.io.File)

Example 52 with URI

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

the class RemoteCopy method main.

/**
 * Copies a file over the grid.
 *
 * @param args
 *            the arguments. args[0] should contain the source, args[1] the
 *            destination
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
    GAT.createFile(args[0]).copy(new URI(args[1]));
    GAT.end();
}
Also used : URI(org.gridlab.gat.URI)

Example 53 with URI

use of org.gridlab.gat.URI 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)53 URISyntaxException (java.net.URISyntaxException)28 JobDescription (org.gridlab.gat.resources.JobDescription)28 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)27 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)26 GATInvocationException (org.gridlab.gat.GATInvocationException)24 Job (org.gridlab.gat.resources.Job)23 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)19 Preferences (org.gridlab.gat.Preferences)11 BufferedReader (java.io.BufferedReader)8 File (java.io.File)8 IOException (java.io.IOException)8 GATContext (org.gridlab.gat.GATContext)8 File (org.gridlab.gat.io.File)8 InputStreamReader (java.io.InputStreamReader)5 LinkedList (java.util.LinkedList)4 AdvertService (org.gridlab.gat.advert.AdvertService)4 CertificateSecurityContext (org.gridlab.gat.security.CertificateSecurityContext)4 GATScriptExecutor (es.bsc.compss.gat.master.utils.GATScriptExecutor)3 MultiURI (es.bsc.compss.types.uri.MultiURI)3