Package com.asakusafw.runtime.util

Examples of com.asakusafw.runtime.util.VariableTable


            Precondition.checkMustNotBeNull(homePathPrefix, "homePathPrefix"); //$NON-NLS-1$
            Precondition.checkMustNotBeNull(executionId, "executionId"); //$NON-NLS-1$
            Precondition.checkMustNotBeNull(variables, "variables"); //$NON-NLS-1$
            this.homePathPrefix = homePathPrefix;
            this.executionId = executionId;
            VariableTable table = new VariableTable();
            table.defineVariables(variables);
            this.variableList = table.toSerialString();
        }
View Full Code Here


        this.hadoopDriver = driver;
        this.frameworkDeployer = new FrameworkDeployer(createFramework);
        this.flow = new FlowDescriptionDriver();
        this.testClass = getClass();
        this.testName = "unknown";
        this.variables = new VariableTable(RedefineStrategy.ERROR);
        this.options = new FlowCompilerOptions();
        this.libraries = new ArrayList<File>();
    }
View Full Code Here

            throw new IllegalArgumentException("rootPath must not be null"); //$NON-NLS-1$
        }
        this.context = context;
        this.hadoopConfiguration = createConfiguration();
        LOG.debug("Creating test helper for Direct I/O (basePath={})", rootPath);
        this.variables = new VariableTable(RedefineStrategy.ERROR);
        variables.defineVariables(context.getArguments());
        String resolvedRootPath = resolve(rootPath);
        LOG.debug("Resolved base path: {} -> {}", rootPath, resolvedRootPath);
        DirectDataSourceRepository repo = getRepository();
        try {
View Full Code Here

        Configuration conf = createConfig();
        for (Map.Entry<String, String> entry : extraConfigurations.entrySet()) {
            conf.set(entry.getKey(), entry.getValue());
        }
        if (batchArguments.isEmpty() == false) {
            VariableTable variables = new VariableTable(RedefineStrategy.OVERWRITE);
            for (Map.Entry<String, String> entry : batchArguments.entrySet()) {
                variables.defineVariable(entry.getKey(), entry.getValue());
            }
            conf.set(StageConstants.PROP_ASAKUSA_BATCH_ARGS, variables.toSerialString());
        }

        manager = new RuntimeResourceManager(conf);
        try {
            manager.setup();
View Full Code Here

        }
    }

    Map<String, String> getHadoopProperties() {
        TestDriverContext context = configuration.context;
        VariableTable resolver = new VariableTable(RedefineStrategy.ERROR);
        resolver.defineVariables(context.getBatchArgs());
        Map<String, String> dPropMap = Maps.create();
        dPropMap.put(StageConstants.PROP_USER, context.getOsUser());
        dPropMap.put(StageConstants.PROP_EXECUTION_ID, context.getExecutionId());
        dPropMap.put(StageConstants.PROP_ASAKUSA_BATCH_ARGS, resolver.toSerialString());
        dPropMap.putAll(context.getExtraConfigurations());
        return dPropMap;
    }
View Full Code Here

    }

    @Override
    public void truncate(TemporaryInputDescription description, TestContext context) throws IOException {
        LOG.info("Deleting input: {}", description);
        VariableTable variables = createVariables(context);
        Configuration config = configurations.newInstance();
        FileSystem fs = FileSystem.get(config);
        for (String path : description.getPaths()) {
            String resolved = variables.parse(path, false);
            Path target = fs.makeQualified(new Path(resolved));
            LOG.debug("Deleting file: {}", target);
            boolean succeed = fs.delete(target, true);
            LOG.debug("Deleted file (succeed={}): {}", succeed, target);
        }
View Full Code Here

                public void write(V model) throws IOException {
                    return;
                }
            };
        }
        VariableTable variables = createVariables(context);
        String destination = path.iterator().next();
        String resolved = variables.parse(destination, false);
        Configuration conf = configurations.newInstance();
        ModelOutput<V> output = TemporaryStorage.openOutput(conf, definition.getModelClass(), new Path(resolved));
        return output;
    }
View Full Code Here

        return output;
    }

    private VariableTable createVariables(TestContext context) {
        assert context != null;
        VariableTable result = new VariableTable();
        result.defineVariables(context.getArguments());
        return result;
    }
View Full Code Here

    @Override
    public void truncate(
            TemporaryOutputDescription description,
            TestContext context) throws IOException {
        LOG.info("Deleting output directory: {}", description);
        VariableTable variables = createVariables(context);
        Configuration config = configurations.newInstance();
        FileSystem fs = FileSystem.get(config);
        String resolved = variables.parse(description.getPathPrefix(), false);
        Path path = new Path(resolved);
        Path output = path.getParent();
        Path target;
        if (output == null) {
            LOG.warn("Skipped deleting output directory because it is a base directory: {}", path);
View Full Code Here

            DataModelDefinition<V> definition,
            TemporaryOutputDescription description,
            TestContext context) throws IOException {
        LOG.info("Preparing initial output: {}", description);
        checkType(definition, description);
        VariableTable variables = createVariables(context);
        String destination = description.getPathPrefix().replace('*', '_');
        String resolved = variables.parse(destination, false);
        Configuration conf = configurations.newInstance();
        ModelOutput<V> output = TemporaryStorage.openOutput(conf, definition.getModelClass(), new Path(resolved));
        return output;
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.runtime.util.VariableTable

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.