record() 메소드 문제

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

record() 메소드 문제

cowboy93
Grinder 사이트 "스크립트 갤러리"를 보면
record() 메소드를 사용해서 시간을 측정하라고 나옵니다.

from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest
 
test = Test(1, "my test")
 
class GetAndPostFilter(Test.InstrumentationFilter):
        def matches(self, method):
                return method.name in ["GET", "POST"]
 
request = HTTPRequest(url="http://grinder.sourceforge.net")
test.record(request, GetAndPostFilter())
 
class TestRunner:
        def __call__(self):
                # GET() is instrumented, so call statistics are reported.
                request.GET()
 
                # getUrl() is not instrumented, no call statistics are reported.
                print "Called %s" % request.url

요기서 굵은 글씨로 표현한 부분처럼요.
그런데 실행해보면 에러가 떠버리네요.

요렇게요.
16:45:38 INFO  The Grinder version 3.9.1
중간생략
16:45:38 INFO  worker process 0
16:45:38 INFO  instrumentation agents: traditional Jython instrumenter; byte code transforming instrumenter for Java
16:45:43 INFO  registered plug-in net.grinder.plugin.http.HTTPPlugin
'/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar'
2013-01-14 16:45:44,056 ERROR worker-bootstrap: Error running worker process
net.grinder.scriptengine.jython.JythonScriptExecutionException: Java exception initialising test script
        File "/Users/XXXXX/.ngrinder/script/admin/logsample.py", line 11, in ?
net.grinder.script.NonInstrumentableTypeException: record() is not supported by the Traditional Jython instrumentor
        at net.grinder.scriptengine.jython.instrumentation.traditional.TraditionalJythonInstrumenter.instrument(TraditionalJythonInstrumenter.java:101) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.scriptengine.CompositeInstrumenter.instrument(CompositeInstrumenter.java:103) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.MasterInstrumenter.instrument(MasterInstrumenter.java:85) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.TestData.instrument(TestData.java:122) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.script.Test.record(Test.java:167) ~[grinder-core-3.9.1.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_37]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_37]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_37]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_37]
        at org.python.core.PyReflectedFunction.__call__(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.PyMethod.__call__(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.PyObject.__call__(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.PyInstance.invoke(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.pycode._pyx1.f$0(/Users/cowboy93/.ngrinder/script/admin/logsample.py:11) ~[na:na]
        at org.python.pycode._pyx1.call_function(/Users/cowboy93/.ngrinder/script/admin/logsample.py) ~[na:na]
        at org.python.core.PyTableCode.call(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.PyCode.call(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.Py.runCode(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.core.__builtin__.execfile_flags(Unknown Source) ~[jython-2.2.1.jar:na]
        at org.python.util.PythonInterpreter.execfile(Unknown Source) ~[jython-2.2.1.jar:na]
        at net.grinder.scriptengine.jython.JythonScriptEngine.<init>(JythonScriptEngine.java:119) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.scriptengine.jython.JythonScriptEngineService.createScriptEngine(JythonScriptEngineService.java:105) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.ScriptEngineContainer.getScriptEngine(ScriptEngineContainer.java:105) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.GrinderProcess.run(GrinderProcess.java:380) ~[grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.WorkerProcessEntryPoint.run(WorkerProcessEntryPoint.java:87) [grinder-core-3.9.1.jar:na]
        at net.grinder.engine.process.WorkerProcessEntryPoint.main(WorkerProcessEntryPoint.java:60) [grinder-core-3.9.1.jar:na]


대체 왜 이런건가요?

이거 nGrinder가 표준을 안지킨거 아닙니까?
Reply | Threaded
Open this post in threaded view
|

Re: record() 메소드 문제

junoyoon
Administrator
헐~ 저희는 표준을 지켰습니다. 그게 단지 과거 버전일 뿐! 저희가 개발하는 도중에 The Grinder 가 3.11로 업글되었고, 여기서 Jython 2.5 를 디폴트 의존성으로 가져가게 되었습니다. record 함수는 Jython 2.5 용으로 만들어진 함수 입니다.

곧 nGrinder 도 3.2 버전에서 The Grinder 를 3.11로 업글 할 예정입니다.
그때는 record 로 지원하게 될꺼에요~ 일단은 기존 버전에 맞도록

record = test.wrap(request)

으로 바꾸시면 됩니다.

감사합니다. Contributor님. 흐..
Reply | Threaded
Open this post in threaded view
|

Re: record() 메소드 문제

junoyoon
Administrator
이건은 nGrinder 3.1.1 에 Jython 2.5.3 이 탑재됨에 따라 더이상 호환성 문제 발생하지 않습니다.