I’m trying to use
ray.get(classifier.remote(i, x,) where
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?
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?
x = pd.read_csv(i)
and error says “cannot find file”
but if I do without ray, it is working fine
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;
@ray.remote def classifier(i, x): import os print(os.getcwd()) 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
Great! Did you fix the issue then?
yes. I’m using
os.chdir('path') within the function and it works!
I think it’s worth documenting it somewhere.
Yeah good idea! (Also, feel free to submit a contribution PR if you’d like to!)