I have been trying to run a sample example program on a cluster node ray setup. But i have only setup on a single machine.
Annotated the class with @ray.remote . when i invoked the ray.get(On the class object method)
I see the following exception.
File “/home/sumanthn/elevo-0.0.1/elevo_venv/lib64/python3.6/site-packages/ray/function_manager.py”, line 446, in _load_actor_class_from_local
actor_class = getattr(module, class_name)
AttributeError: module ‘main’ has no attribute ‘Counter’
I have tried adding the my python code path to job_config=ray.job_config.JobConfig(code_search_path=)
But still it doesn’t work
PFA for the logs . Below is my code
import ray
import sys
print(sys.path)
ray.init(address='auto', job_config=ray.job_config.JobConfig(code_search_path=sys.path))
@ray.remote
class Counter(object):
def __init__(self):
self.x = 0
def inc(self):
self.x += 1
def get_value(self):
return self.x
# Create an actor process.
c = Counter.remote()
# Check the actor's counter value.
print(ray.get(c.get_value.remote())) # 0
# Increment the counter twice and check the value again.
c.inc.remote()
c.inc.remote()
print(ray.get(c.get_value.remote())) # 2