首页 \ 问答 \ 使用Python运行Storm MultiLang时出错(Error while running Storm MultiLang using Python)

使用Python运行Storm MultiLang时出错(Error while running Storm MultiLang using Python)

我正在接受Udacity的Apache Storm课程。 使用的风暴版本是0.9.3

其中一个练习是运行包含用Python编写的螺栓的拓扑。 这里简要介绍以下步骤。 出于本练习的目的,我的源目录是src ,我的包是udacity.storm

  1. udacity/storm下创建名为resources/目录。 在那里放置两个python脚本 - splitsentence.pystorm.py
  2. 在包udacity.storm下创建一个udacity.storm螺栓。 SplitSentence bolt源自ShellBolt并实现IRichBolt接口。
  3. 使用maven构建拓扑。 在此过程中还将resources/目录打包在JAR文件中。
  4. 使用命令storm jar target/mytopology.jar udacity.storm.MyTopology将拓扑提交到storm。

拓扑加载并立即死亡,我在控制台上看到以下错误

风暴客户端只能在发布版本中运行。 您似乎试图通过结帐Storm的源代码来运行客户端。

我看了一下storm.py代码,发现如果执行python脚本的目录中没有lib/目录,就会发生这种情况。 在输入一些调试语句后,我发现python脚本从以下位置运行:

的/ tmp / 06380be9-d413-4ae5-B387-fafe3acf3e65 /主管/ stormdist /鸣叫-字计数1-1449502750

我导航到这个目录,发现lib/文件夹不存在。

Storm Multilang页面没有提供有助于初学者调试所面临问题的大量信息。

非常感谢任何帮助解决这个问题。


I am following a course work on Apache Storm from Udacity. The version of storm being used is 0.9.3

One of the exercises there is to run a topology which contains a bolt written in Python. Briefly here are the steps followed. For the purpose of this exercise my source directory is src and my package is udacity.storm

  1. Create directory called resources/ under udacity/storm. Place two python scripts there - splitsentence.py and storm.py.
  2. Create a bolt SplitSentence under the package udacity.storm. SplitSentence bolt derives from ShellBolt and implements the IRichBolt interface.
  3. Build the topology using maven. During the process also package the resources/ directory within the JAR file.
  4. Submit the topology to storm using the command storm jar target/mytopology.jar udacity.storm.MyTopology.

The topology loads up and dies immediately and I see the following error on the console

The storm client can only be run from within a release. You appear to be trying to run the client from a checkout of Storm's source code.

I took a look at the storm.py code and figured out that this would happen if the lib/ directory is not present in the directory from where the python script is executing. After putting in some debug statements I identified that the python script runs from the following location :

/tmp/06380be9-d413-4ae5-b387-fafe3acf3e65/supervisor/stormdist/tweet-word-count-1-1449502750

I navigate to this directory and find that the lib/ folder is absent.

The Storm Multilang page does not give much information that would be helpful for beginners to debug the problem being faced.

Any help to solve this problem is greatly appreciated.


原文:https://stackoverflow.com/questions/34139661
更新时间:2022-10-15 12:10

最满意答案

如何创建一个元素(容器),将3个向量封装为返回元素?

您遇到的问题是函数(如Mathemematicians想要)返回一个值,但这可以是任何值:)。

您可以使用将向量作为属性的结构

struct returnElement { // choose an adequate name
  std::vector<int> aOut, bOut, cOut;
};

所以现在你的abc函数会返回returnElement struct 。 它可能看起来像这样:

