Search in sources :

Example 11 with File

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

the class AdvertJob method main.

public static void main(String[] args) throws Exception {
    try {
        GATContext c = new GATContext();
        Preferences prefs = new Preferences();
        prefs.put("File.adaptor.name", "local,commandlinessh");
        prefs.put("job.stop.on.exit", "false");
        c.addPreferences(prefs);
        SoftwareDescription sd = new SoftwareDescription();
        sd.setExecutable("/bin/sleep");
        sd.setArguments("100");
        // stdout & stderr
        File stdout = GAT.createFile(c, "std.out");
        File stderr = GAT.createFile(c, "std.err");
        sd.setStderr(stderr);
        sd.setStdout(stdout);
        ResourceDescription rd = new HardwareResourceDescription();
        JobDescription jd = new JobDescription(sd, rd);
        ResourceBroker broker = GAT.createResourceBroker(c, new URI("sshsge://fs0.das3.cs.vu.nl"));
        Job job = broker.submitJob(jd);
        AdvertService a = GAT.createAdvertService(c);
        MetaData m = new MetaData();
        m.put("name", "testJob");
        a.add(job, m, "/rob/testJob");
        a.exportDataBase(new URI("file:///mydb"));
        GAT.end();
        System.exit(0);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : GATContext(org.gridlab.gat.GATContext) ResourceBroker(org.gridlab.gat.resources.ResourceBroker) HardwareResourceDescription(org.gridlab.gat.resources.HardwareResourceDescription) AdvertService(org.gridlab.gat.advert.AdvertService) URI(org.gridlab.gat.URI) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription) JobDescription(org.gridlab.gat.resources.JobDescription) ResourceDescription(org.gridlab.gat.resources.ResourceDescription) HardwareResourceDescription(org.gridlab.gat.resources.HardwareResourceDescription) MetaData(org.gridlab.gat.advert.MetaData) Preferences(org.gridlab.gat.Preferences) Job(org.gridlab.gat.resources.Job) File(org.gridlab.gat.io.File)

Example 12 with File

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

the class SubmitLocalJob 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);
    ResourceBroker broker = GAT.createResourceBroker(new URI("any://localhost"));
    Job job = broker.submitJob(jd);
    while ((job.getState() != JobState.STOPPED) && (job.getState() != JobState.SUBMISSION_ERROR)) Thread.sleep(1000);
    GAT.end();
}
Also used : JobDescription(org.gridlab.gat.resources.JobDescription) ResourceBroker(org.gridlab.gat.resources.ResourceBroker) Job(org.gridlab.gat.resources.Job) File(org.gridlab.gat.io.File) URI(org.gridlab.gat.URI) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription)

Example 13 with File

use of org.gridlab.gat.io.File 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 14 with File

use of org.gridlab.gat.io.File 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

File (org.gridlab.gat.io.File)14 URI (org.gridlab.gat.URI)8 JobDescription (org.gridlab.gat.resources.JobDescription)8 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)8 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)6 GATContext (org.gridlab.gat.GATContext)5 Job (org.gridlab.gat.resources.Job)5 GATInvocationException (org.gridlab.gat.GATInvocationException)4 CertificateSecurityContext (org.gridlab.gat.security.CertificateSecurityContext)4 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)3 Preferences (org.gridlab.gat.Preferences)3 DataType (es.bsc.compss.types.annotations.parameter.DataType)2 DataAccessId (es.bsc.compss.types.data.DataAccessId)2 RAccessId (es.bsc.compss.types.data.DataAccessId.RAccessId)2 BasicTypeParameter (es.bsc.compss.types.parameter.BasicTypeParameter)2 DependencyParameter (es.bsc.compss.types.parameter.DependencyParameter)2 Parameter (es.bsc.compss.types.parameter.Parameter)2 HardwareResourceDescription (org.gridlab.gat.resources.HardwareResourceDescription)2 ResourceDescription (org.gridlab.gat.resources.ResourceDescription)2 TaskDescription (es.bsc.compss.types.TaskDescription)1