Package com.asakusafw.yaess.core

Examples of com.asakusafw.yaess.core.JobScheduler


    public void multiple() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock("a"));
        jobs.add(new Mock("b"));
        jobs.add(new Mock("c"));
        instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.STRICT);
        Set<String> rest = collectRest(jobs);
        assertThat(rest.size(), is(0));
    }
View Full Code Here


    public void dependencies() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        AtomicInteger group = new AtomicInteger();
        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock(group, "b", "a"));
        jobs.add(new Mock(group, "d", "b", "c"));
        jobs.add(new Mock(group, "a"));
        jobs.add(new Mock(group, "c", "a"));
        instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.STRICT);
        Set<String> rest = collectRest(jobs);
        assertThat(rest.size(), is(0));

        assertThat(ordinary(jobs, "a"), lessThan(ordinary(jobs, "b")));
        assertThat(ordinary(jobs, "a"), lessThan(ordinary(jobs, "c")));
View Full Code Here

    public void cyclic() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        AtomicInteger group = new AtomicInteger();
        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock(group, "a"));
        jobs.add(new Mock(group, "b", "a", "d"));
        jobs.add(new Mock(group, "c", "b"));
        jobs.add(new Mock(group, "d", "c"));
        jobs.add(new Mock(group, "e", "d"));
        try {
            instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.STRICT);
            fail();
        } catch (IOException e) {
            // ok.
        }
        Set<String> rest = collectRest(jobs);
View Full Code Here

    public void fail_job() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock("a") {
            @Override
            protected void hook() throws IOException {
                throw new IOException();
            }
        });
        try {
            instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.STRICT);
            fail();
        } catch (IOException e) {
            // ok.
        }
        Set<String> rest = collectRest(jobs);
View Full Code Here

    public void fail_besteffort() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock("a") {
            @Override
            protected void hook() throws IOException {
                throw new IOException();
            }
        });
        jobs.add(new Mock("b"));
        jobs.add(new Mock("c"));
        try {
            instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.BEST_EFFORT);
            fail();
        } catch (IOException e) {
            // ok.
        }
        Set<String> rest = collectRest(jobs);
View Full Code Here

    public void fail_stuck() throws Exception {
        Map<String, String> conf = new HashMap<String, String>();
        ServiceProfile<JobScheduler> profile = new ServiceProfile<JobScheduler>(
                "testing", BasicJobScheduler.class, conf, ProfileContext.system(getClass().getClassLoader()));

        JobScheduler instance = profile.newInstance();

        List<Mock> jobs = new ArrayList<Mock>();
        jobs.add(new Mock("a") {
            @Override
            protected void hook() throws IOException {
                throw new IOException();
            }
        });
        jobs.add(new Mock("b"));
        jobs.add(new Mock("c", "a", "b"));
        try {
            instance.execute(PhaseMonitor.NULL, CONTEXT, jobs, JobScheduler.BEST_EFFORT);
            fail();
        } catch (IOException e) {
            // ok.
        }
        Set<String> rest = collectRest(jobs);
View Full Code Here

        LOG.debug("Loading execution lock feature");
        ExecutionLockProvider locks = profile.getLocks().newInstance();

        LOG.debug("Loading job scheduling feature");
        JobScheduler scheduler = profile.getScheduler().newInstance();

        LOG.debug("Loading hadoop execution feature");
        HadoopScriptHandler hadoopHandler = profile.getHadoopHandler().newInstance();

        LOG.debug("Loading command execution features");
View Full Code Here

TOP

Related Classes of com.asakusafw.yaess.core.JobScheduler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.