springhadoop:读取泛型选项

icnyk63a  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(301)

我的项目与springhadoop集成。jar文件被调用为hadoopjar-dsomekey=somevalue
现在,如何从我的工作访问这个通用键(somekey)和值(somevalue)。
我已经在我的xml文件中设置了以下内容。但是我仍然没有看到传递给jobs配置的通用选项。
有什么我需要明确设置的吗?

wwtsj6pe

wwtsj6pe1#

我假设您使用的是spring for apache hadoop工具tasklet。如果是这种情况,则将arg作为arg元素传递。下面是一个使用mahout作业(我的 hdp:configuration 已被忽略,因为这是从spring xd运行的):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:hdp="http://www.springframework.org/schema/hadoop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                    http://www.springframework.org/schema/beans/spring-beans.xsd
                    http://www.springframework.org/schema/hadoop
                    http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
                    http://www.springframework.org/schema/batch
                    http://www.springframework.org/schema/batch/spring-batch.xsd">

    <hdp:tool-tasklet id="mahout-tasklet" jar="somepath/job/recommender/lib/mahout-core-0.9.jar"
                     tool-class="org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob">
        <hdp:arg value="-i/xd/hdfsImport"/>
        <hdp:arg value="-o/xd/hdfsImport/postsResults"/>
        <hdp:arg value="-sSIMILARITY_COOCCURRENCE"/>
        <hdp:arg value="-booleanData=false"/>
    </hdp:tool-tasklet>

    <job id="job" xmlns="http://www.springframework.org/schema/batch">
        <step id="step1">
            <tasklet ref="mahout-tasklet"/>
        </step>
    </job>
</beans>

相关问题