returnElement abc (const int n) {
    returnElement ret;  // creating vectors to store values (dynamic int arrays)
    for (int a = 9; a <= n - 2; a++) {
        for (int b = a + 1; b <= n - 1; b++) {
            for (int c = b + 1; c <= n; c++) {
                ret.aOut.push_back(a);
                ret.bOut.push_back(b);
                ret.cOut.push_back(c);
        }
    }
    return ret;
}

How about creating an element (container) which encapsulates your 3 vectors as a return element?

The problem you're having is that functions (like Mathemematicians want to) return one value, but this can be any value :).

You could use a class or a struct which will has the vectors as attributes:

struct returnElement { // choose an adequate name
  std::vector<int> aOut, bOut, cOut;
};

so now your abc function would return the returnElement struct. It could look something like this:

returnElement abc (const int n) {
    returnElement ret;  // creating vectors to store values (dynamic int arrays)
    for (int a = 9; a <= n - 2; a++) {
        for (int b = a + 1; b <= n - 1; b++) {
            for (int c = b + 1; c <= n; c++) {
                ret.aOut.push_back(a);
                ret.bOut.push_back(b);
                ret.cOut.push_back(c);
        }
    }
    return ret;
}

相关问答

更多
  • vector func(const vector& input); 所有编译器默认情况下都会实现RVO,或者当您启用优化时,如果您不进行优化,则不关心性能,因此无论如何这都不是问题。 如果您的编译器符合C ++ 11,那么在最坏的情况下,不是复制1指针,当移动语义启动时,您将支付3个指针,这与分配内存的成本相比实际上没有成本。 构建一个简单有意义的界面, 然后测量性能和瓶颈并从那里进行优化。 根据您的使用模式,如果您可以重用输出容器,您可能希望将上述内容转换为: void func(v ...
  • 以下代码完成工作: int n=5; int** vec = new int*[n]; for(int j=0;j
  • 通常你可以通过调用(在python中)获得numpy数组的指针: arr.__array_interface__['data'] 尽管如此,请注意stribes。 给定一个c缓冲区,你可以通过numpy.frombuffer函数构造numpy数组: arr = numpy.frombuffer(buf, dtype, size, offset=0) (我假设你通过python或其C API创建新的读写缓冲区,并用它来存储计算结果) Usually you can get a pointer from n ...
  • 在.h文件中: #if __OBJC__ typedef NSArray *ArrayRetValue; #else typedef void *ArrayRetValue; #endif 在.mm文件中(您需要它来混合C ++和Obj-C代码): NSMutableArray * ListenerImpl::convertToObjC(std::vector & errors) { NSMutableArray *objCErrors = [NSMutableArray ar ...
  • std :: sort接受迭代器:虽然自定义排序可能会在单个排序步骤中同时采用索引和值,但它不太可能有用(并且可能需要不同的算法,使其变慢)。 算法设计 为什么? 因为std :: sort在O(n*logn)时间内执行。 从排序的索引中移动元素将花费O(n)时间,相比之下这相对便宜。 使用上面的例子,在给出的链接中,我们有这个现有的代码: using namespace std; template vector sort_indexes(const vector ...
  • 我会给你一个可重复的例子的奖励积分,当然还有使用Rcpp :)然后我会带走那些没有询问rcpp-devel列表...... 至于转换STL类型:你不必,但是当你决定这样做时, as<>()成语是正确的。 我能想到的唯一“更好的方法”就是像R本身一样进行名称查找: require(inline) require(Rcpp) set.seed(42) xl <- list(U=runif(4), N=rnorm(4), T2df=rt(4,2)) fun <- cxxfunction(signature(x ...
  • 如何创建一个元素(容器),将3个向量封装为返回元素? 您遇到的问题是函数(如Mathemematicians想要)返回一个值,但这可以是任何值:)。 您可以使用将向量作为属性的类或结构 : struct returnElement { // choose an adequate name std::vector aOut, bOut, cOut; }; 所以现在你的abc函数会返回returnElement struct 。 它可能看起来像这样: returnElement abc (con ...
  • 这里的C ++是有效的(一旦填写空函数)。 问题在于Visual C ++如何使用预编译头。 当您使用预编译头文件(默认设置)时,Visual C ++编译器期望每个实现文件的第一行是#include "stdafx.h" ,并且不会编译之前出现的任何内容。 这意味着忽略了代码中的包含,因此编译vector会导致错误。 如果将#include "stdafx.h"移到顶部,则应编译。 或者,您可以在项目设置中禁用预编译的标头。 The C++ here is valid (once ...
  • 在绑定.i文件中,输入以下typemap: %typemap(out) std::vector>& { for(int i = 0; i < $1->size(); ++i) { int subLength = $1->data()[i].size(); npy_intp dims[] = { subLength }; PyObject* temp = PyArray_SimpleNewFrom ...
  • 您不需要(也不应该)取消引用 - 您调用的函数需要数组,并传递它们的第一个元素。 使用 gsl_spline_init (spline, x_input_Array, y_input_Array, iNoOfPtsIni); You do not need (and should not) dereference - the function you call expects arrays, and you pass their first elements. Use gsl_spline_init (s ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。