Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No option to call ExecuteModule when using script as string and not as file #132

Open
ShukiLicht opened this issue Sep 18, 2015 · 3 comments

Comments

@ShukiLicht
Copy link

Hi,
I am working with your project and especially working with the concept of the execute the module one time and later call my script function several times from diffrent threads
the problem that there is a limitation in the code that you can't use the script as string but only as file.
Any solution for that? Or plan to fix it?

thanks,
Shuki
public ScriptFuture executeModule()
throws NodeException
{
if (scriptFile == null) {
throw new NodeException("Modules must be specified as a file name and not as a string");
}

@gbrail
Copy link
Contributor

gbrail commented Sep 18, 2015

Thanks for trying this out. Regular Node has nothing like "executeModule" so we try to do it with as little weird stuff with it as possible. It's really a wrapper that's written in JavaScript itself that just calls "require" to get the module to run -- that's why you have to pass the module name as a string and not as a actual file.

In general, Trireme uses as much regular Node code as possible, which means that module loading depends on being able to read files off the filesystem. That's what "require" does.

Changing this would be a bunch of work, so first I'd like to see if we can figure out a way for you to work around this...

@ShukiLicht
Copy link
Author

thanks for your reply, i already look in the code and saw what you menthion.
i am using the executemodule because it give me the best performance that i need .I am loading one time my script(with executeModule) , and then call the function lots of time (via the enqueueCallBack) ,the perofrmance really impressive (with full control of parallel works) and give me the SLA that i need. on the other hand this script can be change very ofen through one of my API ,so i need to transfer it as string script from my API controller to the NodeScript and execute it again.

@gbrail
Copy link
Contributor

gbrail commented Sep 18, 2015

I'm glad that's working for you and I'm glad you figured out that you have
to queue requests because of the way that the threading works out.

I think that others might want to do this and the techniques are not
exactly obvious from my docs. Is there any chance you could point to some
working code that we could turn in to a sample?

On Fri, Sep 18, 2015 at 11:09 AM, ShukiLicht [email protected]
wrote:

thanks for your reply, i already look in the code and saw what you
menthion.
i am using the executemodule because it give me the best performance that
i need .I am loading one time my script(with executeModule) , and then call
the function lots of time (via the enqueueCallBack) ,the perofrmance really
impressive (with full control of parallel works) and give me the SLA that i
need. on the other hand this script can be change very ofen through one of
my API ,so i need to transfer it as string script from my API controller to
the NodeScript and execute it again.


Reply to this email directly or view it on GitHub
#132 (comment).

Greg Brail | apigee https://apigee.com/ | twitter @gbrail
http://twitter.com/gbrail @apigee https://twitter.com/apigee
http://iloveapis.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants