Search in sources :

Example 11 with GATContext

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

the class ResourceBrokerAdaptorTest method test.

public AdaptorTestResult test(String adaptor, String host) {
    try {
        URI temp = new URI(host);
        if (temp.getScheme() == null && !host.equals("")) {
            host = "any://" + host;
        }
    } catch (URISyntaxException e) {
    // ignored
    }
    AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
    GATContext gatContext = new GATContext();
    // CertificateSecurityContext ctxt = new CertificateSecurityContext(null, null, "username", "passphrase");
    // gatContext.addSecurityContext(ctxt);
    // Add security contexts to gatContext here.
    Preferences preferences = new Preferences();
    preferences.put("resourcebroker.adaptor.name", adaptor);
    // preferences.put("file.adaptor.name", "commandlinessh,sshtrilead,local");
    jobFinished = false;
    adaptorTestResult.put("submit job easy  ", submitJobEasy(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job parallel", submitJobParallel(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job stdout", submitJobStdout(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job stderr", submitJobStderr(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job prestage", submitJobPreStage(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job poststage", submitJobPostStage(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("submit job environment", submitJobEnvironment(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("job state consistency", submitJobStateConsistency(gatContext, preferences, host));
    jobFinished = false;
    adaptorTestResult.put("job get info        ", submitJobGetInfo(gatContext, preferences, host));
    jobFinished = false;
    return adaptorTestResult;
}
Also used : GATContext(org.gridlab.gat.GATContext) URISyntaxException(java.net.URISyntaxException) Preferences(org.gridlab.gat.Preferences) URI(org.gridlab.gat.URI)

Example 12 with GATContext

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

the class ConnectToAdvertJob method main.

public static void main(String[] args) throws Exception {
    GATContext c = new GATContext();
    Preferences prefs = new Preferences();
    prefs.put("File.adaptor.name", "local");
    AdvertService a = GAT.createAdvertService(c, prefs);
    a.importDataBase(new URI("file:///mydb"));
    c = new GATContext();
    prefs = new Preferences();
    // prefs.put("Resourcebroker.adaptor.name", "sshsge");
    prefs.put("File.adaptor.name", "local, commandlinessh");
    c.addPreferences(prefs);
    Job other = (Job) a.getAdvertisable(c, "/rob/testJob");
    System.err.println("got job back: " + other);
    while ((other.getState() != Job.JobState.STOPPED) && (other.getState() != Job.JobState.SUBMISSION_ERROR)) {
        System.err.println("job state = " + other.getInfo());
        Thread.sleep(1000);
    }
    System.err.println("job DONE, state = " + other.getInfo());
    GAT.end();
}
Also used : GATContext(org.gridlab.gat.GATContext) AdvertService(org.gridlab.gat.advert.AdvertService) Preferences(org.gridlab.gat.Preferences) Job(org.gridlab.gat.resources.Job) URI(org.gridlab.gat.URI)

Example 13 with GATContext

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

the class RandomAccessFileAdaptorTest method test.

public AdaptorTestResult test(String adaptor, String host) {
    AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
    GATContext gatContext = new GATContext();
    Preferences preferences = new Preferences();
    preferences.put("randomaccessfile.adaptor.name", adaptor);
    RandomAccessFile randomAccessFile = null;
    try {
        randomAccessFile = GAT.createRandomAccessFile(gatContext, preferences, "any://" + host + "/JavaGAT-random-accessfile", "rw");
    } catch (GATObjectCreationException e) {
        e.printStackTrace();
        GAT.end();
        System.exit(1);
    }
    adaptorTestResult.put("length             ", lengthTest(gatContext, preferences, randomAccessFile, 0));
    adaptorTestResult.put("write 'lorem ipsum'", writeTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
    adaptorTestResult.put("length after write", lengthTest(gatContext, preferences, randomAccessFile, 13));
    adaptorTestResult.put("seek              ", seekTest(gatContext, preferences, randomAccessFile, 0));
    adaptorTestResult.put("read              ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
    adaptorTestResult.put("write 'lorem ipsum' 2", writeTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
    adaptorTestResult.put("length after write 2", lengthTest(gatContext, preferences, randomAccessFile, 26));
    adaptorTestResult.put("seek 2              ", seekTest(gatContext, preferences, randomAccessFile, 0));
    adaptorTestResult.put("read 2              ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
    adaptorTestResult.put("read 3              ", readTest(gatContext, preferences, randomAccessFile, "lorem ipsum"));
    return adaptorTestResult;
}
Also used : GATContext(org.gridlab.gat.GATContext) RandomAccessFile(org.gridlab.gat.io.RandomAccessFile) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) Preferences(org.gridlab.gat.Preferences)

Example 14 with GATContext

use of org.gridlab.gat.GATContext 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 15 with GATContext

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

GATContext (org.gridlab.gat.GATContext)15 Preferences (org.gridlab.gat.Preferences)11 URI (org.gridlab.gat.URI)8 File (org.gridlab.gat.io.File)5 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)4 CertificateSecurityContext (org.gridlab.gat.security.CertificateSecurityContext)4 PasswordSecurityContext (org.gridlab.gat.security.PasswordSecurityContext)4 URISyntaxException (java.net.URISyntaxException)3 Job (org.gridlab.gat.resources.Job)3 JobDescription (org.gridlab.gat.resources.JobDescription)3 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)3 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)3 AdvertService (org.gridlab.gat.advert.AdvertService)2 Dispatcher (es.bsc.compss.comm.Dispatcher)1 ConstructConfigurationException (es.bsc.compss.exceptions.ConstructConfigurationException)1 DataOperation (es.bsc.compss.types.data.operation.DataOperation)1 ThreadPool (es.bsc.compss.util.ThreadPool)1 MetaData (org.gridlab.gat.advert.MetaData)1 FileInputStream (org.gridlab.gat.io.FileInputStream)1 FileOutputStream (org.gridlab.gat.io.FileOutputStream)1