Ray.get with remote function doesn't work for string variables

I’m trying to use ray.get(classifier.remote(i, x,) where i and x are file paths (string variables). For some reason, the Classifier function isn’t picking up the string variables to open the files. Is it normal?
Please help!

Please help!

Can you give me a little bit more context? Like how is your Classifier function looking like and what’s the error message you are seeing?

def classifier(i,x):
x = pd.read_csv(i)
return x

and error says “cannot find file”

but if I do without ray, it is working fine :frowning:

Are you using a cluster mode? It simply means your file cannot be found from the place where the worker is executed. You can try;

def classifier(i, x):
    import os
    x = pd.read_csv(i)
    return x

Ray workers are not executed at the same directory location as your driver, so you should pass the absolute path instead, and I think it will work if you are using a single node. If you are using a cluster mode, you need to make sure the file exists in the worker node.

ohh okay. I’ll try that. Thanks!

Looks like the path is where the script is located at… and not the working directory it is supposed to go to :frowning:

Great! Did you fix the issue then?

yes. I’m using os.chdir('path') within the function and it works!

1 Like

I think it’s worth documenting it somewhere.

Yeah good idea! (Also, feel free to submit a contribution PR if you’d like to!)