Accessing Dask actor attributes that are not defined explicitly

26 Views Asked by At

Following the documentation, it's clear how to access the attributes of a Dask actor if they were defined explicitly at the top of the class definition. However, is it possible to access attributes that were defined implicitly, e.g. during or after init?

Here's a modified example from the docs:

class Counter:
    """ A simple class to manage an incrementing counter """
    n = 0

    def __init__(self):
        self.n = 0
        self.test = 123

    def increment(self):
        self.n += 1
        return self.n

As per docs, accessing counter.n works well, but counter.test will raise AttributeError:

AttributeError: type object 'Counter' has no attribute 'test'

This is more of a curiousity, since in my use case it's easy to move test to the top of the class definition. However, I'm curious if there is a hack for accessing attributes that could be created on-the-fly.

0

There are 0 best solutions below