job = gl.deploy.job.create(add, x = 1, y = 2) Error

User 1952 | 5/19/2015, 9:45:55 AM

Hi

I try to run the following code from user guide:

job = gl.deploy.job.create(add, x = 1, y = 2)

but I get the following strange error:

[INFO] Validating job. Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/graphlab/deploy/job.py", line 253, in create task = task.Task(function,functionname) File "/usr/local/lib/python2.7/dist-packages/graphlab/deploy/task.py", line 114, in init self.setcode(func) File "/usr/local/lib/python2.7/dist-packages/graphlab/deploy/task.py", line 428, in setcode self.data['codestr'] = inspect.getsource(code) File "/usr/lib/python2.7/inspect.py", line 701, in getsource lines, lnum = getsourcelines(object) File "/usr/lib/python2.7/inspect.py", line 690, in getsourcelines lines, lnum = findsource(object) File "/usr/lib/python2.7/inspect.py", line 538, in findsource raise IOError('could not get source code') IOError: could not get source code

Would you please help me fix it?

Comments

User 1178 | 5/23/2015, 5:32:29 AM

Hi Andrew,

It seems like the issue you raised here has been fixed according to another thread: http://forum.dato.com/discussion/1038/job-gl-deploy-job-create-add-x-1-y-2-error#latest

Can you confirm this? Also do you mind sharing with us how you fixed the problem?

Thanks!

Ping


User 1952 | 5/23/2015, 5:48:44 AM

Hi @"Ping Wang"

Yes I posted the same issue because it was my first time posting on this forum and didn't know the proper category for my post.

And about the problem: It was an embarrassing mistake of mine! If you look at the source of inspect.py (which graphlab uses) you see that it should be able to open the source code of the function. So you cannot execute these lines in interactive mode and you have to exec your code through its source file to succeed.


User 1178 | 5/23/2015, 9:41:01 PM

Thanks a lot Andrew! Good to know that you have resolved the issue.

Ping