Search in sources :

Example 11 with Preferences

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

the class FileInputStreamAdaptorTest method run.

private void run(String host, String script) {
    Preferences preferences = new Preferences();
    preferences.put("resourcebroker.adaptor.name", "commandlinessh,sshtrilead,local");
    preferences.put("file.adaptor.name", "commandlinessh,sshtrilead,local");
    SoftwareDescription sd = new SoftwareDescription();
    sd.setExecutable("/bin/bash");
    sd.setArguments(script);
    try {
        sd.addPreStagedFile(GAT.createFile(preferences, "tests" + java.io.File.separator + "src" + java.io.File.separator + "benchmarks" + java.io.File.separator + script));
    } catch (GATObjectCreationException e) {
        e.printStackTrace();
        System.exit(1);
    }
    ResourceBroker broker = null;
    try {
        broker = GAT.createResourceBroker(preferences, new URI("any://" + host));
    } catch (GATObjectCreationException e) {
        e.printStackTrace();
        System.exit(1);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        System.exit(1);
    }
    Job job = null;
    try {
        job = broker.submitJob(new JobDescription(sd));
    } catch (GATInvocationException e) {
        e.printStackTrace();
        System.exit(1);
    }
    while (job.getState() != Job.JobState.STOPPED && job.getState() != Job.JobState.SUBMISSION_ERROR) {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
        // ignored
        }
    }
}
Also used : JobDescription(org.gridlab.gat.resources.JobDescription) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException) ResourceBroker(org.gridlab.gat.resources.ResourceBroker) URISyntaxException(java.net.URISyntaxException) Preferences(org.gridlab.gat.Preferences) Job(org.gridlab.gat.resources.Job) URI(org.gridlab.gat.URI) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription)

Example 12 with Preferences

use of org.gridlab.gat.Preferences 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 13 with Preferences

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

the class SshLsfResourceBrokerAdaptor method getSupportedPreferences.

public static Preferences getSupportedPreferences() {
    Preferences p = ResourceBrokerCpi.getSupportedPreferences();
    p.put(SSHLSF_NATIVE_FLAGS, "");
    p.put(SSHLSF_SCRIPT, "");
    p.put(SSHLSF_SUBMITTER_SCHEME, "ssh");
    return p;
}
Also used : Preferences(org.gridlab.gat.Preferences)

Example 14 with Preferences

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

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

the class FileAdaptorTest method run.

private void run(String host, String script) {
    Preferences preferences = new Preferences();
    preferences.put("resourcebroker.adaptor.name", "commandlinessh,sshtrilead,local");
    preferences.put("file.adaptor.name", "commandlinessh,sshtrilead,local");
    SoftwareDescription sd = new SoftwareDescription();
    sd.setExecutable("/bin/bash");
    sd.setArguments(script);
    try {
        sd.addPreStagedFile(GAT.createFile(preferences, "tests" + java.io.File.separator + "src" + java.io.File.separator + "benchmarks" + java.io.File.separator + script));
    } catch (GATObjectCreationException e) {
        e.printStackTrace();
        System.exit(1);
    }
    ResourceBroker broker = null;
    try {
        broker = GAT.createResourceBroker(preferences, new URI("any://" + host));
    } catch (GATObjectCreationException e) {
        e.printStackTrace();
        System.exit(1);
    } catch (URISyntaxException e) {
        e.printStackTrace();
        System.exit(1);
    }
    Job job = null;
    try {
        job = broker.submitJob(new JobDescription(sd));
    } catch (GATInvocationException e) {
        e.printStackTrace();
        System.exit(1);
    }
    while (job.getState() != Job.JobState.STOPPED && job.getState() != Job.JobState.SUBMISSION_ERROR) {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
        // ignored
        }
    }
}
Also used : JobDescription(org.gridlab.gat.resources.JobDescription) GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) GATInvocationException(org.gridlab.gat.GATInvocationException) ResourceBroker(org.gridlab.gat.resources.ResourceBroker) URISyntaxException(java.net.URISyntaxException) Preferences(org.gridlab.gat.Preferences) Job(org.gridlab.gat.resources.Job) URI(org.gridlab.gat.URI) SoftwareDescription(org.gridlab.gat.resources.SoftwareDescription)

Aggregations

Preferences (org.gridlab.gat.Preferences)18 GATContext (org.gridlab.gat.GATContext)11 URI (org.gridlab.gat.URI)11 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)9 JobDescription (org.gridlab.gat.resources.JobDescription)8 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)8 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)8 Job (org.gridlab.gat.resources.Job)6 URISyntaxException (java.net.URISyntaxException)5 GATInvocationException (org.gridlab.gat.GATInvocationException)4 AdvertService (org.gridlab.gat.advert.AdvertService)3 File (org.gridlab.gat.io.File)3 PasswordSecurityContext (org.gridlab.gat.security.PasswordSecurityContext)3 MetaData (org.gridlab.gat.advert.MetaData)2 CertificateSecurityContext (org.gridlab.gat.security.CertificateSecurityContext)2 FileInputStream (org.gridlab.gat.io.FileInputStream)1 FileOutputStream (org.gridlab.gat.io.FileOutputStream)1 LogicalFile (org.gridlab.gat.io.LogicalFile)1 RandomAccessFile (org.gridlab.gat.io.RandomAccessFile)1 HardwareResourceDescription (org.gridlab.gat.resources.HardwareResourceDescription)1