Package com.ontology2.bakemono.abstractions

Examples of com.ontology2.bakemono.abstractions.Codec


    private JobAppOptions extractOptions(String[] strings) throws IllegalAccessException {
        return extractOptions(Lists.newArrayList(strings));
    }
    private JobAppOptions extractOptions(ArrayList<String> strings) throws IllegalAccessException {
        OptionParser parser=new OptionParser(JobAppOptions.class);
        applicationContext.getAutowireCapableBeanFactory().autowireBean(parser);

        return (JobAppOptions) parser.parse(strings);
    }
View Full Code Here


    //
    // TODO: Export factory out to Spring
    //

    private OptionParser createOptionParser(Class optionsClass) {
        OptionParser parser=new OptionParser(optionsClass);
        applicationContext.getAutowireCapableBeanFactory().autowireBean(parser);
        return parser;
    }
View Full Code Here

                newContext(contextPath,forcedMode);
    }

    private CentipedeShellOptions parseOptions(String[] arguments) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ApplicationContext bootstrapContext=newContext(getBootstrapApplicationContextPath());
        OptionParser parser=new OptionParser(CentipedeShellOptions.class);

        wireupOptionParser(bootstrapContext, parser);
        closeContext(bootstrapContext);
        return (CentipedeShellOptions)
                parser.parse(Lists.newArrayList(arguments));
    }
View Full Code Here

    @Override
    protected void _run(String[] arguments) throws Exception {
        NewPersistentClusterOptions options=extractOptions(arguments);

        Cluster cluster=options.clusterId.isEmpty() ? defaultCluster : applicationContext.getBean(options.clusterId,Cluster.class);
        if (!(cluster instanceof AmazonEMRCluster)) {
            throw new UsageException("the -clusterId must specify an Amazon EMR Cluster");
        }

        String name=((AmazonEMRCluster) cluster).createPersistentCluster("Persistent Cluster");
View Full Code Here

   
    @Override
    protected void _run(String[] arguments) throws Exception {
        JobAppOptions options=extractOptions(arguments);

        Cluster cluster=options.clusterId.isEmpty() ? defaultCluster : applicationContext.getBean(options.clusterId,Cluster.class);
        MavenManagedJar jar=options.jarId.isEmpty() ? defaultJar : applicationContext.getBean(options.jarId,MavenManagedJar.class);

        Map<String,String> env=System.getenv();

        if(options.runningCluster.isEmpty() && env.containsKey("RUNNING_CLUSTER")) {
            options.runningCluster=env.get("RUNNING_CLUSTER");
            logger.info("Getting AWS Job Flow ID ["+options.runningCluster+"] from RUNNING_CLUSTER environment variable");
        }

        if (!(options.runningCluster.isEmpty())) {
            cluster=new PersistentCluster(options.runningCluster);
            applicationContext.getAutowireCapableBeanFactory().autowireBean(cluster);
        }

        if(jar.getFirstArgumentIsNotAPath()) {
            if(options.remainingArguments.isEmpty())
                usage();

            String firstArgument=options.remainingArguments.get(0);

            if (firstArgument.contains(":") || firstArgument.contains("/"))
                usage();
        };
        List<String> jarArgs=jar.getHeadArguments();
        jarArgs.addAll(options.remainingArguments);
        cluster.runJob(jar,jarArgs);
    }
View Full Code Here

    @Override
    protected void _run(String[] arguments) throws Exception {
        JobAppOptions options=extractOptions(arguments);

        Cluster cluster=options.clusterId.isEmpty() ? defaultCluster : applicationContext.getBean(options.clusterId,Cluster.class);
        MavenManagedJar jar=options.jarId.isEmpty() ? defaultJar : applicationContext.getBean(options.jarId,MavenManagedJar.class);

        Map<String,String> env=System.getenv();

        if(options.runningCluster.isEmpty() && env.containsKey("RUNNING_CLUSTER")) {
            options.runningCluster=env.get("RUNNING_CLUSTER");
            logger.info("Getting AWS Job Flow ID ["+options.runningCluster+"] from RUNNING_CLUSTER environment variable");
        }

        if (!(options.runningCluster.isEmpty())) {
            cluster=new PersistentCluster(options.runningCluster);
            applicationContext.getAutowireCapableBeanFactory().autowireBean(cluster);
        }

        if(jar.getFirstArgumentIsNotAPath()) {
            if(options.remainingArguments.isEmpty())
                usage();

            String firstArgument=options.remainingArguments.get(0);

            if (firstArgument.contains(":") || firstArgument.contains("/"))
                usage();
        };
        List<String> jarArgs=jar.getHeadArguments();
        jarArgs.addAll(options.remainingArguments);
        cluster.runJob(jar,jarArgs);
    }
View Full Code Here

            options.runningCluster=env.get("RUNNING_CLUSTER");
            logger.info("Getting AWS Job Flow ID ["+options.runningCluster+"] from RUNNING_CLUSTER environment variable");
        }

        if (!(options.runningCluster.isEmpty())) {
            cluster=new PersistentCluster(options.runningCluster);
            applicationContext.getAutowireCapableBeanFactory().autowireBean(cluster);
        }

        if(jar.getFirstArgumentIsNotAPath()) {
            if(options.remainingArguments.isEmpty())
View Full Code Here

    private void runStep(MavenManagedJar jar, List<String> flowArgs, FlowStep that) throws Exception {
        if(that instanceof JobStep) {
            JobStep jobStep=(JobStep) that;
            this.runJob(jar, jobStep.getStepArgs(local,flowArgs));
        } else if(that instanceof AssignmentStep) {
            AssignmentStep ass=(AssignmentStep) that;
            local=ass.process(local, flowArgs);
        } else {
            throw new RuntimeException("Could not process step of type "+that.getClass());
        }
    }
View Full Code Here

        Map<String, Object> local = Maps.newHashMap();
        int j=0;
        {
            Assert.assertTrue(steps.get(j) instanceof AssignmentStep);
            AssignmentStep that=(AssignmentStep) steps.get(j++);
            local=that.process(local, flowArgs);
        }

        {
            Assert.assertTrue(steps.get(j) instanceof AssignmentStep);
            AssignmentStep that=(AssignmentStep) steps.get(j++);
            local=that.process(local, flowArgs);
        }

        {
            Assert.assertTrue(steps.get(j) instanceof SpringStep);
            SpringStep step0=(SpringStep) steps.get(j++);
View Full Code Here

        ApplicationContext enrichedContext=fetcher.enrichedContext();
        if (!a.hasNext())
            usage();
       
        String flowId=a.next();
        Flow f=enrichedContext.getBean(flowId,Flow.class);
       
        List<String> flowArgs=Lists.newArrayList();
        Iterators.addAll(flowArgs, a);
        cluster.runFlow(jar, f, flowArgs);
    }
View Full Code Here

TOP

Related Classes of com.ontology2.bakemono.abstractions.Codec

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.