if I have
class Blah : .....
@ray.remote
class Blah : pass
I want my code to work in both cases i.e. :
if obj is REMOTE? :
ray.get(obj.method.remote())
else :
obj.method()
How do I do the check ??
BETTER YET : can I skip the check at all ?
how about using isinstance(obj, Blah)
? IMHO you can create helper for it but probably not a good idea to skip the check, as they are fundamentally different types
1 Like
how about if i wanna check is_remote() instead … this way the check will also work for Foo and Bar ?
And then I want it to work also for method2(), method3() … too much repetitive if-else otherwise
jjyao
August 11, 2022, 3:48pm
4
Hi @vsraptor
You can implement your own is_remote() function as follows:
def is_remote(obj):
return hasattr(obj, "remote") or isinstance(obj, ray.actor.ActorHandle)
1 Like