猪streaming_python udfs和运送文件或压缩档案

时间:2015-03-16 10:11:29

标签: python hadoop apache-pig

我正在使用Pig和streaming_python UDF,我想知道是否存在一些方法如何将我开发的文件与我的streaming_python UDF的注册一起发送。

当我使用Jython或java时,很简单我可以将所有依赖项放到.jar中或使用类似的东西:

REGISTER /home/hadoop/jython_libs/jyson-1.0.2.jar;

遗憾的是,这种方法不适用于.py或.zip文件。

我还发现,当我使用标准流时,我可以在命令http://pig.apache.org/docs/r0.14.0/basic.html#define-udfs中使用ship,但在这种情况下,我将无法使用streaming_python UDF,其中已经实现了序列化和反序列化/对猪。

我目前正在使用猪如下:

-- load articles
ARTICLES = LOAD 's3://my_articles/articles/*' USING TextLoader as (json);

-- register udfs
REGISTER '/home/hadoop/lda_scripts.py' USING streaming_python AS lda_udfs;

-- transform
TOPICS = foreach ARTICLES generate lda_udfs.transform_json_sparse(json);

-- execute pipeline and print
dump TOPICS;

我非常关注:https://help.mortardata.com/technologies/pig/writing_python_udfs

我还从以下方面获得了一些信息: How do I make Hadoop find imported Python modules when using Python UDFs in Pig? 但我无法通过pip在bootstrap脚本中安装所有软件包,我需要发送一些文件。

有没有人有一些向工作人员发送自定义Python包和文件的经验?有一些简单的方法可以做到吗?

0 个答案:

没有答案