dispy icon indicating copy to clipboard operation
dispy copied to clipboard

module 'dispy.httpd' has no attribute 'cluster_status'

Open UnitedMarsupials-zz opened this issue 7 years ago • 2 comments

Trying to invoke dispy.httpd.cluster_status as documented, I get the exception cited in the title...

My cluster's status handler begins with:

def done(status, node, job):
	global http, logger, cluster
	try:
		dispy.httpd.cluster_status(status, node, job)
	except Exception as e:
		logger.error('Could not update HTTP-server: %s' % e)

UnitedMarsupials-zz avatar Sep 22 '18 23:09 UnitedMarsupials-zz

I think I need to fix documentation on this. If you want to chain status callbacks, instead of calling httpd.cluster_status, the application should do something like (I haven't tested it):

cluster = JobCluster(...)
httpd_server = dispy.httpd.DispyHTTPServer(cluster, ...)
http_callback = cluster.status_callback
cluster.status_callback = done

and then in done, call http_callback(status, node, job)

pgiri avatar Sep 25 '18 02:09 pgiri

Can you clarify this issue? I'm trying to chain cluster_status but there is an argument that is not in the documentation.

First, I create an instance of DispyHTTPServer (inside a class)

self.cluster = dispy.JobCluster(function, self.nodes, dependencies, callback, self.cluster_status, pulse_interval=60)
self.http_server = dispy.httpd.DispyHTTPServer(self.cluster)

Then in my cluster status function I tried to do:

def cluster_status(self, status, node, job):
        # update the status in the http_server
        self.http_server.cluster_status(status, node, job)

but it turns out that self.http_server.cluster_status has a forth undocumented argument (cluster_info):

    def cluster_status(self, cluster_info, status, node, job):
        """This method is called by JobCluster/SharedJobCluster
        whenever there is a change in cluster as it is set to
        cluster's 'status' parameter (unless it is already set to
        another method, in which case, this method should be called
        through chaining).
        """

Thanks,

demiangomez avatar Mar 11 '19 19:03 demiangomez