我们正在使用pysys测试apama,并希望提高性能。阻碍我们的一件事是,我们发出7个engine_receive命令,将7个不同的通道监控到7个不同的文件中。
问题是启动这个7接收大约需要10秒。
我尝试使用python线程以pysys并行方式开始调用接收方法,但在本例中什么也没有发生。
有没有人知道改进这一点的方法?
多个thx
发布于 2015-10-13 22:32:47
我认为这里的问题是engine_receive的启动时间...即使您修改了CorrelatorHelper类上的接收方法以不阻止等待输出文件,它仍然需要大约7秒的时间。
一种可能的方法是在所有7个通道上连接一个engine_receive,并将其记录到一个文件中,但将engine_receive配置为在输出文件中包含通道名称。原则上,您至少可以在您的regex中包含频道名称,如果在文件上进行验证,例如使用Apama 5.3
from pysys.constants import *
from pysys.basetest import BaseTest
from apama.common import XArgsHolder
from apama.correlator import CorrelatorHelper
class PySysTest(BaseTest):
def execute(self):
correlator = CorrelatorHelper(self)
correlator.start(logfile='correlator.log')
correlator.receive('receive.log', channels=['channel1','channel2','channel3'], arguments=['-C'])
correlator.injectMonitorscript('input.mon')
self.wait(4.0)
def validate(self):
pass所述input.mon文件具有;
monitor InputSender {
action onload {
on all wait(1.0) {
emit "Sending to channel 1" to "channel1";
emit "Sending to channel 2" to "channel2";
emit "Sending to channel 3" to "channel3";
}
}
}将在receive.log中拥有;
"channel1",Sending to channel 1
"channel2",Sending to channel 2
"channel3",Sending to channel 3
"channel1",Sending to channel 1
"channel2",Sending to channel 2
"channel3",Sending to channel 3
"channel1",Sending to channel 1
"channel2",Sending to channel 2
"channel3",Sending to channel 3
"channel1",Sending to channel 1
"channel2",Sending to channel 2
"channel3",Sending to channel 3这可能会在一定程度上混淆所有验证,因此可能不太理想。你应该能够开始在另一个线程,我会有兴趣看看你的代码,如果你想发送?
https://stackoverflow.com/questions/33043765
复制相似问题