Search in sources :

Example 1 with MetaData

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

the class AdvertServiceAdaptorTest method test.

public AdaptorTestResult test(String adaptor, String host) {
    AdaptorTestResult adaptorTestResult = new AdaptorTestResult(adaptor, host);
    Preferences preferences = new Preferences();
    preferences.put("advertservice.adaptor.name", adaptor);
    AdvertService advertService = null;
    try {
        advertService = GAT.createAdvertService(preferences);
    } catch (GATObjectCreationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    MetaData meta = new MetaData();
    meta.put("version", "5.0");
    meta.put("price", "2000");
    adaptorTestResult.put("put object '1' at path 'a'", addTest(advertService, "1", meta, "a"));
    adaptorTestResult.put("getMetaData 'a'             ", getMetaDataTest(advertService, "a", meta));
    meta = new MetaData();
    meta.put("version", "5.0");
    meta.put("price", "50");
    adaptorTestResult.put("put object '2' at path 'b'", addTest(advertService, "2", meta, "b"));
    adaptorTestResult.put("test path 'a' (CORRECT)   ", getAdvertisableTest(advertService, "a", "1", true));
    adaptorTestResult.put("test path 'a' (INCORRECT) ", getAdvertisableTest(advertService, "a", "2", false));
    adaptorTestResult.put("test path 'b' (CORRECT)   ", getAdvertisableTest(advertService, "b", "2", true));
    adaptorTestResult.put("export                    ", exportTest(advertService, "any://" + host + "/exported-advert-database"));
    meta = new MetaData();
    meta.put("version", "9.1");
    meta.put("price", "50");
    adaptorTestResult.put("put object '3' at path 'c'", addTest(advertService, "3", meta, "c"));
    adaptorTestResult.put("test path 'c' (CORRECT)   ", getAdvertisableTest(advertService, "c", "3", true));
    adaptorTestResult.put("import                    ", importTest(advertService, "any://" + host + "/exported-advert-database"));
    adaptorTestResult.put("test path 'c' (INCORRECT) ", getAdvertisableTest(advertService, "c", null, true));
    meta = new MetaData();
    meta.put("price", "50");
    adaptorTestResult.put("find price=50             ", findTest(advertService, meta, new String[] { "/b" }, true));
    meta = new MetaData();
    meta.put("version", "5.0");
    adaptorTestResult.put("find version=5.0          ", findTest(advertService, meta, new String[] { "/b", "/a" }, true));
    adaptorTestResult.put("delete 'b'                ", deleteTest(advertService, "b"));
    adaptorTestResult.put("setPWD 'test'             ", setPWDTest(advertService, "/test"));
    adaptorTestResult.put("getPWD 'test'             ", getPWDTest(advertService, "/test"));
    return adaptorTestResult;
}
Also used : GATObjectCreationException(org.gridlab.gat.GATObjectCreationException) MetaData(org.gridlab.gat.advert.MetaData) AdvertService(org.gridlab.gat.advert.AdvertService) Preferences(org.gridlab.gat.Preferences)

Example 2 with MetaData

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

the class AdvertServiceAdaptorTest method getMetaDataTest.

private AdaptorTestResultEntry getMetaDataTest(AdvertService advert, String path, MetaData meta) {
    long start = System.currentTimeMillis();
    boolean result = false;
    try {
        MetaData metaData = advert.getMetaData(path);
        result = metaData.equals(meta);
    } catch (GATInvocationException e) {
        return new AdaptorTestResultEntry(false, 0, e);
    }
    long stop = System.currentTimeMillis();
    return new AdaptorTestResultEntry(result, (stop - start), null);
}
Also used : GATInvocationException(org.gridlab.gat.GATInvocationException) MetaData(org.gridlab.gat.advert.MetaData)

Example 3 with MetaData

use of org.gridlab.gat.advert.MetaData 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)

Aggregations

MetaData (org.gridlab.gat.advert.MetaData)3 Preferences (org.gridlab.gat.Preferences)2 AdvertService (org.gridlab.gat.advert.AdvertService)2 GATContext (org.gridlab.gat.GATContext)1 GATInvocationException (org.gridlab.gat.GATInvocationException)1 GATObjectCreationException (org.gridlab.gat.GATObjectCreationException)1 URI (org.gridlab.gat.URI)1 File (org.gridlab.gat.io.File)1 HardwareResourceDescription (org.gridlab.gat.resources.HardwareResourceDescription)1 Job (org.gridlab.gat.resources.Job)1 JobDescription (org.gridlab.gat.resources.JobDescription)1 ResourceBroker (org.gridlab.gat.resources.ResourceBroker)1 ResourceDescription (org.gridlab.gat.resources.ResourceDescription)1 SoftwareDescription (org.gridlab.gat.resources.SoftwareDescription)1